Hardcode read command and blocks to read if we cannot calculate them for magneto-opticals.

This commit is contained in:
2020-11-11 03:14:48 +00:00
parent 274531314e
commit 5f07692d31

View File

@@ -117,9 +117,15 @@ namespace Aaru.Core.Devices
!_read12 &&
!_read16)
{
ErrorMessage = "Cannot read medium, aborting scan...";
// Magneto-opticals may have empty LBA 0 but we know they work with READ(12)
if(_dev.ScsiType == PeripheralDeviceTypes.OpticalDevice)
{
ErrorMessage = "Cannot read medium, aborting scan...";
return true;
return true;
}
_read12 = true;
}
if(_read6 &&
@@ -577,6 +583,14 @@ namespace Aaru.Core.Devices
if(!_dev.Error)
return false;
// Magneto-opticals may have LBA 0 empty, we can hard code the value to a safe one
if(_dev.ScsiType == PeripheralDeviceTypes.OpticalDevice)
{
BlocksToRead = 16;
return false;
}
BlocksToRead = 1;
ErrorMessage = $"Device error {_dev.LastError} trying to guess ideal transfer length.";