mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Added PCMCIA support.
This commit is contained in:
@@ -40,6 +40,7 @@ using System.IO;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.PartPlugins;
|
||||
using DiscImageChef.Filters;
|
||||
using DiscImageChef.Decoders.PCMCIA;
|
||||
|
||||
namespace DiscImageChef.Commands
|
||||
{
|
||||
@@ -687,10 +688,42 @@ namespace DiscImageChef.Commands
|
||||
sidecar.BlockMedia[0].ATA.Identify.Size = _imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY).Length;
|
||||
break;
|
||||
case MediaTagType.PCMCIA_CIS:
|
||||
byte[] cis = _imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS);
|
||||
sidecar.BlockMedia[0].PCMCIA = new PCMCIAType();
|
||||
sidecar.BlockMedia[0].PCMCIA.CIS = new DumpType();
|
||||
sidecar.BlockMedia[0].PCMCIA.CIS.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS)).ToArray();
|
||||
sidecar.BlockMedia[0].PCMCIA.CIS.Size = _imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS).Length;
|
||||
sidecar.BlockMedia[0].PCMCIA.CIS.Checksums = Core.Checksum.GetChecksums(cis).ToArray();
|
||||
sidecar.BlockMedia[0].PCMCIA.CIS.Size = cis.Length;
|
||||
Decoders.PCMCIA.Tuple[] tuples = CIS.GetTuples(cis);
|
||||
if(tuples != null)
|
||||
{
|
||||
foreach(Decoders.PCMCIA.Tuple tuple in tuples)
|
||||
{
|
||||
if(tuple.Code == TupleCodes.CISTPL_MANFID)
|
||||
{
|
||||
ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple);
|
||||
|
||||
if(manfid != null)
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
sidecar.BlockMedia[0].PCMCIA.CardCode = manfid.CardID;
|
||||
sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true;
|
||||
sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(tuple.Code == TupleCodes.CISTPL_VERS_1)
|
||||
{
|
||||
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
|
||||
|
||||
if(vers != null)
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product;
|
||||
sidecar.BlockMedia[0].PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion);
|
||||
sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = vers.AdditionalInformation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MediaTagType.SCSI_INQUIRY:
|
||||
sidecar.BlockMedia[0].SCSI = new SCSIType();
|
||||
|
||||
@@ -94,6 +94,76 @@ namespace DiscImageChef.Commands
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(dev.IsPCMCIA)
|
||||
{
|
||||
DicConsole.WriteLine("PCMCIA device");
|
||||
DicConsole.WriteLine("PCMCIA CIS is {0} bytes", dev.CIS.Length);
|
||||
Decoders.PCMCIA.Tuple[] tuples = Decoders.PCMCIA.CIS.GetTuples(dev.CIS);
|
||||
if(tuples != null)
|
||||
{
|
||||
foreach(Decoders.PCMCIA.Tuple tuple in tuples)
|
||||
{
|
||||
switch(tuple.Code)
|
||||
{
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_NULL:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_END:
|
||||
break;
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO_A:
|
||||
DicConsole.WriteLine("{0}", Decoders.PCMCIA.CIS.PrettifyDeviceGeometryTuple(tuple));
|
||||
break;
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_MANFID:
|
||||
DicConsole.WriteLine("{0}", Decoders.PCMCIA.CIS.PrettifyManufacturerIdentificationTuple(tuple));
|
||||
break;
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_1:
|
||||
DicConsole.WriteLine("{0}", Decoders.PCMCIA.CIS.PrettifyLevel1VersionTuple(tuple));
|
||||
break;
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_ALTSTR:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_BAR:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_BATTERY:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_BYTEORDER:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_CFTABLE_ENTRY:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_CFTABLE_ENTRY_CB:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_CHECKSUM:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_CONFIG:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_CONFIG_CB:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_DATE:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE_A:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE_OA:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE_OC:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_EXTDEVIC:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_FORMAT:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_FORMAT_A:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_FUNCE:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_FUNCID:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_GEOMETRY:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_INDIRECT:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_JEDEC_A:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_JEDEC_C:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_LINKTARGET:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_A:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_C:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_CB:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_MFC:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_NO_LINK:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_ORG:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_PWR_MGMNT:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_SPCL:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_SWIL:
|
||||
case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_2:
|
||||
DicConsole.DebugWriteLine("Device-Info command", "Found undecoded tuple ID {0}", tuple.Code);
|
||||
break;
|
||||
default:
|
||||
DicConsole.DebugWriteLine("Device-Info command", "Found unknown tuple ID 0x{0:X2}", (byte)tuple.Code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
DicConsole.DebugWriteLine("Device-Info command", "Could not get tuples");
|
||||
}
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.ATA:
|
||||
|
||||
@@ -36,6 +36,7 @@ using DiscImageChef.Devices;
|
||||
using DiscImageChef.Metadata;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using DiscImageChef.Decoders.PCMCIA;
|
||||
|
||||
namespace DiscImageChef.Commands
|
||||
{
|
||||
@@ -174,6 +175,44 @@ namespace DiscImageChef.Commands
|
||||
}
|
||||
}
|
||||
|
||||
if(dev.IsPCMCIA)
|
||||
{
|
||||
report.PCMCIA = new pcmciaType();
|
||||
report.PCMCIA.CIS = dev.CIS;
|
||||
Decoders.PCMCIA.Tuple[] tuples = CIS.GetTuples(dev.CIS);
|
||||
if(tuples != null)
|
||||
{
|
||||
foreach(Decoders.PCMCIA.Tuple tuple in tuples)
|
||||
{
|
||||
if(tuple.Code == TupleCodes.CISTPL_MANFID)
|
||||
{
|
||||
ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple);
|
||||
|
||||
if(manfid != null)
|
||||
{
|
||||
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
report.PCMCIA.CardCode = manfid.CardID;
|
||||
report.PCMCIA.ManufacturerCodeSpecified = true;
|
||||
report.PCMCIA.CardCodeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(tuple.Code == TupleCodes.CISTPL_VERS_1)
|
||||
{
|
||||
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
|
||||
|
||||
if(vers != null)
|
||||
{
|
||||
report.PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
report.PCMCIA.ProductName = vers.Product;
|
||||
report.PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion);
|
||||
report.PCMCIA.AdditionalInformation = vers.AdditionalInformation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying ATA IDENTIFY...");
|
||||
|
||||
dev.AtaIdentify(out buffer, out errorRegs, timeout, out duration);
|
||||
|
||||
@@ -35,6 +35,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.PCMCIA;
|
||||
using DiscImageChef.Devices;
|
||||
using DiscImageChef.Filesystems;
|
||||
using DiscImageChef.Filters;
|
||||
@@ -162,6 +163,47 @@ namespace DiscImageChef.Commands
|
||||
writeToFile(sidecar.BlockMedia[0].USB.Descriptors.Image, dev.USBDescriptors);
|
||||
}
|
||||
|
||||
if(dev.IsPCMCIA)
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA = new PCMCIAType();
|
||||
sidecar.BlockMedia[0].PCMCIA.CIS = new DumpType();
|
||||
sidecar.BlockMedia[0].PCMCIA.CIS.Image = options.OutputPrefix + ".cis.bin";
|
||||
sidecar.BlockMedia[0].PCMCIA.CIS.Size = dev.CIS.Length;
|
||||
sidecar.BlockMedia[0].PCMCIA.CIS.Checksums = Core.Checksum.GetChecksums(dev.CIS).ToArray();
|
||||
writeToFile(sidecar.BlockMedia[0].PCMCIA.CIS.Image, dev.CIS);
|
||||
Decoders.PCMCIA.Tuple[] tuples = CIS.GetTuples(dev.CIS);
|
||||
if(tuples != null)
|
||||
{
|
||||
foreach(Decoders.PCMCIA.Tuple tuple in tuples)
|
||||
{
|
||||
if(tuple.Code == TupleCodes.CISTPL_MANFID)
|
||||
{
|
||||
ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple);
|
||||
|
||||
if(manfid != null)
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
sidecar.BlockMedia[0].PCMCIA.CardCode = manfid.CardID;
|
||||
sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true;
|
||||
sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(tuple.Code == TupleCodes.CISTPL_VERS_1)
|
||||
{
|
||||
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
|
||||
|
||||
if(vers != null)
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product;
|
||||
sidecar.BlockMedia[0].PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion);
|
||||
sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = vers.AdditionalInformation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].ATA = new ATAType();
|
||||
sidecar.BlockMedia[0].ATA.Identify = new DumpType();
|
||||
sidecar.BlockMedia[0].ATA.Identify.Image = options.OutputPrefix + ".identify.bin";
|
||||
@@ -863,7 +905,12 @@ namespace DiscImageChef.Commands
|
||||
|
||||
sidecar.BlockMedia[0].Checksums = dataChk.End().ToArray();
|
||||
string xmlDskTyp, xmlDskSubTyp;
|
||||
Metadata.MediaType.MediaTypeToString(MediaType.GENERIC_HDD, out xmlDskTyp, out xmlDskSubTyp);
|
||||
if(dev.IsCompactFlash)
|
||||
Metadata.MediaType.MediaTypeToString(MediaType.CompactFlash, out xmlDskTyp, out xmlDskSubTyp);
|
||||
else if(dev.IsPCMCIA)
|
||||
Metadata.MediaType.MediaTypeToString(MediaType.PCCardTypeI, out xmlDskTyp, out xmlDskSubTyp);
|
||||
else
|
||||
Metadata.MediaType.MediaTypeToString(MediaType.GENERIC_HDD, out xmlDskTyp, out xmlDskSubTyp);
|
||||
sidecar.BlockMedia[0].DiskType = xmlDskTyp;
|
||||
sidecar.BlockMedia[0].DiskSubType = xmlDskSubTyp;
|
||||
// TODO: Implement device firmware revision
|
||||
|
||||
Reference in New Issue
Block a user