diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs
index 2b8ec9447..d0535fc52 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs
@@ -1141,7 +1141,7 @@ sealed partial class Dump
sectorsForOffset);
}
- mhddLog.Close();
+ mhddLog.Flush();
ibgLog.Close(_dev,
blocks,
@@ -1183,7 +1183,8 @@ sealed partial class Dump
isrcs,
ref mcn,
subchannelExtents,
- smallestPregapLbaPerTrack);
+ smallestPregapLbaPerTrack,
+ mhddLog);
if(dskType is MediaType.CDR or MediaType.CDRW && _resume.BadBlocks.Count > 0 && _ignoreCdrRunOuts > 0)
{
@@ -1214,7 +1215,10 @@ sealed partial class Dump
ref mcn,
subchannelExtents,
smallestPregapLbaPerTrack,
- supportsLongSectors);
+ supportsLongSectors,
+ mhddLog);
+
+ mhddLog.Close();
// Re-read the audio sectors the drive concealed until they converge on stable, C2-clean data, rewriting the
// ones that do. Runs after the normal retries so hard errors are dealt with first.
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs
index 93a03398b..9c9a230cc 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs
@@ -75,18 +75,19 @@ partial class Dump
/// Disc media catalogue number
/// List of subchannels not yet dumped correctly
/// List of smallest pregap relative address per track
+ /// MHDD log
void RetryCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardware currentTry, ExtentsULong extents,
int offsetBytes, bool readcd, int sectorsForOffset, uint subSize,
MmcSubchannel supportedSubchannel, ref double totalDuration, SubchannelLog subLog,
MmcSubchannel desiredSubchannel, Track[] tracks, Dictionary isrcs,
ref string mcn, HashSet subchannelExtents,
- Dictionary smallestPregapLbaPerTrack, bool supportsLongSectors)
+ Dictionary smallestPregapLbaPerTrack, bool supportsLongSectors, MhddLog mhddLog)
{
- var sense = true; // Sense indicator
- byte[] cmdBuf = null; // Data buffer
- double cmdDuration; // Command execution time
- const uint sectorSize = 2352; // Full sector size
- ReadOnlySpan senseBuf = null; // Sense buffer
+ var sense = true; // Sense indicator
+ byte[] cmdBuf = null; // Data buffer
+ double cmdDuration = 0; // Command execution time
+ const uint sectorSize = 2352; // Full sector size
+ ReadOnlySpan senseBuf = null; // Sense buffer
PlextorSubchannel supportedPlextorSubchannel;
var outputOptical = _outputPlugin as IWritableOpticalImage;
@@ -356,8 +357,10 @@ partial class Dump
badSectorToReRead,
sectorsToReRead,
_dev.Timeout,
- out cmdDuration,
+ out double plainDuration,
true);
+
+ cmdDuration += plainDuration;
}
}
else if(_supportsPlextorD8 && audioExtents.Contains(badSector))
@@ -549,7 +552,12 @@ partial class Dump
{
_errorLog?.WriteLine(badSector, _dev.Error, _dev.LastError, senseBuf.ToArray());
- if(!runningPersistent) continue;
+ if(!runningPersistent)
+ {
+ mhddLog.WriteRetry(badSector, cmdDuration, true);
+
+ continue;
+ }
DecodedSense? decSense = Sense.Decode(senseBuf);
@@ -641,6 +649,7 @@ partial class Dump
out double readCdDuration);
totalDuration += readCdDuration;
+ cmdDuration += readCdDuration;
if(!readCdSense && !_dev.Error && CdChecksums.CheckCdSector(readCdBuf) == true)
{
@@ -771,6 +780,7 @@ partial class Dump
out double readCdDuration);
totalDuration += readCdDuration;
+ cmdDuration += readCdDuration;
if(!readCdSense && !_dev.Error && CdChecksums.CheckCdSector(readCdBuf) == true)
{
@@ -789,6 +799,8 @@ partial class Dump
else
_errorLog?.WriteLine(badSector, _dev.Error, _dev.LastError, senseBuf.ToArray());
+ mhddLog.WriteRetry(badSector, cmdDuration, sectorStatus == SectorStatus.Errored);
+
if(supportedSubchannel != MmcSubchannel.None)
{
var data = new byte[sectorSize];
@@ -932,6 +944,7 @@ partial class Dump
out cmdDuration);
totalDuration += cmdDuration;
+ mhddLog.WriteRetry(badSector, cmdDuration, sense || _dev.Error);
}
if(sense || _dev.Error)
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs
index 0a92778c0..ccf3181d0 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs
@@ -78,12 +78,13 @@ partial class Dump
/// Disc media catalogue number
/// List of subchannels not yet dumped correctly
/// List of smallest pregap relative address per track
+ /// MHDD log
void TrimCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardware currentTry, ExtentsULong extents,
bool newTrim, int offsetBytes, bool read6, bool read10, bool read12, bool read16, bool readcd,
int sectorsForOffset, uint subSize, MmcSubchannel supportedSubchannel, bool supportsLongSectors,
ref double totalDuration, SubchannelLog subLog, MmcSubchannel desiredSubchannel, Track[] tracks,
Dictionary isrcs, ref string mcn, HashSet subchannelExtents,
- Dictionary smallestPregapLbaPerTrack)
+ Dictionary smallestPregapLbaPerTrack, MhddLog mhddLog)
{
var sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
@@ -399,6 +400,7 @@ partial class Dump
if(sense || _dev.Error)
{
_errorLog?.WriteLine(badSectorToRead, _dev.Error, _dev.LastError, senseBuf.ToArray());
+ mhddLog.WriteRetry(badSector, cmdDuration, true);
continue;
}
@@ -474,6 +476,7 @@ partial class Dump
out double readCdDuration);
totalDuration += readCdDuration;
+ cmdDuration += readCdDuration;
if(!readCdSense && !_dev.Error && CdChecksums.CheckCdSector(readCdBuf) == true)
{
@@ -541,6 +544,8 @@ partial class Dump
}
}
+ mhddLog.WriteRetry(badSector, cmdDuration, sectorStatus == SectorStatus.Errored);
+
if(supportedSubchannel != MmcSubchannel.None)
{
var data = new byte[sectorSize];