On drives that support D8h use it to read Audio CD sectors as some fail due to a firmware bug.

This commit is contained in:
2020-03-02 23:58:20 +00:00
parent 18db5ed8a5
commit f423d99b08
7 changed files with 123 additions and 21 deletions

View File

@@ -52,12 +52,37 @@ namespace Aaru.Core.Devices.Dumping
ExtentsULong extents, int offsetBytes, bool readcd, int sectorsForOffset, uint subSize,
MmcSubchannel supportedSubchannel, ref double totalDuration)
{
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
double cmdDuration; // Command execution time
const uint sectorSize = 2352; // Full sector size
byte[] tmpBuf; // Temporary buffer
byte[] senseBuf = null; // Sense buffer
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
double cmdDuration; // Command execution time
const uint sectorSize = 2352; // Full sector size
byte[] tmpBuf; // Temporary buffer
byte[] senseBuf = null; // Sense buffer
PlextorSubchannel supportedPlextorSubchannel;
switch(supportedSubchannel)
{
case MmcSubchannel.None:
supportedPlextorSubchannel = PlextorSubchannel.None;
break;
case MmcSubchannel.Raw:
supportedPlextorSubchannel = PlextorSubchannel.All;
break;
case MmcSubchannel.Q16:
supportedPlextorSubchannel = PlextorSubchannel.Q16;
break;
case MmcSubchannel.Rw:
supportedPlextorSubchannel = PlextorSubchannel.Pack;
break;
default:
supportedPlextorSubchannel = PlextorSubchannel.None;
break;
}
if(_resume.BadBlocks.Count <= 0 ||
_aborted ||
@@ -195,7 +220,15 @@ namespace Aaru.Core.Devices.Dumping
sectorsToReRead = (byte)(sectorsForOffset + 1);
}
if(readcd)
if(_supportsPlextorD8 && audioExtents.Contains(badSector))
{
sense = _dev.PlextorReadCdDa(out cmdBuf, out senseBuf, badSectorToReRead, blockSize,
sectorsToReRead, supportedPlextorSubchannel, _dev.Timeout,
out cmdDuration);
totalDuration += cmdDuration;
}
else if(readcd)
{
sense = _dev.ReadCd(out cmdBuf, out senseBuf, badSectorToReRead, blockSize, sectorsToReRead,
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true,