mirror of
https://github.com/aaru-dps/Aaru.CommonTypes.git
synced 2025-12-16 19:24:30 +00:00
Move to file scoped namespaces.
This commit is contained in:
@@ -34,40 +34,39 @@
|
||||
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
public static partial class MediaTypeFromDevice
|
||||
/// <summary>Gets the media type from an ATA (not ATAPI) device</summary>
|
||||
/// <param name="manufacturer">Manufacturer string</param>
|
||||
/// <param name="model">Model string</param>
|
||||
/// <param name="removable">Is the device removable?</param>
|
||||
/// <param name="compactFlash">Does the device self-identify as CompactFlash?</param>
|
||||
/// <param name="pcmcia">Is the device attached thru PCMCIA or CardBus?</param>
|
||||
/// <param name="blocks">Number of blocks in device</param>
|
||||
/// <returns>The media type</returns>
|
||||
public static MediaType GetFromAta(string manufacturer, string model, bool removable, bool compactFlash,
|
||||
bool pcmcia, ulong blocks)
|
||||
{
|
||||
/// <summary>Gets the media type from an ATA (not ATAPI) device</summary>
|
||||
/// <param name="manufacturer">Manufacturer string</param>
|
||||
/// <param name="model">Model string</param>
|
||||
/// <param name="removable">Is the device removable?</param>
|
||||
/// <param name="compactFlash">Does the device self-identify as CompactFlash?</param>
|
||||
/// <param name="pcmcia">Is the device attached thru PCMCIA or CardBus?</param>
|
||||
/// <param name="blocks">Number of blocks in device</param>
|
||||
/// <returns>The media type</returns>
|
||||
public static MediaType GetFromAta(string manufacturer, string model, bool removable, bool compactFlash,
|
||||
bool pcmcia, ulong blocks)
|
||||
if(!removable)
|
||||
{
|
||||
if(!removable)
|
||||
{
|
||||
if(compactFlash)
|
||||
return MediaType.CompactFlash;
|
||||
if(compactFlash)
|
||||
return MediaType.CompactFlash;
|
||||
|
||||
return pcmcia ? MediaType.PCCardTypeI : MediaType.GENERIC_HDD;
|
||||
}
|
||||
|
||||
if(manufacturer.ToLowerInvariant() == "syquest" &&
|
||||
model.ToLowerInvariant() == "sparq" &&
|
||||
blocks == 1961069)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"Drive manufacturer is SyQuest, media has 1961069 blocks of 512 bytes, setting media type to SparQ.");
|
||||
|
||||
return MediaType.SparQ;
|
||||
}
|
||||
|
||||
return MediaType.Unknown;
|
||||
return pcmcia ? MediaType.PCCardTypeI : MediaType.GENERIC_HDD;
|
||||
}
|
||||
|
||||
if(manufacturer.ToLowerInvariant() == "syquest" &&
|
||||
model.ToLowerInvariant() == "sparq" &&
|
||||
blocks == 1961069)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"Drive manufacturer is SyQuest, media has 1961069 blocks of 512 bytes, setting media type to SparQ.");
|
||||
|
||||
return MediaType.SparQ;
|
||||
}
|
||||
|
||||
return MediaType.Unknown;
|
||||
}
|
||||
}
|
||||
@@ -35,145 +35,144 @@
|
||||
using System;
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
/// <summary>Gets the media type from a real device</summary>
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>Gets the media type from a real device</summary>
|
||||
public static partial class MediaTypeFromDevice
|
||||
/// <summary>Gets the media type from an SCSI MultiMedia Commands compliant device</summary>
|
||||
/// <param name="model">Model string</param>
|
||||
/// <param name="mediumType">Medium type from MODE SENSE</param>
|
||||
/// <param name="densityCode">Density code from MODE SENSE</param>
|
||||
/// <param name="blocks">Number of blocks in media</param>
|
||||
/// <param name="blockSize">Size of a block in bytes</param>
|
||||
/// <param name="isUsb">Is the device USB attached</param>
|
||||
/// <param name="opticalDisc">Is the media an optical disc</param>
|
||||
/// <returns>Media type</returns>
|
||||
static MediaType GetFromMmc(string model, byte mediumType, byte densityCode, ulong blocks, uint blockSize,
|
||||
bool isUsb, bool opticalDisc)
|
||||
{
|
||||
/// <summary>Gets the media type from an SCSI MultiMedia Commands compliant device</summary>
|
||||
/// <param name="model">Model string</param>
|
||||
/// <param name="mediumType">Medium type from MODE SENSE</param>
|
||||
/// <param name="densityCode">Density code from MODE SENSE</param>
|
||||
/// <param name="blocks">Number of blocks in media</param>
|
||||
/// <param name="blockSize">Size of a block in bytes</param>
|
||||
/// <param name="isUsb">Is the device USB attached</param>
|
||||
/// <param name="opticalDisc">Is the media an optical disc</param>
|
||||
/// <returns>Media type</returns>
|
||||
static MediaType GetFromMmc(string model, byte mediumType, byte densityCode, ulong blocks, uint blockSize,
|
||||
bool isUsb, bool opticalDisc)
|
||||
switch(mediumType)
|
||||
{
|
||||
switch(mediumType)
|
||||
{
|
||||
case 0x00:
|
||||
if(blockSize == 512)
|
||||
if(blocks == 1281856)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.",
|
||||
mediumType, blocks, blockSize);
|
||||
case 0x00:
|
||||
if(blockSize == 512)
|
||||
if(blocks == 1281856)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.PD650_WORM;
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.PD650;
|
||||
}
|
||||
return MediaType.PD650_WORM;
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to Compact Disc.",
|
||||
mediumType);
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.CD;
|
||||
return MediaType.PD650;
|
||||
}
|
||||
case 0x01:
|
||||
case 0x05:
|
||||
else
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD-ROM.",
|
||||
"SCSI medium type is {0:X2}h, setting media type to Compact Disc.",
|
||||
mediumType);
|
||||
|
||||
return MediaType.CDROM;
|
||||
case 0x02:
|
||||
case 0x06:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to Compact Disc Digital Audio.",
|
||||
mediumType);
|
||||
return MediaType.CD;
|
||||
}
|
||||
case 0x01:
|
||||
case 0x05:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD-ROM.",
|
||||
mediumType);
|
||||
|
||||
return MediaType.CDDA;
|
||||
case 0x03:
|
||||
case 0x07:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD+.", mediumType);
|
||||
return MediaType.CDROM;
|
||||
case 0x02:
|
||||
case 0x06:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to Compact Disc Digital Audio.",
|
||||
mediumType);
|
||||
|
||||
return MediaType.CDPLUS;
|
||||
case 0x04:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to Photo CD.",
|
||||
mediumType);
|
||||
return MediaType.CDDA;
|
||||
case 0x03:
|
||||
case 0x07:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD+.", mediumType);
|
||||
|
||||
return MediaType.PCD;
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
case 0x12:
|
||||
case 0x13:
|
||||
case 0x14:
|
||||
case 0x15:
|
||||
case 0x16:
|
||||
case 0x17:
|
||||
case 0x18:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD-R.", mediumType);
|
||||
return MediaType.CDPLUS;
|
||||
case 0x04:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to Photo CD.",
|
||||
mediumType);
|
||||
|
||||
return MediaType.CDR;
|
||||
case 0x20:
|
||||
case 0x21:
|
||||
case 0x22:
|
||||
case 0x23:
|
||||
case 0x24:
|
||||
case 0x25:
|
||||
case 0x26:
|
||||
case 0x27:
|
||||
case 0x28:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD-RW.", mediumType);
|
||||
return MediaType.PCD;
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
case 0x12:
|
||||
case 0x13:
|
||||
case 0x14:
|
||||
case 0x15:
|
||||
case 0x16:
|
||||
case 0x17:
|
||||
case 0x18:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD-R.", mediumType);
|
||||
|
||||
return MediaType.CDRW;
|
||||
case 0x40 when isUsb && !opticalDisc:
|
||||
case 0x41 when isUsb && !opticalDisc:
|
||||
case 0x42 when isUsb && !opticalDisc:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h and device is USB, setting media type to Flash Drive.",
|
||||
mediumType);
|
||||
return MediaType.CDR;
|
||||
case 0x20:
|
||||
case 0x21:
|
||||
case 0x22:
|
||||
case 0x23:
|
||||
case 0x24:
|
||||
case 0x25:
|
||||
case 0x26:
|
||||
case 0x27:
|
||||
case 0x28:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD-RW.", mediumType);
|
||||
|
||||
return MediaType.FlashDrive;
|
||||
case 0x80:
|
||||
if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal))
|
||||
switch(densityCode)
|
||||
{
|
||||
case 0x42:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.",
|
||||
mediumType, densityCode);
|
||||
return MediaType.CDRW;
|
||||
case 0x40 when isUsb && !opticalDisc:
|
||||
case 0x41 when isUsb && !opticalDisc:
|
||||
case 0x42 when isUsb && !opticalDisc:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h and device is USB, setting media type to Flash Drive.",
|
||||
mediumType);
|
||||
|
||||
return MediaType.LTO2;
|
||||
case 0x44:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.",
|
||||
mediumType, densityCode);
|
||||
return MediaType.FlashDrive;
|
||||
case 0x80:
|
||||
if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal))
|
||||
switch(densityCode)
|
||||
{
|
||||
case 0x42:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.",
|
||||
mediumType, densityCode);
|
||||
|
||||
return MediaType.LTO3;
|
||||
case 0x46:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.",
|
||||
mediumType, densityCode);
|
||||
return MediaType.LTO2;
|
||||
case 0x44:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.",
|
||||
mediumType, densityCode);
|
||||
|
||||
return MediaType.LTO4;
|
||||
case 0x58:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.",
|
||||
mediumType, densityCode);
|
||||
return MediaType.LTO3;
|
||||
case 0x46:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.",
|
||||
mediumType, densityCode);
|
||||
|
||||
return MediaType.LTO5;
|
||||
}
|
||||
return MediaType.LTO4;
|
||||
case 0x58:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.",
|
||||
mediumType, densityCode);
|
||||
|
||||
break;
|
||||
}
|
||||
return MediaType.LTO5;
|
||||
}
|
||||
|
||||
return MediaType.Unknown;
|
||||
break;
|
||||
}
|
||||
|
||||
return MediaType.Unknown;
|
||||
}
|
||||
}
|
||||
@@ -34,309 +34,308 @@
|
||||
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
public static partial class MediaTypeFromDevice
|
||||
/// <summary>Gets the device type from a SCSI Optical Device</summary>
|
||||
/// <param name="mediumType">Medium type from MODE SENSE</param>
|
||||
/// <param name="blocks">Number of blocks in device</param>
|
||||
/// <param name="blockSize">Size in bytes of a block</param>
|
||||
/// <returns>Media type</returns>
|
||||
static MediaType GetFromOdc(byte mediumType, ulong blocks, uint blockSize)
|
||||
{
|
||||
/// <summary>Gets the device type from a SCSI Optical Device</summary>
|
||||
/// <param name="mediumType">Medium type from MODE SENSE</param>
|
||||
/// <param name="blocks">Number of blocks in device</param>
|
||||
/// <param name="blockSize">Size in bytes of a block</param>
|
||||
/// <returns>Media type</returns>
|
||||
static MediaType GetFromOdc(byte mediumType, ulong blocks, uint blockSize)
|
||||
if(mediumType != 0x01 &&
|
||||
mediumType != 0x02 &&
|
||||
mediumType != 0x03 &&
|
||||
mediumType != 0x05 &&
|
||||
mediumType != 0x07)
|
||||
{
|
||||
if(mediumType != 0x01 &&
|
||||
mediumType != 0x02 &&
|
||||
mediumType != 0x03 &&
|
||||
mediumType != 0x05 &&
|
||||
mediumType != 0x07)
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to unknown magneto-optical.",
|
||||
mediumType);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
|
||||
switch(blockSize)
|
||||
{
|
||||
case 512:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 248826:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-154 / ISO 10090 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_154;
|
||||
case 429975:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" embossed magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_201_ROM;
|
||||
case 446325:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_201;
|
||||
case 694929:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_223_512;
|
||||
case 904995:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-183 / ISO 13481 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_183_512;
|
||||
case 1041500:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15041 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_15041_512;
|
||||
case 1128772:
|
||||
case 1163337:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_184_512;
|
||||
case 1281856:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.PD650_WORM;
|
||||
case 1298496:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.PD650;
|
||||
case 1644581:
|
||||
case 1647371:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_195_512;
|
||||
case 2244958:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_14517_512;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
case 1024:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 314569:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 10089 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_10089;
|
||||
case 371371:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_223;
|
||||
case 498526:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_183;
|
||||
case 603466:
|
||||
case 637041:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_184;
|
||||
case 936921:
|
||||
case 948770:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_195;
|
||||
case 1244621:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-238 / ISO 15486 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_238;
|
||||
case 1273011:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_14517;
|
||||
case 2319786:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_15286_1024;
|
||||
case 4383356:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_322_1k;
|
||||
case 14476734:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_260;
|
||||
case 24445990:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_260_Double;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
case 2048:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 310352: // Found in real media
|
||||
case 318988:
|
||||
case 320332:
|
||||
case 321100:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-239 / ISO 15498 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_239;
|
||||
case 605846:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.GigaMo;
|
||||
case 1063146:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 2 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.GigaMo2;
|
||||
case 1128134:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-280 / ISO 18093 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_280;
|
||||
case 1263472:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_15286;
|
||||
case 2043664:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_322_2k;
|
||||
case 7355716:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-317 / ISO 20162 conforming 300mm magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_317;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
case 4096:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 1095840:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_322;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
case 8192:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 1834348:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UDO;
|
||||
case 3668759:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM UDO2.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UDO2_WORM;
|
||||
case 3669724:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO2.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UDO2;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to unknown magneto-optical.",
|
||||
mediumType);
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
|
||||
switch(blockSize)
|
||||
{
|
||||
case 512:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 248826:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-154 / ISO 10090 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_154;
|
||||
case 429975:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" embossed magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_201_ROM;
|
||||
case 446325:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_201;
|
||||
case 694929:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_223_512;
|
||||
case 904995:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-183 / ISO 13481 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_183_512;
|
||||
case 1041500:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15041 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_15041_512;
|
||||
case 1128772:
|
||||
case 1163337:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_184_512;
|
||||
case 1281856:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.PD650_WORM;
|
||||
case 1298496:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.PD650;
|
||||
case 1644581:
|
||||
case 1647371:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_195_512;
|
||||
case 2244958:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_14517_512;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
case 1024:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 314569:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 10089 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_10089;
|
||||
case 371371:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_223;
|
||||
case 498526:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_183;
|
||||
case 603466:
|
||||
case 637041:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_184;
|
||||
case 936921:
|
||||
case 948770:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_195;
|
||||
case 1244621:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-238 / ISO 15486 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_238;
|
||||
case 1273011:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_14517;
|
||||
case 2319786:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_15286_1024;
|
||||
case 4383356:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_322_1k;
|
||||
case 14476734:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_260;
|
||||
case 24445990:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_260_Double;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
case 2048:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 310352: // Found in real media
|
||||
case 318988:
|
||||
case 320332:
|
||||
case 321100:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-239 / ISO 15498 conforming 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_239;
|
||||
case 605846:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.GigaMo;
|
||||
case 1063146:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 2 3½\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.GigaMo2;
|
||||
case 1128134:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-280 / ISO 18093 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_280;
|
||||
case 1263472:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ISO_15286;
|
||||
case 2043664:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_322_2k;
|
||||
case 7355716:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-317 / ISO 20162 conforming 300mm magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_317;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
case 4096:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 1095840:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.ECMA_322;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
case 8192:
|
||||
{
|
||||
switch(blocks)
|
||||
{
|
||||
case 1834348:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UDO;
|
||||
case 3668759:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM UDO2.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UDO2_WORM;
|
||||
case 3669724:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO2.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UDO2;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.",
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,100 +35,99 @@
|
||||
using System;
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
public static partial class MediaTypeFromDevice
|
||||
/// <summary>Tries to guess, from SCSI information, the media type of a device and/or its inserted media</summary>
|
||||
/// <param name="scsiPeripheralType">The SCSI Peripheral Type as indicated in the INQUIRY response</param>
|
||||
/// <param name="vendor">The vendor string of the device</param>
|
||||
/// <param name="model">The model string of the device</param>
|
||||
/// <param name="mediumType">The medium type byte from MODE SENSE</param>
|
||||
/// <param name="densityCode">The density type byte from MODE SENSE</param>
|
||||
/// <param name="blocks">How many blocks are on the media</param>
|
||||
/// <param name="blockSize">Size in bytes of each block</param>
|
||||
/// <param name="isUsb">Device is USB</param>
|
||||
/// <param name="opticalDisc">Is media an optical disc?</param>
|
||||
/// <returns>The media type</returns>
|
||||
public static MediaType GetFromScsi(byte scsiPeripheralType, string vendor, string model, byte mediumType,
|
||||
byte densityCode, ulong blocks, uint blockSize, bool isUsb,
|
||||
bool opticalDisc)
|
||||
{
|
||||
/// <summary>Tries to guess, from SCSI information, the media type of a device and/or its inserted media</summary>
|
||||
/// <param name="scsiPeripheralType">The SCSI Peripheral Type as indicated in the INQUIRY response</param>
|
||||
/// <param name="vendor">The vendor string of the device</param>
|
||||
/// <param name="model">The model string of the device</param>
|
||||
/// <param name="mediumType">The medium type byte from MODE SENSE</param>
|
||||
/// <param name="densityCode">The density type byte from MODE SENSE</param>
|
||||
/// <param name="blocks">How many blocks are on the media</param>
|
||||
/// <param name="blockSize">Size in bytes of each block</param>
|
||||
/// <param name="isUsb">Device is USB</param>
|
||||
/// <param name="opticalDisc">Is media an optical disc?</param>
|
||||
/// <returns>The media type</returns>
|
||||
public static MediaType GetFromScsi(byte scsiPeripheralType, string vendor, string model, byte mediumType,
|
||||
byte densityCode, ulong blocks, uint blockSize, bool isUsb,
|
||||
bool opticalDisc)
|
||||
switch(scsiPeripheralType)
|
||||
{
|
||||
switch(scsiPeripheralType)
|
||||
{
|
||||
// Direct access device
|
||||
case 0x00:
|
||||
// Simplified access device
|
||||
case 0x0E:
|
||||
if(mediumType == 0x03 ||
|
||||
mediumType == 0x05 ||
|
||||
mediumType == 0x07)
|
||||
goto case 0x07;
|
||||
// Direct access device
|
||||
case 0x00:
|
||||
// Simplified access device
|
||||
case 0x0E:
|
||||
if(mediumType == 0x03 ||
|
||||
mediumType == 0x05 ||
|
||||
mediumType == 0x07)
|
||||
goto case 0x07;
|
||||
|
||||
return GetFromSbc(vendor, model, mediumType, blocks, blockSize);
|
||||
return GetFromSbc(vendor, model, mediumType, blocks, blockSize);
|
||||
|
||||
// Sequential access device
|
||||
case 0x01:
|
||||
return GetFromSsc(scsiPeripheralType, vendor, model, mediumType, densityCode, blocks, blockSize);
|
||||
// Sequential access device
|
||||
case 0x01:
|
||||
return GetFromSsc(scsiPeripheralType, vendor, model, mediumType, densityCode, blocks, blockSize);
|
||||
|
||||
// Write-once device
|
||||
case 0x04:
|
||||
// Optical device
|
||||
case 0x07: return GetFromOdc(mediumType, blocks, blockSize);
|
||||
// Write-once device
|
||||
case 0x04:
|
||||
// Optical device
|
||||
case 0x07: return GetFromOdc(mediumType, blocks, blockSize);
|
||||
|
||||
// MultiMedia Device
|
||||
case 0x05: return GetFromMmc(model, mediumType, densityCode, blocks, blockSize, isUsb, opticalDisc);
|
||||
// MultiMedia Device
|
||||
case 0x05: return GetFromMmc(model, mediumType, densityCode, blocks, blockSize, isUsb, opticalDisc);
|
||||
|
||||
// MD DATA drives
|
||||
case 0x10 when model.StartsWith("MDM", StringComparison.Ordinal) ||
|
||||
model.StartsWith("MDH", StringComparison.Ordinal):
|
||||
if(blockSize == 2048)
|
||||
{
|
||||
// MD DATA drives
|
||||
case 0x10 when model.StartsWith("MDM", StringComparison.Ordinal) ||
|
||||
model.StartsWith("MDH", StringComparison.Ordinal):
|
||||
if(blockSize == 2048)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to MiniDisc for Data.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
|
||||
return MediaType.MDData;
|
||||
}
|
||||
|
||||
switch(blocks)
|
||||
{
|
||||
case 57312:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to MiniDisc for Data.",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
|
||||
return MediaType.MDData;
|
||||
}
|
||||
return MediaType.MD60;
|
||||
case 70464:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 74 minute MiniDisc.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
|
||||
switch(blocks)
|
||||
{
|
||||
case 57312:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
return MediaType.MD74;
|
||||
case 76096:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 80 minute MiniDisc.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
|
||||
return MediaType.MD60;
|
||||
case 70464:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 74 minute MiniDisc.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
return MediaType.MD80;
|
||||
}
|
||||
|
||||
return MediaType.MD74;
|
||||
case 76096:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 80 minute MiniDisc.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
|
||||
return MediaType.MD80;
|
||||
}
|
||||
return MediaType.MD;
|
||||
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
// Host managed zoned block device
|
||||
case 0x14:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, setting media type to host managed zoned block device.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
|
||||
return MediaType.MD;
|
||||
|
||||
// Host managed zoned block device
|
||||
case 0x14:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI peripheral type is {0:X2}h, setting media type to host managed zoned block device.",
|
||||
scsiPeripheralType, blocks, blockSize);
|
||||
|
||||
return MediaType.Zone_HDD;
|
||||
}
|
||||
|
||||
return MediaType.Unknown;
|
||||
return MediaType.Zone_HDD;
|
||||
}
|
||||
|
||||
return MediaType.Unknown;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user