mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
* DiscImageChef.Decoders/SCSI/Modes.cs:
Check for vendor pages not following page format (even if they must). * DiscImageChef.Devices/Device/Constructor.cs: Some devices (at least smsc usb-floppy) crash and reset when receiving ata over the ATA PASS-THROUGH scsi command. This will check for SCSI compliance first giving devices time to reset. * DiscImageChef.Devices/Device/ScsiCommands.cs: Some devices (smsc usb floppies) return the real command result size disregarding allocation length and generating a buffer overflow. * DiscImageChef.Devices/Enums.cs: Added some vendor commands for Plextor and HL-DT-ST devices. * DiscImageChef/Commands/DeviceInfo.cs: Mode sense should be written even if it can't be decoded.
This commit is contained in:
@@ -95,33 +95,29 @@ namespace DiscImageChef.Devices
|
||||
AtaErrorRegistersCHS errorRegisters;
|
||||
|
||||
byte[] ataBuf;
|
||||
bool sense = AtaIdentify(out ataBuf, out errorRegisters);
|
||||
byte[] senseBuf;
|
||||
byte[] inqBuf;
|
||||
|
||||
if (!sense)
|
||||
bool scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||
|
||||
if (!scsiSense)
|
||||
{
|
||||
type = DeviceType.ATA;
|
||||
Decoders.ATA.Identify.IdentifyDevice? ATAID = Decoders.ATA.Identify.Decode(ataBuf);
|
||||
Decoders.SCSI.Inquiry.SCSIInquiry? Inquiry = Decoders.SCSI.Inquiry.Decode(inqBuf);
|
||||
|
||||
if (ATAID.HasValue)
|
||||
type = DeviceType.SCSI;
|
||||
bool sense = ScsiInquiry(out inqBuf, out senseBuf, 0x80);
|
||||
if (!sense)
|
||||
serial = Decoders.SCSI.EVPD.DecodePage80(inqBuf);
|
||||
|
||||
if (Inquiry.HasValue)
|
||||
{
|
||||
string[] separated = ATAID.Value.Model.Split(' ');
|
||||
revision = StringHandlers.SpacePaddedToString(Inquiry.Value.ProductRevisionLevel);
|
||||
model = StringHandlers.SpacePaddedToString(Inquiry.Value.ProductIdentification);
|
||||
manufacturer = StringHandlers.SpacePaddedToString(Inquiry.Value.VendorIdentification);
|
||||
|
||||
if (separated.Length == 1)
|
||||
model = separated[0];
|
||||
else
|
||||
{
|
||||
manufacturer = separated[0];
|
||||
model = separated[separated.Length - 1];
|
||||
}
|
||||
|
||||
revision = ATAID.Value.FirmwareRevision;
|
||||
serial = ATAID.Value.SerialNumber;
|
||||
|
||||
scsiType = Decoders.SCSI.PeripheralDeviceTypes.DirectAccess;
|
||||
scsiType = (Decoders.SCSI.PeripheralDeviceTypes)Inquiry.Value.PeripheralDeviceType;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
sense = AtapiIdentify(out ataBuf, out errorRegisters);
|
||||
|
||||
if (!sense)
|
||||
@@ -132,31 +128,32 @@ namespace DiscImageChef.Devices
|
||||
if (ATAID.HasValue)
|
||||
serial = ATAID.Value.SerialNumber;
|
||||
}
|
||||
}
|
||||
|
||||
byte[] senseBuf;
|
||||
byte[] inqBuf;
|
||||
|
||||
sense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||
|
||||
if (scsiSense || manufacturer == "ATA")
|
||||
{
|
||||
bool sense = AtaIdentify(out ataBuf, out errorRegisters);
|
||||
if (!sense)
|
||||
{
|
||||
Decoders.SCSI.Inquiry.SCSIInquiry? Inquiry = Decoders.SCSI.Inquiry.Decode(inqBuf);
|
||||
type = DeviceType.ATA;
|
||||
Decoders.ATA.Identify.IdentifyDevice? ATAID = Decoders.ATA.Identify.Decode(ataBuf);
|
||||
|
||||
if (type != DeviceType.ATAPI)
|
||||
if (ATAID.HasValue)
|
||||
{
|
||||
type = DeviceType.SCSI;
|
||||
sense = ScsiInquiry(out inqBuf, out senseBuf, 0x80);
|
||||
if (!sense)
|
||||
serial = Decoders.SCSI.EVPD.DecodePage80(inqBuf);
|
||||
}
|
||||
string[] separated = ATAID.Value.Model.Split(' ');
|
||||
|
||||
if (Inquiry.HasValue)
|
||||
{
|
||||
revision = StringHandlers.SpacePaddedToString(Inquiry.Value.ProductRevisionLevel);
|
||||
model = StringHandlers.SpacePaddedToString(Inquiry.Value.ProductIdentification);
|
||||
manufacturer = StringHandlers.SpacePaddedToString(Inquiry.Value.VendorIdentification);
|
||||
if (separated.Length == 1)
|
||||
model = separated[0];
|
||||
else
|
||||
{
|
||||
manufacturer = separated[0];
|
||||
model = separated[separated.Length - 1];
|
||||
}
|
||||
|
||||
scsiType = (Decoders.SCSI.PeripheralDeviceTypes)Inquiry.Value.PeripheralDeviceType;
|
||||
revision = ATAID.Value.FirmwareRevision;
|
||||
serial = ATAID.Value.SerialNumber;
|
||||
|
||||
scsiType = Decoders.SCSI.PeripheralDeviceTypes.DirectAccess;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user