mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Device type, manufacturer, model, revision and serial number
are now obtained in device constructor.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2015-10-19 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Device/Constructor.cs:
|
||||
* DiscImageChef.Devices.csproj:
|
||||
Device type, manufacturer, model, revision and serial number
|
||||
are now obtained in device constructor.
|
||||
|
||||
2015-10-19 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* DiscImageChef.Devices.csproj:
|
||||
|
||||
@@ -90,6 +90,79 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
|
||||
type = DeviceType.Unknown;
|
||||
|
||||
AtaErrorRegistersCHS errorRegisters;
|
||||
|
||||
byte[] ataBuf;
|
||||
bool sense = AtaIdentify(out ataBuf, out errorRegisters);
|
||||
|
||||
if (!sense)
|
||||
{
|
||||
type = DeviceType.ATA;
|
||||
Decoders.ATA.Identify.IdentifyDevice? ATAID = Decoders.ATA.Identify.Decode(ataBuf);
|
||||
|
||||
if (ATAID.HasValue)
|
||||
{
|
||||
string[] separated = ATAID.Value.Model.Split(' ');
|
||||
|
||||
if (separated.Length == 1)
|
||||
model = separated[0];
|
||||
else
|
||||
{
|
||||
manufacturer = separated[0];
|
||||
model = separated[separated.Length - 1];
|
||||
}
|
||||
|
||||
revision = ATAID.Value.FirmwareRevision;
|
||||
serial = ATAID.Value.SerialNumber;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sense = AtapiIdentify(out ataBuf, out errorRegisters);
|
||||
|
||||
if (!sense)
|
||||
{
|
||||
type = DeviceType.ATAPI;
|
||||
Decoders.ATA.Identify.IdentifyDevice? ATAID = Decoders.ATA.Identify.Decode(ataBuf);
|
||||
|
||||
if (ATAID.HasValue)
|
||||
serial = ATAID.Value.SerialNumber;
|
||||
}
|
||||
|
||||
byte[] senseBuf;
|
||||
byte[] inqBuf;
|
||||
|
||||
sense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||
|
||||
if (!sense)
|
||||
{
|
||||
Decoders.SCSI.Inquiry.SCSIInquiry? Inquiry = Decoders.SCSI.Inquiry.Decode(inqBuf);
|
||||
|
||||
if (type != DeviceType.ATAPI)
|
||||
{
|
||||
type = DeviceType.SCSI;
|
||||
sense = ScsiInquiry(out inqBuf, out senseBuf, 0x80);
|
||||
if (!sense)
|
||||
serial = Decoders.SCSI.EVPD.DecodePage80(inqBuf);
|
||||
}
|
||||
|
||||
if (Inquiry.HasValue)
|
||||
{
|
||||
revision = StringHandlers.SpacePaddedToString(Inquiry.Value.ProductRevisionLevel);
|
||||
model = StringHandlers.SpacePaddedToString(Inquiry.Value.ProductIdentification);
|
||||
manufacturer = StringHandlers.SpacePaddedToString(Inquiry.Value.VendorIdentification);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type == DeviceType.Unknown)
|
||||
{
|
||||
manufacturer = null;
|
||||
model = null;
|
||||
revision = null;
|
||||
serial = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,5 +77,13 @@
|
||||
<Project>{CCAA7AFE-C094-4D82-A66D-630DE8A3F545}</Project>
|
||||
<Name>DiscImageChef.Console</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DiscImageChef.Decoders\DiscImageChef.Decoders.csproj">
|
||||
<Project>{0BEB3088-B634-4289-AE17-CDF2D25D00D5}</Project>
|
||||
<Name>DiscImageChef.Decoders</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DiscImageChef.Helpers\DiscImageChef.Helpers.csproj">
|
||||
<Project>{F8BDF57B-1571-4CD0-84B3-B422088D359A}</Project>
|
||||
<Name>DiscImageChef.Helpers</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user