mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move SecureDigital / MultiMediaCard device reporting to non-static class and its UI to CLI.
This commit is contained in:
@@ -39,26 +39,14 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
/// <summary>
|
||||
/// Implements creating a device report for a SecureDigital or MultiMediaCard flash card
|
||||
/// </summary>
|
||||
public static class SecureDigital
|
||||
public partial class DeviceReport
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a device report for a SecureDigital or MultiMediaCard flash card
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
/// <param name="report">Device report</param>
|
||||
public static void Report(Device dev, ref DeviceReportV2 report)
|
||||
public MmcSd MmcSdReport()
|
||||
{
|
||||
if(report == null) return;
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
report.MultiMediaCard = new MmcSd();
|
||||
break;
|
||||
case DeviceType.SecureDigital:
|
||||
report.SecureDigital = new MmcSd();
|
||||
break;
|
||||
}
|
||||
MmcSd report = new MmcSd();
|
||||
|
||||
DicConsole.WriteLine("Trying to get CID...");
|
||||
bool sense = dev.ReadCid(out byte[] cid, out _, dev.Timeout, out _);
|
||||
@@ -71,24 +59,24 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
case DeviceType.SecureDigital:
|
||||
// Clear serial number and manufacturing date
|
||||
cid[9] = 0;
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
report.SecureDigital.CID = cid;
|
||||
cid[9] = 0;
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
break;
|
||||
case DeviceType.MMC:
|
||||
// Clear serial number and manufacturing date
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
report.MultiMediaCard.CID = cid;
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
report.CID = cid;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read CID...");
|
||||
|
||||
@@ -98,40 +86,45 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
if(!sense)
|
||||
{
|
||||
DicConsole.WriteLine("CSD obtained correctly...");
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
report.MultiMediaCard.CSD = csd;
|
||||
break;
|
||||
case DeviceType.SecureDigital:
|
||||
report.SecureDigital.CSD = csd;
|
||||
break;
|
||||
}
|
||||
report.CSD = csd;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read CSD...");
|
||||
|
||||
sense = true;
|
||||
byte[] ocr = null;
|
||||
DicConsole.WriteLine("Trying to get OCR...");
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
{
|
||||
sense = dev.ReadOcr(out ocr, out _, dev.Timeout, out _);
|
||||
break;
|
||||
}
|
||||
case DeviceType.SecureDigital:
|
||||
{
|
||||
sense = dev.ReadSdocr(out ocr, out _, dev.Timeout, out _);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
DicConsole.WriteLine("OCR obtained correctly...");
|
||||
report.OCR = ocr;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read OCR...");
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
{
|
||||
DicConsole.WriteLine("Trying to get OCR...");
|
||||
sense = dev.ReadOcr(out byte[] ocr, out _, dev.Timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
DicConsole.WriteLine("OCR obtained correctly...");
|
||||
report.MultiMediaCard.OCR = ocr;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read OCR...");
|
||||
|
||||
DicConsole.WriteLine("Trying to get Extended CSD...");
|
||||
sense = dev.ReadExtendedCsd(out byte[] ecsd, out _, dev.Timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
DicConsole.WriteLine("Extended CSD obtained correctly...");
|
||||
report.MultiMediaCard.ExtendedCSD = ecsd;
|
||||
report.ExtendedCSD = ecsd;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read Extended CSD...");
|
||||
|
||||
@@ -139,29 +132,21 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
}
|
||||
case DeviceType.SecureDigital:
|
||||
{
|
||||
DicConsole.WriteLine("Trying to get OCR...");
|
||||
sense = dev.ReadSdocr(out byte[] ocr, out _, dev.Timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
DicConsole.WriteLine("OCR obtained correctly...");
|
||||
report.SecureDigital.OCR = ocr;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read OCR...");
|
||||
|
||||
DicConsole.WriteLine("Trying to get SCR...");
|
||||
sense = dev.ReadScr(out byte[] scr, out _, dev.Timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
DicConsole.WriteLine("SCR obtained correctly...");
|
||||
report.SecureDigital.SCR = scr;
|
||||
report.SCR = scr;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read SCR...");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return report;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user