mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
* DiscImageChef.Decoders/SCSI/Sense.cs:
Additional length may be bigger than provided buffer. * DiscImageChef/Commands/MediaInfo.cs: Implement detection of medium not present and waiting for drive to become ready.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* SCSI/Sense.cs:
|
||||
Additional length may be bigger than provided buffer.
|
||||
|
||||
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* DVD/PFI.cs:
|
||||
|
||||
@@ -304,9 +304,6 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
decoded.Information = (uint)((sense[3] << 24) + (sense[4] << 16) + (sense[5] << 8) + sense[6]);
|
||||
decoded.AdditionalLength = sense[7];
|
||||
|
||||
if (sense.Length < decoded.AdditionalLength + 8)
|
||||
return decoded;
|
||||
|
||||
if(sense.Length >= 12)
|
||||
decoded.CommandSpecific = (uint)((sense[8] << 24) + (sense[9] << 16) + (sense[10] << 8) + sense[11]);
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Commands/MediaInfo.cs:
|
||||
Implement detection of medium not present and waiting for
|
||||
drive to become ready.
|
||||
|
||||
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Commands/MediaInfo.cs:
|
||||
|
||||
@@ -112,6 +112,51 @@ namespace DiscImageChef.Commands
|
||||
ulong blocks = 0;
|
||||
uint blockSize = 0;
|
||||
|
||||
sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration);
|
||||
if (sense)
|
||||
{
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf);
|
||||
if (decSense.HasValue)
|
||||
{
|
||||
if (decSense.Value.ASC == 0x3A)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Please insert media in drive");
|
||||
return;
|
||||
}
|
||||
|
||||
if (decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
|
||||
{
|
||||
int leftRetries = 10;
|
||||
while (leftRetries > 0)
|
||||
{
|
||||
DicConsole.WriteLine("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration);
|
||||
if (!sense)
|
||||
break;
|
||||
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
if (sense)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Unknown testing unit was ready.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.DirectAccess ||
|
||||
dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice ||
|
||||
dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice ||
|
||||
|
||||
Reference in New Issue
Block a user