mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Save firmware revision in dump hardware try.
This commit is contained in:
@@ -157,7 +157,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
ExtentsULong extents = null;
|
ExtentsULong extents = null;
|
||||||
|
|
||||||
ResumeSupport.Process(ataReader.IsLba, removable, blocks, _dev.Manufacturer, _dev.Model,
|
ResumeSupport.Process(ataReader.IsLba, removable, blocks, _dev.Manufacturer, _dev.Model,
|
||||||
_dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents);
|
_dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision);
|
||||||
|
|
||||||
if(currentTry == null ||
|
if(currentTry == null ||
|
||||||
extents == null)
|
extents == null)
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResumeSupport.Process(true, true, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
ResumeSupport.Process(true, true, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
||||||
ref _resume, ref currentTry, ref extents);
|
ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision);
|
||||||
|
|
||||||
if(currentTry == null ||
|
if(currentTry == null ||
|
||||||
extents == null)
|
extents == null)
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
ExtentsULong extents = null;
|
ExtentsULong extents = null;
|
||||||
|
|
||||||
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents);
|
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision);
|
||||||
|
|
||||||
if(currentTry == null ||
|
if(currentTry == null ||
|
||||||
extents == null)
|
extents == null)
|
||||||
@@ -752,7 +752,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
ExtentsULong extents = null;
|
ExtentsULong extents = null;
|
||||||
|
|
||||||
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents);
|
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision);
|
||||||
|
|
||||||
if(currentTry == null ||
|
if(currentTry == null ||
|
||||||
extents == null)
|
extents == null)
|
||||||
|
|||||||
@@ -40,14 +40,10 @@ using Version = DiscImageChef.CommonTypes.Interop.Version;
|
|||||||
|
|
||||||
namespace DiscImageChef.Core.Devices.Dumping
|
namespace DiscImageChef.Core.Devices.Dumping
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>Implements resume support</summary>
|
||||||
/// Implements resume support
|
internal static class ResumeSupport
|
||||||
/// </summary>
|
|
||||||
static class ResumeSupport
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>Process resume</summary>
|
||||||
/// Process resume
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="isLba">If drive is LBA</param>
|
/// <param name="isLba">If drive is LBA</param>
|
||||||
/// <param name="removable">If media is removable from device</param>
|
/// <param name="removable">If media is removable from device</param>
|
||||||
/// <param name="blocks">Media blocks</param>
|
/// <param name="blocks">Media blocks</param>
|
||||||
@@ -58,20 +54,22 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
/// <param name="resume">Previous resume, or null</param>
|
/// <param name="resume">Previous resume, or null</param>
|
||||||
/// <param name="currentTry">Current dumping hardware</param>
|
/// <param name="currentTry">Current dumping hardware</param>
|
||||||
/// <param name="extents">Dumped extents</param>
|
/// <param name="extents">Dumped extents</param>
|
||||||
|
/// <param name="firmware">Firmware revision</param>
|
||||||
|
/// <param name="isTape">Set to <c>true</c> if device is a streaming tape, <c>false</c> otherwise</param>
|
||||||
/// <exception cref="System.NotImplementedException">If device uses CHS addressing</exception>
|
/// <exception cref="System.NotImplementedException">If device uses CHS addressing</exception>
|
||||||
/// <exception cref="System.InvalidOperationException">
|
/// <exception cref="System.InvalidOperationException">
|
||||||
/// If the provided resume does not correspond with the current in
|
/// If the provided resume does not correspond with the current in
|
||||||
/// progress dump
|
/// progress dump
|
||||||
/// </exception>
|
/// </exception>
|
||||||
internal static void Process(bool isLba, bool removable, ulong blocks,
|
internal static void Process(bool isLba, bool removable, ulong blocks, string manufacturer, string model,
|
||||||
string manufacturer, string model,
|
string serial, PlatformID platform, ref Resume resume,
|
||||||
string serial, PlatformID platform, ref Resume resume,
|
ref DumpHardwareType currentTry, ref ExtentsULong extents, string firmware,
|
||||||
ref DumpHardwareType currentTry, ref ExtentsULong extents,
|
bool isTape = false)
|
||||||
bool isTape = false)
|
|
||||||
{
|
{
|
||||||
if(resume != null)
|
if(resume != null)
|
||||||
{
|
{
|
||||||
if(!isLba) throw new NotImplementedException("Resuming CHS devices is currently not supported.");
|
if(!isLba)
|
||||||
|
throw new NotImplementedException("Resuming CHS devices is currently not supported.");
|
||||||
|
|
||||||
if(resume.Tape != isTape)
|
if(resume.Tape != isTape)
|
||||||
throw new
|
throw new
|
||||||
@@ -81,51 +79,60 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
throw new
|
throw new
|
||||||
InvalidOperationException($"Resume file specifies a {(resume.Removable ? "removable" : "non removable")} device but you're requesting to dump a {(removable ? "removable" : "non removable")} device, not continuing...");
|
InvalidOperationException($"Resume file specifies a {(resume.Removable ? "removable" : "non removable")} device but you're requesting to dump a {(removable ? "removable" : "non removable")} device, not continuing...");
|
||||||
|
|
||||||
if(!isTape && resume.LastBlock != blocks - 1)
|
if(!isTape &&
|
||||||
|
resume.LastBlock != blocks - 1)
|
||||||
throw new
|
throw new
|
||||||
InvalidOperationException($"Resume file specifies a device with {resume.LastBlock + 1} blocks but you're requesting to dump one with {blocks} blocks, not continuing...");
|
InvalidOperationException($"Resume file specifies a device with {resume.LastBlock + 1} blocks but you're requesting to dump one with {blocks} blocks, not continuing...");
|
||||||
|
|
||||||
foreach(DumpHardwareType oldtry in resume.Tries)
|
foreach(DumpHardwareType oldTry in resume.Tries)
|
||||||
{
|
{
|
||||||
if(!removable)
|
if(!removable)
|
||||||
{
|
{
|
||||||
if(oldtry.Manufacturer != manufacturer)
|
if(oldTry.Manufacturer != manufacturer)
|
||||||
throw new
|
throw new
|
||||||
InvalidOperationException($"Resume file specifies a device manufactured by {oldtry.Manufacturer} but you're requesting to dump one by {manufacturer}, not continuing...");
|
InvalidOperationException($"Resume file specifies a device manufactured by {oldTry.Manufacturer} but you're requesting to dump one by {manufacturer}, not continuing...");
|
||||||
|
|
||||||
if(oldtry.Model != model)
|
if(oldTry.Model != model)
|
||||||
throw new
|
throw new
|
||||||
InvalidOperationException($"Resume file specifies a device model {oldtry.Model} but you're requesting to dump model {model}, not continuing...");
|
InvalidOperationException($"Resume file specifies a device model {oldTry.Model} but you're requesting to dump model {model}, not continuing...");
|
||||||
|
|
||||||
if(oldtry.Serial != serial)
|
if(oldTry.Serial != serial)
|
||||||
throw new
|
throw new
|
||||||
InvalidOperationException($"Resume file specifies a device with serial {oldtry.Serial} but you're requesting to dump one with serial {serial}, not continuing...");
|
InvalidOperationException($"Resume file specifies a device with serial {oldTry.Serial} but you're requesting to dump one with serial {serial}, not continuing...");
|
||||||
|
|
||||||
|
if(oldTry.Firmware != firmware)
|
||||||
|
throw new
|
||||||
|
InvalidOperationException($"Resume file specifies a device with firmware version {oldTry.Firmware} but you're requesting to dump one with firmware version {firmware}, not continuing...");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldtry.Software == null)
|
if(oldTry.Software == null)
|
||||||
throw new InvalidOperationException("Found corrupt resume file, cannot continue...");
|
throw new InvalidOperationException("Found corrupt resume file, cannot continue...");
|
||||||
|
|
||||||
if(oldtry.Software.Name != "DiscImageChef" ||
|
if(oldTry.Software.Name != "DiscImageChef" ||
|
||||||
oldtry.Software.OperatingSystem != platform.ToString() ||
|
oldTry.Software.OperatingSystem != platform.ToString() ||
|
||||||
oldtry.Software.Version != Version.GetVersion()) continue;
|
oldTry.Software.Version != Version.GetVersion())
|
||||||
|
continue;
|
||||||
|
|
||||||
if(removable && (oldtry.Manufacturer != manufacturer || oldtry.Model != model ||
|
if(removable && (oldTry.Manufacturer != manufacturer || oldTry.Model != model ||
|
||||||
oldtry.Serial != serial)) continue;
|
oldTry.Serial != serial || oldTry.Firmware != firmware))
|
||||||
|
continue;
|
||||||
|
|
||||||
currentTry = oldtry;
|
currentTry = oldTry;
|
||||||
extents = ExtentsConverter.FromMetadata(currentTry.Extents);
|
extents = ExtentsConverter.FromMetadata(currentTry.Extents);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentTry != null) return;
|
if(currentTry != null)
|
||||||
|
return;
|
||||||
|
|
||||||
currentTry = new DumpHardwareType
|
currentTry = new DumpHardwareType
|
||||||
{
|
{
|
||||||
Software = CommonTypes.Metadata.Version.GetSoftwareType(),
|
Software = CommonTypes.Metadata.Version.GetSoftwareType(), Manufacturer = manufacturer,
|
||||||
Manufacturer = manufacturer,
|
Model = model, Serial = serial,
|
||||||
Model = model,
|
Firmware = firmware
|
||||||
Serial = serial
|
|
||||||
};
|
};
|
||||||
|
|
||||||
resume.Tries.Add(currentTry);
|
resume.Tries.Add(currentTry);
|
||||||
extents = new ExtentsULong();
|
extents = new ExtentsULong();
|
||||||
}
|
}
|
||||||
@@ -133,19 +140,18 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
{
|
{
|
||||||
resume = new Resume
|
resume = new Resume
|
||||||
{
|
{
|
||||||
Tries = new List<DumpHardwareType>(),
|
Tries = new List<DumpHardwareType>(), CreationDate = DateTime.UtcNow,
|
||||||
CreationDate = DateTime.UtcNow,
|
BadBlocks = new List<ulong>(),
|
||||||
BadBlocks = new List<ulong>(),
|
LastBlock = isTape ? 0 : blocks - 1, Tape = isTape
|
||||||
LastBlock = isTape ? 0 : blocks - 1,
|
|
||||||
Tape = isTape
|
|
||||||
};
|
};
|
||||||
|
|
||||||
currentTry = new DumpHardwareType
|
currentTry = new DumpHardwareType
|
||||||
{
|
{
|
||||||
Software = CommonTypes.Metadata.Version.GetSoftwareType(),
|
Software = CommonTypes.Metadata.Version.GetSoftwareType(), Manufacturer = manufacturer,
|
||||||
Manufacturer = manufacturer,
|
Model = model, Serial = serial,
|
||||||
Model = model,
|
Firmware = firmware
|
||||||
Serial = serial
|
|
||||||
};
|
};
|
||||||
|
|
||||||
resume.Tries.Add(currentTry);
|
resume.Tries.Add(currentTry);
|
||||||
extents = new ExtentsULong();
|
extents = new ExtentsULong();
|
||||||
resume.Removable = removable;
|
resume.Removable = removable;
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
ExtentsULong extents = null;
|
ExtentsULong extents = null;
|
||||||
|
|
||||||
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents);
|
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision);
|
||||||
|
|
||||||
if(currentTry == null ||
|
if(currentTry == null ||
|
||||||
extents == null)
|
extents == null)
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
ExtentsULong extents = null;
|
ExtentsULong extents = null;
|
||||||
|
|
||||||
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, true);
|
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, true);
|
||||||
|
|
||||||
if(currentTry == null ||
|
if(currentTry == null ||
|
||||||
extents == null)
|
extents == null)
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
ExtentsULong extents = null;
|
ExtentsULong extents = null;
|
||||||
|
|
||||||
ResumeSupport.Process(true, false, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
ResumeSupport.Process(true, false, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
||||||
ref _resume, ref currentTry, ref extents);
|
ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision);
|
||||||
|
|
||||||
if(currentTry == null ||
|
if(currentTry == null ||
|
||||||
extents == null)
|
extents == null)
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
ExtentsULong extents = null;
|
ExtentsULong extents = null;
|
||||||
|
|
||||||
ResumeSupport.Process(true, true, totalSize, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
ResumeSupport.Process(true, true, totalSize, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
||||||
ref _resume, ref currentTry, ref extents);
|
ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision);
|
||||||
|
|
||||||
if(currentTry == null ||
|
if(currentTry == null ||
|
||||||
extents == null)
|
extents == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user