mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Added support for FireWire devices.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2015-12-31 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Device/Variables.cs:
|
||||
* Device/Constructor.cs:
|
||||
Added support for FireWire devices.
|
||||
|
||||
2015-12-31 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Device/Constructor.cs:
|
||||
|
||||
@@ -176,6 +176,70 @@ namespace DiscImageChef.Devices
|
||||
usb = false;
|
||||
#endregion USB
|
||||
|
||||
#region FireWire
|
||||
if(platformID == DiscImageChef.Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd"))
|
||||
{
|
||||
string devPath = devicePath.Substring(5);
|
||||
if(System.IO.Directory.Exists("/sys/block/" + devPath))
|
||||
{
|
||||
string resolvedLink = Linux.Command.ReadLink("/sys/block/" + devPath);
|
||||
resolvedLink = "/sys" + resolvedLink.Substring(2);
|
||||
if(!string.IsNullOrEmpty(resolvedLink))
|
||||
{
|
||||
while(resolvedLink.Contains("firewire"))
|
||||
{
|
||||
resolvedLink = System.IO.Path.GetDirectoryName(resolvedLink);
|
||||
if(System.IO.File.Exists(resolvedLink + "/model") &&
|
||||
System.IO.File.Exists(resolvedLink + "/vendor") &&
|
||||
System.IO.File.Exists(resolvedLink + "/guid"))
|
||||
{
|
||||
System.IO.StreamReader fwSr;
|
||||
string fwTemp;
|
||||
|
||||
fwSr = new System.IO.StreamReader(resolvedLink + "/model");
|
||||
fwTemp = fwSr.ReadToEnd();
|
||||
uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out firewireModel);
|
||||
fwSr.Close();
|
||||
|
||||
fwSr = new System.IO.StreamReader(resolvedLink + "/vendor");
|
||||
fwTemp = fwSr.ReadToEnd();
|
||||
uint.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out firewireVendor);
|
||||
fwSr.Close();
|
||||
|
||||
fwSr = new System.IO.StreamReader(resolvedLink + "/guid");
|
||||
fwTemp = fwSr.ReadToEnd();
|
||||
ulong.TryParse(fwTemp, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out firewireGuid);
|
||||
fwSr.Close();
|
||||
|
||||
if(System.IO.File.Exists(resolvedLink + "/model_name"))
|
||||
{
|
||||
fwSr = new System.IO.StreamReader(resolvedLink + "/model_name");
|
||||
firewireModelName = fwSr.ReadToEnd().Trim();
|
||||
fwSr.Close();
|
||||
}
|
||||
|
||||
if(System.IO.File.Exists(resolvedLink + "/vendor_name"))
|
||||
{
|
||||
fwSr = new System.IO.StreamReader(resolvedLink + "/vendor_name");
|
||||
firewireVendorName = fwSr.ReadToEnd().Trim();
|
||||
fwSr.Close();
|
||||
}
|
||||
|
||||
firewire = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Implement for other operating systems
|
||||
else
|
||||
firewire = false;
|
||||
#endregion FireWire
|
||||
|
||||
if (!scsiSense)
|
||||
{
|
||||
Decoders.SCSI.Inquiry.SCSIInquiry? Inquiry = Decoders.SCSI.Inquiry.Decode(inqBuf);
|
||||
@@ -265,6 +329,24 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (firewire)
|
||||
{
|
||||
if (string.IsNullOrEmpty(manufacturer))
|
||||
manufacturer = firewireVendorName;
|
||||
if (string.IsNullOrEmpty(model))
|
||||
model = firewireModelName;
|
||||
if (string.IsNullOrEmpty(serial))
|
||||
serial = String.Format("{0:X16}", firewireGuid);
|
||||
else
|
||||
{
|
||||
foreach (char c in serial)
|
||||
{
|
||||
if(Char.IsControl(c))
|
||||
serial = String.Format("{0:X16}", firewireGuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,12 @@ namespace DiscImageChef.Devices
|
||||
readonly string usbManufacturerString;
|
||||
readonly string usbProductString;
|
||||
readonly string usbSerialString;
|
||||
readonly bool firewire;
|
||||
readonly ulong firewireGuid;
|
||||
readonly uint firewireModel;
|
||||
readonly string firewireModelName;
|
||||
readonly uint firewireVendor;
|
||||
readonly string firewireVendorName;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Platform ID for this device
|
||||
@@ -286,6 +292,42 @@ namespace DiscImageChef.Devices
|
||||
return usbSerialString;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this device is attached via FireWire.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this device is attached via FireWire; otherwise, <c>false</c>.</value>
|
||||
public bool IsFireWire { get { return firewire; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire GUID
|
||||
/// </summary>
|
||||
/// <value>The FireWire GUID.</value>
|
||||
public ulong FireWireGUID { get { return firewireGuid; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire model number
|
||||
/// </summary>
|
||||
/// <value>The FireWire model.</value>
|
||||
public uint FireWireModel { get { return firewireModel; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire model name.
|
||||
/// </summary>
|
||||
/// <value>The FireWire model name.</value>
|
||||
public string FireWireModelName { get { return firewireModelName; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire vendor number.
|
||||
/// </summary>
|
||||
/// <value>The FireWire vendor number.</value>
|
||||
public uint FireWireVendor { get { return firewireVendor; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire vendor name.
|
||||
/// </summary>
|
||||
/// <value>The FireWire vendor name.</value>
|
||||
public string FireWireVendorName { get { return firewireVendorName; } }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2015-12-31 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Commands/DeviceInfo.cs:
|
||||
Added support for FireWire devices.
|
||||
|
||||
2015-12-31 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Commands/DeviceInfo.cs:
|
||||
|
||||
@@ -75,9 +75,20 @@ namespace DiscImageChef.Commands
|
||||
DicConsole.WriteLine("USB descriptor is {0} bytes", dev.USBDescriptors.Length);
|
||||
DicConsole.WriteLine("USB Vendor ID: {0:X4}", dev.USBVendorID);
|
||||
DicConsole.WriteLine("USB Product ID: {0:X4}", dev.USBProductID);
|
||||
DicConsole.WriteLine("USB Manufacturer: {0:X4}", dev.USBManufacturerString);
|
||||
DicConsole.WriteLine("USB Product: {0:X4}", dev.USBProductString);
|
||||
DicConsole.WriteLine("USB Serial number: {0:X4}", dev.USBSerialString);
|
||||
DicConsole.WriteLine("USB Manufacturer: {0}", dev.USBManufacturerString);
|
||||
DicConsole.WriteLine("USB Product: {0}", dev.USBProductString);
|
||||
DicConsole.WriteLine("USB Serial number: {0}", dev.USBSerialString);
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if (dev.IsFireWire)
|
||||
{
|
||||
DicConsole.WriteLine("FireWire device");
|
||||
DicConsole.WriteLine("FireWire Vendor ID: {0:X6}", dev.FireWireVendor);
|
||||
DicConsole.WriteLine("FireWire Model ID: {0:X6}", dev.FireWireModel);
|
||||
DicConsole.WriteLine("FireWire Manufacturer: {0}", dev.FireWireVendorName);
|
||||
DicConsole.WriteLine("FireWire Model: {0}", dev.FireWireModelName);
|
||||
DicConsole.WriteLine("FireWire GUID: {0:X16}", dev.FireWireGUID);
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user