From 875d94716658481ab0b267b36d04fff9d33e260f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 12 Jul 2020 21:03:45 +0100 Subject: [PATCH] Show the reasons while a media type has been chosen on detection. Fixes #314. --- Aaru.CommonTypes.csproj | 7 +- MediaTypeFromDevice.cs | 1778 ------------------------------- MediaTypeFromDevice/FromAta.cs | 65 ++ MediaTypeFromDevice/FromMmc.cs | 160 +++ MediaTypeFromDevice/FromOdc.cs | 295 +++++ MediaTypeFromDevice/FromSbc.cs | 890 ++++++++++++++++ MediaTypeFromDevice/FromScsi.cs | 132 +++ MediaTypeFromDevice/FromSsc.cs | 1602 ++++++++++++++++++++++++++++ 8 files changed, 3150 insertions(+), 1779 deletions(-) delete mode 100644 MediaTypeFromDevice.cs create mode 100644 MediaTypeFromDevice/FromAta.cs create mode 100644 MediaTypeFromDevice/FromMmc.cs create mode 100644 MediaTypeFromDevice/FromOdc.cs create mode 100644 MediaTypeFromDevice/FromSbc.cs create mode 100644 MediaTypeFromDevice/FromScsi.cs create mode 100644 MediaTypeFromDevice/FromSsc.cs diff --git a/Aaru.CommonTypes.csproj b/Aaru.CommonTypes.csproj index 0241235f8..b032e721c 100644 --- a/Aaru.CommonTypes.csproj +++ b/Aaru.CommonTypes.csproj @@ -85,6 +85,12 @@ + + + + + + @@ -95,7 +101,6 @@ - diff --git a/MediaTypeFromDevice.cs b/MediaTypeFromDevice.cs deleted file mode 100644 index 7ea7a2f41..000000000 --- a/MediaTypeFromDevice.cs +++ /dev/null @@ -1,1778 +0,0 @@ -// /*************************************************************************** -// Aaru Data Preservation Suite -// ---------------------------------------------------------------------------- -// -// Filename : MediaTypeFromDevice.cs -// Author(s) : Natalia Portillo -// -// Component : Aaru common types. -// -// --[ Description ] ---------------------------------------------------------- -// -// Lookups media type from SCSI and ATA informative values. -// -// --[ License ] -------------------------------------------------------------- -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2020 Natalia Portillo -// ****************************************************************************/ - -using System; - -namespace Aaru.CommonTypes -{ - #pragma warning disable RECS0063 // Warns when a culture-aware 'StartsWith' call is used by default. - public static class MediaTypeFromDevice - { - /// Tries to guess, from SCSI information, the media type of a device and/or its inserted media - /// The SCSI Peripheral Type as indicated in the INQUIRY response - /// The vendor string of the device - /// The model string of the device - /// The medium type byte from MODE SENSE - /// The density type byte from MODE SENSE - /// How many blocks are on the media - /// Size in bytes of each block - /// - public static MediaType GetFromScsi(byte scsiPeripheralType, string vendor, string model, byte mediumType, - byte densityCode, ulong blocks, uint blockSize) - { - switch(scsiPeripheralType) - { - // Direct access device - case 0x00: - // Simpilified access device - case 0x0E: - { - if(mediumType == 0x03 || - mediumType == 0x05 || - mediumType == 0x07) - goto case 0x07; - - if(vendor.ToLowerInvariant() == "syquest") - { - if(blocks == 173400 && - blockSize == 256) - return MediaType.SQ400; - - if(blockSize != 512) - return MediaType.Unknown; - - if(model.ToLowerInvariant().StartsWith("syjet", StringComparison.Ordinal)) - return MediaType.SyJet; - - switch(blocks) - { - case 173456: return MediaType.SQ800; - case 215440: return MediaType.SQ310; - case 262144: return MediaType.EZ135; - case 390696: return MediaType.SQ2000; - case 450560: return MediaType.EZ230; - case 524288: return MediaType.SQ327; - case 1961069: return MediaType.SparQ; - } - - return MediaType.Unknown; - } - - if(vendor.ToLowerInvariant().StartsWith("iomega")) - - { - switch(blockSize) - { - case 256: - { - switch(blocks) - { - case 39168: - case 41004: return MediaType.Bernoulli10; - } - - break; - } - case 512: - { - switch(blocks) - { - case 78882: return MediaType.PocketZip; - case 175856: return MediaType.Bernoulli90; - } - - break; - } - } - } - - if(model.ToLowerInvariant().StartsWith("zip", StringComparison.Ordinal) && - blockSize == 512) - { - if(blocks == 196608) - return MediaType.ZIP100; - - return blocks == 489532 ? MediaType.ZIP250 : MediaType.ZIP750; - } - - if(model.ToLowerInvariant().StartsWith("jaz", StringComparison.Ordinal) && - blockSize == 512) - { - if(blocks == 2091050) - return MediaType.Jaz; - - return blocks == 3915600 ? MediaType.Jaz2 : MediaType.Unknown; - } - - if(model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal)) - { - if(blockSize == 512) - { - if(blocks == 469504) - return MediaType.LS240; - - if(blocks == 246528) - return MediaType.LS120; - - if(blocks == 65536) - return MediaType.FD32MB; - - if(blocks == 2880) - return MediaType.DOS_35_HD; - - if(blocks == 1440) - return MediaType.DOS_35_DS_DD_9; - } - else if(blockSize == 1024) - { - if(blocks == 1232) - return MediaType.NEC_35_HD_8; - } - - return MediaType.Unknown; - } - - if(model.ToLowerInvariant().StartsWith("rdx", StringComparison.Ordinal) && - blockSize == 512) - return blocks == 625134256 ? MediaType.RDX320 : MediaType.RDX; - - if(vendor.ToLowerInvariant().StartsWith("cws orb", StringComparison.Ordinal)) - { - switch(blocks) - { - case 4307184 when blockSize == 512: return MediaType.Orb; - default: return MediaType.Unknown; - } - } - - if(model.ToLowerInvariant().StartsWith("hifd", StringComparison.Ordinal)) - { - switch(blocks) - { - case 393380 when blockSize == 512: return MediaType.HiFD; - default: return MediaType.Unknown; - } - } - - switch(mediumType) - { - case 0x01: - switch(blockSize) - { - case 128: - switch(blocks) - { - case 720: return MediaType.ATARI_525_SD; - case 1040: return MediaType.ATARI_525_DD; - case 1898: return MediaType.IBM33FD_128; - case 2002: return MediaType.ECMA_54; - } - - break; - case 256: - switch(blocks) - { - case 322: return MediaType.ECMA_66; - case 400: return MediaType.ACORN_525_SS_SD_40; - case 455: return MediaType.Apple32SS; - case 560: return MediaType.Apple33SS; - case 640: return MediaType.ACORN_525_SS_DD_40; - case 720: return MediaType.ATARI_525_DD; - case 800: return MediaType.ACORN_525_SS_SD_80; - case 1121: return MediaType.IBM33FD_256; - case 1280: return MediaType.ACORN_525_SS_DD_80; - case 2002: return MediaType.RX02; - } - - break; - case 319: - switch(blocks) - { - case 256: return MediaType.IBM23FD; - } - - break; - case 512: - switch(blocks) - { - case 320: return MediaType.DOS_525_DS_DD_8; - case 360: return MediaType.DOS_35_SS_DD_9; - case 610: return MediaType.IBM33FD_512; - case 630: return MediaType.Apricot_35; - case 640: return MediaType.DOS_35_SS_DD_8; - case 720: return MediaType.DOS_35_DS_DD_9; - case 800: return MediaType.AppleSonySS; - case 248826: return MediaType.ECMA_154; - case 429975: return MediaType.ECMA_201_ROM; - case 446325: return MediaType.ECMA_201; - case 694929: return MediaType.ECMA_223_512; - case 904995: return MediaType.ECMA_183_512; - case 1128772: - case 1163337: return MediaType.ECMA_184_512; - case 1281856: return MediaType.PD650_WORM; - case 1298496: return MediaType.PD650; - case 1644581: - case 1647371: return MediaType.ECMA_195_512; - } - - break; - case 1024: - { - switch(blocks) - { - case 371371: return MediaType.ECMA_223; - case 498526: return MediaType.ECMA_183; - case 603466: - case 637041: return MediaType.ECMA_184; - case 936921: - case 948770: return MediaType.ECMA_195; - case 1244621: return MediaType.ECMA_238; - case 14476734: return MediaType.ECMA_260; - case 24445990: return MediaType.ECMA_260_Double; - } - } - - break; - case 2048: - { - switch(blocks) - { - case 310352: // Found in real media - case 318988: - case 320332: - case 321100: return MediaType.ECMA_239; - case 605846: return MediaType.GigaMo; - case 1063146: return MediaType.GigaMo2; - case 1128134: return MediaType.ECMA_280; - case 2043664: return MediaType.ECMA_322_2k; - case 7355716: return MediaType.ECMA_317; - } - } - - break; - case 4096: - { - switch(blocks) - { - case 1095840: return MediaType.ECMA_322; - } - } - - break; - case 8192: - { - switch(blocks) - { - case 1834348: return MediaType.UDO; - case 3668759: return MediaType.UDO2_WORM; - case 3669724: return MediaType.UDO2; - } - } - - break; - } - - return MediaType.Unknown; - case 0x02: - switch(blockSize) - { - case 128: - switch(blocks) - { - case 3848: return MediaType.IBM43FD_128; - case 4004: return MediaType.ECMA_59; - } - - break; - case 256: - switch(blocks) - { - case 910: return MediaType.Apple32DS; - case 1120: return MediaType.Apple33DS; - case 1280: return MediaType.ECMA_70; - case 2560: return MediaType.ECMA_78; - case 3848: return MediaType.IBM53FD_256; - case 4004: return MediaType.ECMA_99_26; - } - - break; - case 512: - switch(blocks) - { - case 640: return MediaType.DOS_525_DS_DD_8; - case 720: return MediaType.DOS_525_DS_DD_9; - case 1280: return MediaType.DOS_35_DS_DD_8; - case 1440: return MediaType.DOS_35_DS_DD_9; - case 1640: return MediaType.FDFORMAT_35_DD; - case 1760: return MediaType.CBM_AMIGA_35_DD; - case 2242: return MediaType.IBM53FD_512; - case 2332: return MediaType.ECMA_99_15; - case 2400: return MediaType.DOS_525_HD; - case 2788: return MediaType.FDFORMAT_525_HD; - case 2880: return MediaType.DOS_35_HD; - case 3360: return MediaType.DMF; - case 3444: return MediaType.FDFORMAT_35_HD; - case 3520: return MediaType.CBM_AMIGA_35_HD; - case 5760: return MediaType.DOS_35_ED; - case 248826: return MediaType.ECMA_154; - case 429975: return MediaType.ECMA_201_ROM; - case 446325: return MediaType.ECMA_201; - case 694929: return MediaType.ECMA_223_512; - case 904995: return MediaType.ECMA_183_512; - case 1128772: - case 1163337: return MediaType.ECMA_184_512; - case 1281856: return MediaType.PD650_WORM; - case 1298496: return MediaType.PD650; - case 1644581: - case 1647371: return MediaType.ECMA_195_512; - } - - break; - case 1024: - switch(blocks) - { - case 800: return MediaType.ACORN_35_DS_DD; - case 1600: return MediaType.ACORN_35_DS_HD; - case 1220: return MediaType.IBM53FD_1024; - case 1232: return MediaType.SHARP_35; - case 1268: return MediaType.ECMA_69_8; - case 1280: return MediaType.NEC_525_HD; - case 1316: return MediaType.ECMA_99_8; - case 371371: return MediaType.ECMA_223; - case 498526: return MediaType.ECMA_183; - case 603466: - case 637041: return MediaType.ECMA_184; - case 936921: - case 948770: return MediaType.ECMA_195; - case 1244621: return MediaType.ECMA_238; - case 14476734: return MediaType.ECMA_260; - case 24445990: return MediaType.ECMA_260_Double; - } - - break; - case 2048: - { - switch(blocks) - { - case 310352: // Found in real media - case 318988: - case 320332: - case 321100: return MediaType.ECMA_239; - case 605846: return MediaType.GigaMo; - case 1063146: return MediaType.GigaMo2; - case 1128134: return MediaType.ECMA_280; - case 2043664: return MediaType.ECMA_322_2k; - case 7355716: return MediaType.ECMA_317; - } - } - - break; - case 4096: - { - switch(blocks) - { - case 1095840: return MediaType.ECMA_322; - } - } - - break; - case 8192: - { - switch(blocks) - { - case 1834348: return MediaType.UDO; - case 3668759: return MediaType.UDO2_WORM; - case 3669724: return MediaType.UDO2; - } - } - - break; - } - - return MediaType.Unknown; - case 0x09: return MediaType.ECMA_54; - case 0x0A: return MediaType.ECMA_59; - case 0x0B: - switch(blockSize) - { - case 256: return MediaType.ECMA_69_26; - case 512: return MediaType.ECMA_69_15; - case 1024: return MediaType.ECMA_69_8; - } - - return MediaType.Unknown; - case 0x0E: return MediaType.ECMA_66; - case 0x12: return MediaType.ECMA_70; - case 0x16: - switch(blockSize) - { - case 256: return MediaType.ECMA_78; - case 512: return MediaType.ECMA_78_2; - } - - return MediaType.Unknown; - case 0x1A: - switch(blockSize) - { - case 256: return MediaType.ECMA_99_26; - case 512: return MediaType.ECMA_99_15; - case 1024: return MediaType.ECMA_99_8; - } - - return MediaType.Unknown; - case 0x20 when blockSize == 512 && blocks == 40662: return MediaType.Floptical; - case 0x1E: return MediaType.DOS_35_DS_DD_9; - case 0x41: - switch(blocks) - { - case 58620544: return MediaType.REV120; - case 34185728: return MediaType.REV70; - case 17090880: return MediaType.REV35; - } - - break; - case 0x44: - switch(blocks) - { - case 494023 when blockSize == 2048: return MediaType.HiMD; - } - - break; - case 0x93: return MediaType.NEC_35_HD_15; - case 0x94: return MediaType.DOS_35_HD; - } - - switch(blockSize) - { - case 128: - { - switch(blocks) - { - case 720: return MediaType.ATARI_525_SD; - case 1040: return MediaType.ATARI_525_ED; - case 1898: return MediaType.IBM33FD_128; - case 2002: return MediaType.ECMA_54; - case 3848: return MediaType.IBM43FD_128; - case 4004: return MediaType.ECMA_59; - } - } - - break; - case 256: - { - switch(blocks) - { - case 322: return MediaType.ECMA_66; - case 400: return MediaType.ACORN_525_SS_SD_40; - case 455: return MediaType.Apple32SS; - case 560: return MediaType.Apple33SS; - case 640: return MediaType.ACORN_525_SS_DD_40; - case 720: return MediaType.ATARI_525_DD; - case 800: return MediaType.ACORN_525_SS_SD_80; - case 910: return MediaType.Apple32DS; - case 1120: return MediaType.Apple33DS; - case 1121: return MediaType.IBM33FD_256; - case 1280: return MediaType.ECMA_70; - case 2002: return MediaType.RX02; - case 2560: return MediaType.ECMA_78; - case 3848: return MediaType.IBM53FD_256; - case 4004: return MediaType.ECMA_99_26; - } - } - - break; - case 319: - switch(blocks) - { - case 256: return MediaType.IBM23FD; - } - - break; - case 512: - { - switch(blocks) - { - case 320: return MediaType.DOS_525_SS_DD_8; - case 360: return MediaType.DOS_525_SS_DD_9; - case 610: return MediaType.IBM33FD_512; - case 640: return MediaType.DOS_525_DS_DD_8; - case 720: return MediaType.DOS_525_DS_DD_9; - case 800: return MediaType.AppleSonySS; - case 1280: return MediaType.DOS_35_DS_DD_8; - case 1440: return MediaType.DOS_35_DS_DD_9; - case 1600: return MediaType.ACORN_35_DS_DD; - case 1640: return MediaType.FDFORMAT_35_DD; - case 1760: return MediaType.CBM_AMIGA_35_DD; - case 2242: return MediaType.IBM53FD_512; - case 2332: return MediaType.ECMA_99_15; - case 2400: return MediaType.DOS_525_HD; - case 2788: return MediaType.FDFORMAT_525_HD; - case 2880: return MediaType.DOS_35_HD; - case 3360: return MediaType.DMF; - case 3444: return MediaType.FDFORMAT_35_HD; - case 3520: return MediaType.CBM_AMIGA_35_HD; - case 5760: return MediaType.DOS_35_ED; - } - } - - break; - case 1024: - { - switch(blocks) - { - case 1220: return MediaType.IBM53FD_1024; - case 1232: return MediaType.SHARP_35; - case 1268: return MediaType.ECMA_69_8; - case 1280: return MediaType.NEC_525_HD; - case 1316: return MediaType.ECMA_99_8; - } - } - - break; - case 2048: - { - switch(blocks) - { - case 112311: return MediaType.MD60; - case 138363: return MediaType.MD74; - case 149373: return MediaType.MD80; - case 494023: return MediaType.HiMD; - } - - break; - } - } - - return MediaType.Unknown; - } - - // Sequential access device - case 0x01: - { - switch(mediumType) - { - case 0x00: - switch(densityCode) - { - case 0x04: return MediaType.QIC11; - case 0x05: return MediaType.QIC24; - case 0x09: return MediaType.IBM3490; - case 0x0F: return MediaType.QIC120; - case 0x10: return MediaType.QIC150; - case 0x13: return MediaType.DDS1; - case 0x24: return MediaType.DDS2; - case 0x25: return MediaType.DDS3; - case 0x26: return MediaType.DDS4; - case 0x28: return MediaType.IBM3490E; - case 0x40: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO; - - if(model.ToLowerInvariant().StartsWith("sdz", StringComparison.Ordinal)) - return MediaType.SAIT1; - - break; - } - - case 0x41: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO2; - - break; - } - - case 0x42: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO2; - - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9840A; - - break; - } - - case 0x43: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9940A; - - break; - } - - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO3; - - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9940B; - - break; - } - - case 0x45: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9840C; - - break; - } - - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO4; - - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T9840D; - - break; - } - - case 0x4A: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T10000A; - - break; - } - - case 0x4B: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T10000B; - - break; - } - - case 0x4C: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T10000C; - - break; - } - - case 0x4D: - { - if(vendor.ToLowerInvariant() == "stk") - return MediaType.T10000D; - - break; - } - - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO5; - - break; - } - - // Used by some HP drives for all generations - case 0x8C: - { - return MediaType.DDS1; - } - } - - break; - case 0x01: - { - switch(densityCode) - { - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO3WORM; - - break; - } - - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO4WORM; - - break; - } - - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO5WORM; - - break; - } - } - } - - break; - case 0x18: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO; - - break; - } - - case 0x40: - { - return MediaType.LTO; - } - } - } - - break; - case 0x28: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO2; - - break; - } - - case 0x42: return MediaType.LTO2; - } - } - - break; - case 0x33: - { - switch(densityCode) - { - case 0x00: - case 0x25: - { - if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) - return MediaType.DDS3; - - break; - } - } - } - - break; - case 0x34: - { - switch(densityCode) - { - case 0x00: - case 0x26: - { - if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) - return MediaType.DDS4; - - break; - } - } - } - - break; - case 0x35: - { - switch(densityCode) - { - case 0x00: - case 0x47: - { - if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) - return MediaType.DAT72; - - break; - } - } - } - - break; - case 0x38: - { - switch(densityCode) - { - case 0x00: - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO3; - - break; - } - } - } - - break; - case 0x3C: - { - switch(densityCode) - { - case 0x00: - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO3WORM; - - break; - } - } - } - - break; - case 0x48: - { - switch(densityCode) - { - case 0x00: - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO4; - - break; - } - } - } - - break; - case 0x4C: - { - switch(densityCode) - { - case 0x00: - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO4WORM; - - break; - } - } - } - - break; - case 0x50: - { - switch(densityCode) - { - case 0x00: - case 0x24: - { - if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) - return MediaType.DDS2; - - break; - } - } - } - - break; - case 0x58: - { - switch(densityCode) - { - case 0x00: - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO5; - - break; - } - } - } - - break; - case 0x5C: - { - switch(densityCode) - { - case 0x00: - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO5WORM; - - break; - } - } - } - - break; - case 0x68: - { - switch(densityCode) - { - case 0x00: - case 0x5A: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO6; - - break; - } - } - } - - break; - case 0x6C: - { - switch(densityCode) - { - case 0x00: - case 0x5A: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO6WORM; - - break; - } - } - } - - break; - case 0x78: - { - switch(densityCode) - { - case 0x00: - case 0x5C: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO7; - - break; - } - } - } - - break; - case 0x7C: - { - switch(densityCode) - { - case 0x00: - case 0x5C: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - return MediaType.LTO7WORM; - - break; - } - } - } - - break; - case 0x81: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape15m; - - if(vendor.ToLowerInvariant() == "ibm") - return MediaType.IBM3592; - - if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) - return MediaType.VXA1; - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape15m; - - break; - } - - case 0x29: - case 0x2A: - { - if(vendor.ToLowerInvariant() == "ibm") - return MediaType.IBM3592; - - break; - } - - case 0x80: - { - if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) - return MediaType.VXA1; - - break; - } - } - } - - break; - case 0x82: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape28m; - - if(vendor.ToLowerInvariant() == "ibm") - return MediaType.IBM3592; - - break; - } - - case 0x0A: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - return MediaType.CompactTapeI; - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape28m; - - break; - } - - case 0x16: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - return MediaType.CompactTapeII; - - break; - } - - case 0x29: - case 0x2A: - { - if(vendor.ToLowerInvariant() == "ibm") - return MediaType.IBM3592; - - break; - } - - case 0x81: - { - if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) - return MediaType.VXA2; - - break; - } - - case 0x82: - { - if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) - return MediaType.VXA3; - - break; - } - } - } - - break; - case 0x83: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape54m; - - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - return MediaType.DLTtapeIII; - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape54m; - - break; - } - - case 0x17: - case 0x18: - case 0x19: - case 0x80: - case 0x81: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - return MediaType.DLTtapeIII; - - break; - } - } - } - - break; - case 0x84: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape80m; - - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - return MediaType.DLTtapeIIIxt; - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape80m; - - break; - } - - case 0x19: - case 0x80: - case 0x81: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - return MediaType.DLTtapeIIIxt; - - break; - } - } - } - - break; - case 0x85: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape106m; - - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - return MediaType.DLTtapeIV; - - if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) - return MediaType.Travan5; - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape106m; - - break; - } - - case 0x1A: - case 0x1B: - case 0x40: - case 0x41: - case 0x82: - case 0x83: - case 0x84: - case 0x85: - case 0x86: - case 0x87: - case 0x88: - case 0x89: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - return MediaType.DLTtapeIV; - - break; - } - - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) - return MediaType.Travan5; - - break; - } - } - } - - break; - case 0x86: - { - switch(densityCode) - { - case 0x00: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape160mXL; - - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - return MediaType.SDLT1; - - break; - } - - case 0x8C: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape160mXL; - - break; - } - - case 0x91: - case 0x92: - case 0x93: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - return MediaType.SDLT1; - - break; - } - } - } - - break; - case 0x87: - { - switch(densityCode) - { - case 0x00: - case 0x4A: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - return MediaType.SDLT2; - - break; - } - } - } - - break; - case 0x90: - { - switch(densityCode) - { - case 0x00: - case 0x50: - case 0x98: - case 0x99: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - return MediaType.VStapeI; - - break; - } - } - } - - break; - case 0x95: - { - if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) - return MediaType.Travan7; - } - - break; - case 0xB6: - { - switch(densityCode) - { - case 0x45: - // HP Colorado tapes have a different capacity but return same density code at least in Seagate drives - return MediaType.Travan4; - } - } - - break; - case 0xB7: - { - switch(densityCode) - { - case 0x47: return MediaType.Travan5; - } - } - - break; - case 0xC1: - { - switch(densityCode) - { - case 0x00: - case 0x14: - case 0x15: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape22m; - - break; - } - } - } - - break; - case 0xC2: - { - switch(densityCode) - { - case 0x00: - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape40m; - - break; - } - } - } - - break; - case 0xC3: - { - switch(densityCode) - { - case 0x00: - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape76m; - - break; - } - } - } - - break; - case 0xC4: - { - switch(densityCode) - { - case 0x00: - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape112m; - - break; - } - } - } - - break; - case 0xD1: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape22mAME; - - break; - } - } - } - - break; - case 0xD2: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape170m; - - break; - } - } - } - - break; - case 0xD3: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape125m; - - break; - } - } - } - - break; - case 0xD4: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape45m; - - break; - } - } - } - - break; - case 0xD5: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape225m; - - break; - } - } - } - - break; - case 0xD6: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape150m; - - break; - } - } - } - - break; - case 0xD7: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - return MediaType.Exatape75m; - - break; - } - } - } - - break; - } - - return MediaType.Unknown; - } - - // Write-once device - case 0x04: - // Optical device - case 0x07: - { - if(mediumType != 0x01 && - mediumType != 0x02 && - mediumType != 0x03 && - mediumType != 0x05 && - mediumType != 0x07) - return MediaType.UnknownMO; - - // Audio format MiniDisc, cannot be read with a Hi-MD drive afaik - if(blockSize == 0 && - blocks == 0 && - model.StartsWith("Hi-MD")) - return MediaType.MD; - - switch(blockSize) - { - case 512: - { - switch(blocks) - { - case 248826: return MediaType.ECMA_154; - case 429975: return MediaType.ECMA_201_ROM; - case 446325: return MediaType.ECMA_201; - case 694929: return MediaType.ECMA_223_512; - case 904995: return MediaType.ECMA_183_512; - case 1128772: - case 1163337: return MediaType.ECMA_184_512; - case 1281856: return MediaType.PD650_WORM; - case 1298496: return MediaType.PD650; - case 1644581: - case 1647371: return MediaType.ECMA_195_512; - default: return MediaType.UnknownMO; - } - } - - case 1024: - { - switch(blocks) - { - case 371371: return MediaType.ECMA_223; - case 498526: return MediaType.ECMA_183; - case 603466: - case 637041: return MediaType.ECMA_184; - case 936921: - case 948770: return MediaType.ECMA_195; - case 1244621: return MediaType.ECMA_238; - case 14476734: return MediaType.ECMA_260; - case 24445990: return MediaType.ECMA_260_Double; - default: return MediaType.UnknownMO; - } - } - - case 2048: - { - switch(blocks) - { - case 310352: // Found in real media - case 318988: - case 320332: - case 321100: return MediaType.ECMA_239; - case 605846: return MediaType.GigaMo; - case 1063146: return MediaType.GigaMo2; - case 1128134: return MediaType.ECMA_280; - case 2043664: return MediaType.ECMA_322_2k; - case 7355716: return MediaType.ECMA_317; - default: return MediaType.UnknownMO; - } - } - - case 4096: - { - switch(blocks) - { - case 1095840: return MediaType.ECMA_322; - default: return MediaType.UnknownMO; - } - } - - case 8192: - { - switch(blocks) - { - case 1834348: return MediaType.UDO; - case 3668759: return MediaType.UDO2_WORM; - case 3669724: return MediaType.UDO2; - default: return MediaType.UnknownMO; - } - } - - default: return MediaType.UnknownMO; - } - } - - // MultiMedia Device - case 0x05: - { - switch(mediumType) - { - case 0x00: - return blockSize == 512 ? blocks == 1281856 - ? MediaType.PD650_WORM - : MediaType.PD650 : MediaType.CD; - case 0x01: - case 0x05: return MediaType.CDROM; - case 0x02: - case 0x06: return MediaType.CDDA; - case 0x03: - case 0x07: return MediaType.CDPLUS; - case 0x04: return MediaType.PCD; - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: - case 0x18: return MediaType.CDR; - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x26: - case 0x27: - case 0x28: return MediaType.CDRW; - case 0x80: - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - switch(densityCode) - { - case 0x42: return MediaType.LTO2; - case 0x44: return MediaType.LTO3; - case 0x46: return MediaType.LTO4; - case 0x58: return MediaType.LTO5; - } - - break; - } - } - - break; - - // MD DATA drives - case 0x10 when model.StartsWith("MDM", StringComparison.Ordinal) || - model.StartsWith("MDH", StringComparison.Ordinal): - if(blockSize == 2048) - return MediaType.MDData; - - switch(blocks) - { - case 57312: return MediaType.MD60; - case 70464: return MediaType.MD74; - case 76096: return MediaType.MD80; - } - - return MediaType.MD; - - // Host managed zoned block device - case 0x14: - { - return MediaType.Zone_HDD; - } - } - - return MediaType.Unknown; - } - - public static MediaType GetFromAta(string manufacturer, string model, bool removable, bool compactFlash, - bool pcmcia, ulong blocks, uint blockSize) - { - if(!removable) - { - if(compactFlash) - return MediaType.CompactFlash; - - return pcmcia ? MediaType.PCCardTypeI : MediaType.GENERIC_HDD; - } - - if(manufacturer.ToLowerInvariant() == "syquest" && - model.ToLowerInvariant() == "sparq" && - blocks == 1961069) - return MediaType.SparQ; - - return MediaType.Unknown; - } - } - #pragma warning restore RECS0063 // Warns when a culture-aware 'StartsWith' call is used by default. -} \ No newline at end of file diff --git a/MediaTypeFromDevice/FromAta.cs b/MediaTypeFromDevice/FromAta.cs new file mode 100644 index 000000000..92e8c60a9 --- /dev/null +++ b/MediaTypeFromDevice/FromAta.cs @@ -0,0 +1,65 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : FromAta.cs +// Author(s) : Natalia Portillo +// +// Component : Aaru common types. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2020 Natalia Portillo +// ****************************************************************************/ + +using Aaru.Console; + +namespace Aaru.CommonTypes +{ + public static partial class MediaTypeFromDevice + { + public static MediaType GetFromAta(string manufacturer, string model, bool removable, bool compactFlash, + bool pcmcia, ulong blocks) + { + if(!removable) + { + 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; + } + } +} \ No newline at end of file diff --git a/MediaTypeFromDevice/FromMmc.cs b/MediaTypeFromDevice/FromMmc.cs new file mode 100644 index 000000000..5532a0c4b --- /dev/null +++ b/MediaTypeFromDevice/FromMmc.cs @@ -0,0 +1,160 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : FromMmc.cs +// Author(s) : Natalia Portillo +// +// Component : Aaru common types. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2020 Natalia Portillo +// ****************************************************************************/ + +using System; +using Aaru.Console; + +namespace Aaru.CommonTypes +{ + public static partial class MediaTypeFromDevice + { + static MediaType GetFromMmc(string model, byte mediumType, byte densityCode, ulong blocks, uint blockSize) + { + 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); + + 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; + } + else + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, setting media type to Compact Disc.", + 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.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.CDDA; + case 0x03: + case 0x07: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, setting media type to CD+.", 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.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.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.CDRW; + 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.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.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.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.LTO5; + } + + break; + } + + return MediaType.Unknown; + } + } +} \ No newline at end of file diff --git a/MediaTypeFromDevice/FromOdc.cs b/MediaTypeFromDevice/FromOdc.cs new file mode 100644 index 000000000..a84227fef --- /dev/null +++ b/MediaTypeFromDevice/FromOdc.cs @@ -0,0 +1,295 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : FromOdc.cs +// Author(s) : Natalia Portillo +// +// Component : Aaru common types. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2020 Natalia Portillo +// ****************************************************************************/ + +using Aaru.Console; + +namespace Aaru.CommonTypes +{ + public static partial class MediaTypeFromDevice + { + static MediaType GetFromOdc(byte mediumType, ulong blocks, uint blockSize) + { + 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 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; + 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 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 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 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; + } + } + } +} \ No newline at end of file diff --git a/MediaTypeFromDevice/FromSbc.cs b/MediaTypeFromDevice/FromSbc.cs new file mode 100644 index 000000000..77634bcec --- /dev/null +++ b/MediaTypeFromDevice/FromSbc.cs @@ -0,0 +1,890 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : FromSbc.cs +// Author(s) : Natalia Portillo +// +// Component : Aaru common types. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2020 Natalia Portillo +// ****************************************************************************/ + +using System; +using Aaru.Console; + +namespace Aaru.CommonTypes +{ + public static partial class MediaTypeFromDevice + { + static MediaType GetFromSbc(string vendor, string model, byte mediumType, ulong blocks, uint blockSize) + { + if(vendor.ToLowerInvariant() == "syquest" && + model.StartsWith("syjet", StringComparison.OrdinalIgnoreCase)) + { + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, drive model is SyJet, setting media type to SyJet."); + + return MediaType.SyJet; + } + + switch(mediumType) + { + case 0x09: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-54 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_54; + case 0x0A: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-59 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_59; + case 0x0B: + switch(blockSize) + { + case 256: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_69_26; + case 512: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_69_15; + case 1024: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_69_8; + } + + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown.", + mediumType, blocks, blockSize); + + return MediaType.Unknown; + case 0x0E: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-66 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_66; + case 0x12: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-70 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_70; + case 0x16: + switch(blockSize) + { + case 256: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-78 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_78; + case 512: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-78 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_78_2; + } + + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown.", + mediumType, blocks, blockSize); + + return MediaType.Unknown; + case 0x1A: + switch(blockSize) + { + case 256: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_26; + case 512: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_15; + case 1024: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_8; + } + + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown.", + mediumType, blocks, blockSize); + + return MediaType.Unknown; + case 0x1E: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_DS_DD_9; + case 0x41: + switch(blocks) + { + case 58620544: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 120Gb REV.", + mediumType, blocks, blockSize); + + return MediaType.REV120; + case 34185728: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 70Gb REV.", + mediumType, blocks, blockSize); + + return MediaType.REV70; + case 17090880: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 35Gb REV.", + mediumType, blocks, blockSize); + + return MediaType.REV35; + } + + break; + case 0x93: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PC-98 formatted 3½\" high density floppy (15 sectors).", + mediumType, blocks, blockSize); + + return MediaType.NEC_35_HD_15; + case 0x94: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_HD; + } + + switch(blockSize) + { + case 128: + switch(blocks) + { + case 720: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Atari formatted 5¼\" single density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ATARI_525_SD; + case 1040: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Atari formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ATARI_525_DD; + case 1898: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (33FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM33FD_128; + case 2002: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-54 formatted 8\" single density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_54; + case 3848: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (43FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM43FD_128; + case 4004: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-59 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_59; + } + + break; + case 256: + switch(blocks) + { + case 322: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-56 formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_66; + case 400: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" single density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_525_SS_SD_40; + case 455: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.2 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apple32SS; + case 560: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.3 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apple33SS; + case 640: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_525_SS_DD_40; + case 720: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Atari formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ATARI_525_DD; + case 800: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" double density floppy (80 tracks).", + mediumType, blocks, blockSize); + + return MediaType.ACORN_525_SS_SD_80; + case 910: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.2 formatted 5¼\" double sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apple32DS; + case 1120: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.3 formatted 5¼\" double sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apple33DS; + case 1121: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (33FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM33FD_256; + case 1280 when mediumType == 0x01: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" double density floppy with 80 tracks.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_525_SS_DD_80; + case 1280: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-70 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_70; + case 2002: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to DEC RX02 floppy.", + mediumType, blocks, blockSize); + + return MediaType.RX02; + case 2560: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-78 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_78; + case 3848: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (53FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM53FD_256; + case 4004: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_26; + case 39168 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + case 41004 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, media has {0} blocks of 256 bytes, setting media type to 10Mb Bernoulli Box.", + blocks); + + return MediaType.Bernoulli10; + case 173400 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 173400 blocks of 256 bytes, setting media type to SQ400."); + + return MediaType.SQ400; + } + + break; + case 319: + switch(blocks) + { + case 256: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (23FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM23FD; + } + + break; + case 512: + switch(blocks) + { + case 320: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density single sided floppy (8 sectors).", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_SS_DD_8; + case 360: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density single sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_SS_DD_9; + case 610: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (33FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM33FD_512; + case 630 when mediumType == 0x01: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apricot formatted 3½\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apricot_35; + case 640 when mediumType == 0x01: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density single sided floppy (8 sectors).", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_SS_DD_8; + case 640: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density floppy (8 sectors).", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_DS_DD_8; + case 720 when mediumType == 0x01: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density single sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_SS_DD_9; + case 720: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_DS_DD_9; + case 800: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple formatted 3½\" double density single sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.AppleSonySS; + case 1280: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density floppy (8 sectors).", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_DS_DD_8; + case 1440: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_DS_DD_9; + case 1640: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to FDFORMAT formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.FDFORMAT_35_DD; + case 1760: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Amiga formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.CBM_AMIGA_35_DD; + case 2242: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (53FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM53FD_512; + case 2332: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_15; + case 2400: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_HD; + case 2788: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to FDFORMAT formatted 5¼\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.FDFORMAT_525_HD; + case 2880: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_HD; + case 3360: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Microsoft DMF formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DMF; + case 3444: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to FDFORMAT formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.FDFORMAT_35_HD; + case 3520: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Amiga formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.CBM_AMIGA_35_HD; + case 5760: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" extra density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_ED; + case 40662 when mediumType == 0x20: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Floptical.", + mediumType, blocks, blockSize); + + return MediaType.Floptical; + case 65536 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has 65536 blocks of 512 bytes, setting media type to FD32MB."); + + return MediaType.FD32MB; + case 78882 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, media has 78882 blocks of 512 bytes, setting media type to PocketZIP."); + + return MediaType.PocketZip; + case 173456 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 173456 blocks of 512 bytes, setting media type to SQ800."); + + return MediaType.SQ800; + case 175856 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, media has 175856 blocks of 512 bytes, setting media type to 90Mb Bernoulli Box II."); + + return MediaType.Bernoulli90; + case 196608 when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is ZIP, media has 196608 blocks of 512 bytes, setting media type to 100Mb ZIP."); + + return MediaType.ZIP100; + + case 215440 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 215440 blocks of 512 bytes, setting media type to SQ310."); + + return MediaType.SQ310; + case 246528 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has 246528 blocks of 512 bytes, setting media type to LS-120."); + + return MediaType.LS120; + case 248826 when mediumType == 0x01 || mediumType == 0x02: + 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 262144 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 262144 blocks of 512 bytes, setting media type to EZ135."); + + return MediaType.EZ135; + case 390696 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 390696 blocks of 512 bytes, setting media type to SQ2000."); + + return MediaType.SQ2000; + case 393380 when model.ToLowerInvariant().StartsWith("hifd", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is HiFD, media has 393380 blocks of 512 bytes, setting media type to HiFD.", + blocks, blockSize); + + return MediaType.HiFD; + case 429975 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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 450560 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 450560 blocks of 512 bytes, setting media type to EZ230."); + + return MediaType.EZ230; + case 469504 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has 469504 blocks of 512 bytes, setting media type to LS-240."); + + return MediaType.LS240; + case 489532 when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is ZIP, media has 489532 blocks of 512 bytes, setting media type to 250Mb ZIP."); + + return MediaType.ZIP250; + case 524288 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 524288 blocks of 512 bytes, setting media type to SQ327."); + + return MediaType.SQ327; + case 694929 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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 1128772 when mediumType == 0x01 || mediumType == 0x02: + case 1163337 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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 1470500 + when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is ZIP, media has 489532 blocks of 512 bytes, setting media type to 250Mb ZIP."); + + return MediaType.ZIP750; + case 1644581 when mediumType == 0x01 || mediumType == 0x02: + case 1647371 when mediumType == 0x01 || mediumType == 0x02: + 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 1961069 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 1961069 blocks of 512 bytes, setting media type to SparQ."); + + return MediaType.SparQ; + case 2091050 when model.ToLowerInvariant().StartsWith("jaz", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is JAZ, media has 2091050 blocks of 512 bytes, setting media type to 1Gb JAZ."); + + return MediaType.Jaz; + case 3915600 when model.ToLowerInvariant().StartsWith("jaz", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is JAZ, media has 3915600 blocks of 512 bytes, setting media type to 2Gb JAZ."); + + return MediaType.Jaz2; + case 4307184 when vendor.ToLowerInvariant().StartsWith("cws orb", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is Castlewood Orb, media has 4307184 blocks of 512 bytes, setting media type to Orb."); + + return MediaType.Orb; + case 625134256 when model.ToLowerInvariant().StartsWith("rdx", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has {0} blocks of {1} bytes, setting media type to unknown.", + blocks, blockSize); + + return MediaType.RDX320; + } + + break; + case 1024: + { + switch(blocks) + { + case 800 when mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_35_DS_DD; + case 1220: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (53FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM53FD_1024; + case 1232 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has 2880 blocks of 512 bytes, setting media type to PC-98 formatted 3½\" high density floppy."); + + return MediaType.NEC_35_HD_8; + case 1232: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Sharp formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.SHARP_35; + case 1268: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_69_8; + case 1280: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PC-98 formatted 5¼\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.NEC_525_HD; + case 1316: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_8; + case 1600 when mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_35_DS_HD; + case 371371 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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; + case 603466 when mediumType == 0x01 || mediumType == 0x02: + case 637041 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + case 948770 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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 14476734 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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; + } + } + + break; + case 2048: + { + switch(blocks) + { + case 112311: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.", + mediumType, blocks, blockSize); + + return MediaType.MD60; + case 138363: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 74 minute MiniDisc.", + mediumType, blocks, blockSize); + + return MediaType.MD74; + case 149373: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 80 minute MiniDisc.", + mediumType, blocks, blockSize); + + return MediaType.MD80; + case 310352 when mediumType == 0x01 || mediumType == 0x02: // Found in real media + case 318988 when mediumType == 0x01 || mediumType == 0x02: + case 320332 when mediumType == 0x01 || mediumType == 0x02: + case 321100 when mediumType == 0x01 || mediumType == 0x02: + 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 494023: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Sony HiMD.", + mediumType, blocks, blockSize); + + return MediaType.HiMD; + case 605846 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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 2043664 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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; + } + } + + break; + case 4096: + { + switch(blocks) + { + case 1095840 when mediumType == 0x01 || mediumType == 0x02: + 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; + } + } + + break; + case 8192: + { + switch(blocks) + { + case 1834348 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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 when mediumType == 0x01 || mediumType == 0x02: + 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; + } + } + + break; + } + + return MediaType.Unknown; + } + } +} \ No newline at end of file diff --git a/MediaTypeFromDevice/FromScsi.cs b/MediaTypeFromDevice/FromScsi.cs new file mode 100644 index 000000000..860095a5e --- /dev/null +++ b/MediaTypeFromDevice/FromScsi.cs @@ -0,0 +1,132 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : FromScsi.cs +// Author(s) : Natalia Portillo +// +// Component : Aaru common types. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2020 Natalia Portillo +// ****************************************************************************/ + +using System; +using Aaru.Console; + +namespace Aaru.CommonTypes +{ + public static partial class MediaTypeFromDevice + { + /// Tries to guess, from SCSI information, the media type of a device and/or its inserted media + /// The SCSI Peripheral Type as indicated in the INQUIRY response + /// The vendor string of the device + /// The model string of the device + /// The medium type byte from MODE SENSE + /// The density type byte from MODE SENSE + /// How many blocks are on the media + /// Size in bytes of each block + /// + public static MediaType GetFromScsi(byte scsiPeripheralType, string vendor, string model, byte mediumType, + byte densityCode, ulong blocks, uint blockSize) + { + switch(scsiPeripheralType) + { + // Direct access device + case 0x00: + // Simpilified access device + case 0x0E: + if(mediumType == 0x03 || + mediumType == 0x05 || + mediumType == 0x07) + goto case 0x07; + + return GetFromSbc(vendor, model, mediumType, 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); + + // MultiMedia Device + case 0x05: return GetFromMmc(model, mediumType, densityCode, blocks, blockSize); + + // 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 60 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.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.MD80; + } + + 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.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; + } + } +} \ No newline at end of file diff --git a/MediaTypeFromDevice/FromSsc.cs b/MediaTypeFromDevice/FromSsc.cs new file mode 100644 index 000000000..8436538eb --- /dev/null +++ b/MediaTypeFromDevice/FromSsc.cs @@ -0,0 +1,1602 @@ +// /*************************************************************************** +// Aaru Data Preservation Suite +// ---------------------------------------------------------------------------- +// +// Filename : FromSsc.cs +// Author(s) : Natalia Portillo +// +// Component : Aaru common types. +// +// --[ License ] -------------------------------------------------------------- +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2020 Natalia Portillo +// ****************************************************************************/ + +using System; +using Aaru.Console; + +namespace Aaru.CommonTypes +{ + public static partial class MediaTypeFromDevice + { + public static MediaType GetFromSsc(byte scsiPeripheralType, string vendor, string model, byte mediumType, + byte densityCode, ulong blocks, uint blockSize) + { + switch(mediumType) + { + case 0x00: + switch(densityCode) + { + case 0x04: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-11.", + mediumType, densityCode); + + return MediaType.QIC11; + case 0x05: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-24.", + mediumType, densityCode); + + return MediaType.QIC24; + case 0x09: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to IBM 3490.", + mediumType, densityCode); + + return MediaType.IBM3490; + case 0x0F: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-120.", + mediumType, densityCode); + + return MediaType.QIC120; + case 0x10: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-150.", + mediumType, densityCode); + + return MediaType.QIC150; + case 0x13: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS.", + mediumType, densityCode); + + return MediaType.DDS1; + case 0x24: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS-2.", + mediumType, densityCode); + + return MediaType.DDS2; + case 0x25: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS-3.", + mediumType, densityCode); + + return MediaType.DDS3; + case 0x26: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS-4.", + mediumType, densityCode); + + return MediaType.DDS4; + case 0x28: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to IBM 3490E.", + mediumType, densityCode); + + return MediaType.IBM3490E; + case 0x40: + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO.", + mediumType, densityCode); + + return MediaType.LTO; + } + + if(model.ToLowerInvariant().StartsWith("sdz", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"sdz\" setting media type to Super AIT.", + mediumType, densityCode); + + return MediaType.SAIT1; + } + + break; + + case 0x41: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-2.", + mediumType, densityCode); + + return MediaType.LTO2; + } + + break; + } + + case 0x42: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-2.", + mediumType, densityCode); + + return MediaType.LTO2; + } + + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9840A.", + mediumType, densityCode); + + return MediaType.T9840A; + } + + break; + } + + case 0x43: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9940A.", + mediumType, densityCode); + + return MediaType.T9940A; + } + + break; + } + + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-3.", + mediumType, densityCode); + + return MediaType.LTO3; + } + + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9940B.", + mediumType, densityCode); + + return MediaType.T9940B; + } + + break; + } + + case 0x45: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9840C.", + mediumType, densityCode); + + return MediaType.T9840C; + } + + break; + } + + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-4.", + mediumType, densityCode); + + return MediaType.LTO4; + } + + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9840D.", + mediumType, densityCode); + + return MediaType.T9840D; + } + + break; + } + + case 0x4A: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000A.", + mediumType, densityCode); + + return MediaType.T10000A; + } + + break; + } + + case 0x4B: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000B.", + mediumType, densityCode); + + return MediaType.T10000B; + } + + break; + } + + case 0x4C: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000C.", + mediumType, densityCode); + + return MediaType.T10000C; + } + + break; + } + + case 0x4D: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000D.", + mediumType, densityCode); + + return MediaType.T10000D; + } + + break; + } + + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-5.", + mediumType, densityCode); + + return MediaType.LTO5; + } + + break; + } + + // Used by some HP drives for all generations + case 0x8C: + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS.", + mediumType, densityCode); + + return MediaType.DDS1; + } + } + + break; + case 0x01: + { + switch(densityCode) + { + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-3.", + mediumType, densityCode); + + return MediaType.LTO3WORM; + } + + break; + } + + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-4.", + mediumType, densityCode); + + return MediaType.LTO4WORM; + } + + break; + } + + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-5.", + mediumType, densityCode); + + return MediaType.LTO5WORM; + } + + break; + } + } + } + + break; + case 0x18: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO.", + mediumType, densityCode); + + return MediaType.LTO; + } + + break; + } + + case 0x40: + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to LTO.", + mediumType, densityCode); + + return MediaType.LTO; + } + } + } + + break; + case 0x28: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-2.", + mediumType, densityCode); + + return MediaType.LTO2; + } + + break; + } + + case 0x42: + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to LTO-2.", + mediumType, densityCode); + + return MediaType.LTO2; + } + } + } + + break; + case 0x33: + { + switch(densityCode) + { + case 0x00: + case 0x25: + { + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DDS-3.", + mediumType, densityCode); + + return MediaType.DDS3; + } + + break; + } + } + } + + break; + case 0x34: + { + switch(densityCode) + { + case 0x00: + case 0x26: + { + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DDS-4.", + mediumType, densityCode); + + return MediaType.DDS4; + } + + break; + } + } + } + + break; + case 0x35: + { + switch(densityCode) + { + case 0x00: + case 0x47: + { + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DAT72.", + mediumType, densityCode); + + return MediaType.DAT72; + } + + break; + } + } + } + + break; + case 0x38: + { + switch(densityCode) + { + case 0x00: + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-3.", + mediumType, densityCode); + + return MediaType.LTO3; + } + + break; + } + } + } + + break; + case 0x3C: + { + switch(densityCode) + { + case 0x00: + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-3.", + mediumType, densityCode); + + return MediaType.LTO3WORM; + } + + break; + } + } + } + + break; + case 0x48: + { + switch(densityCode) + { + case 0x00: + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-4.", + mediumType, densityCode); + + return MediaType.LTO4; + } + + break; + } + } + } + + break; + case 0x4C: + { + switch(densityCode) + { + case 0x00: + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-4.", + mediumType, densityCode); + + return MediaType.LTO4WORM; + } + + break; + } + } + } + + break; + case 0x50: + { + switch(densityCode) + { + case 0x00: + case 0x24: + { + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DDS-2.", + mediumType, densityCode); + + return MediaType.DDS2; + } + + break; + } + } + } + + break; + case 0x58: + { + switch(densityCode) + { + case 0x00: + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-5.", + mediumType, densityCode); + + return MediaType.LTO5; + } + + break; + } + } + } + + break; + case 0x5C: + { + switch(densityCode) + { + case 0x00: + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-5.", + mediumType, densityCode); + + return MediaType.LTO5WORM; + } + + break; + } + } + } + + break; + case 0x68: + { + switch(densityCode) + { + case 0x00: + case 0x5A: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-6.", + mediumType, densityCode); + + return MediaType.LTO6; + } + + break; + } + } + } + + break; + case 0x6C: + { + switch(densityCode) + { + case 0x00: + case 0x5A: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-6.", + mediumType, densityCode); + + return MediaType.LTO6WORM; + } + + break; + } + } + } + + break; + case 0x78: + { + switch(densityCode) + { + case 0x00: + case 0x5C: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-7.", + mediumType, densityCode); + + return MediaType.LTO7; + } + + break; + } + } + } + + break; + case 0x7C: + { + switch(densityCode) + { + case 0x00: + case 0x5C: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-7.", + mediumType, densityCode); + + return MediaType.LTO7WORM; + } + + break; + } + } + } + + break; + case 0x81: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 15m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape15m; + } + + if(vendor.ToLowerInvariant() == "ibm") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", + mediumType, densityCode); + + return MediaType.IBM3592; + } + + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA.", + mediumType, densityCode); + + return MediaType.VXA1; + } + + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 15m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape15m; + } + + break; + } + + case 0x29: + case 0x2A: + { + if(vendor.ToLowerInvariant() == "ibm") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", + mediumType, densityCode); + + return MediaType.IBM3592; + } + + break; + } + + case 0x80: + { + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA.", + mediumType, densityCode); + + return MediaType.VXA1; + } + + break; + } + } + } + + break; + case 0x82: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 28m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape28m; + } + + if(vendor.ToLowerInvariant() == "ibm") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", + mediumType, densityCode); + + return MediaType.IBM3592; + } + + break; + } + + case 0x0A: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to CompactTape.", + mediumType, densityCode); + + return MediaType.CompactTapeI; + } + + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 28m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape28m; + } + + break; + } + + case 0x16: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to CompactTape II.", + mediumType, densityCode); + + return MediaType.CompactTapeII; + } + + break; + } + + case 0x29: + case 0x2A: + { + if(vendor.ToLowerInvariant() == "ibm") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", + mediumType, densityCode); + + return MediaType.IBM3592; + } + + break; + } + + case 0x81: + { + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA 2.", + mediumType, densityCode); + + return MediaType.VXA2; + } + + break; + } + + case 0x82: + { + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA 3.", + mediumType, densityCode); + + return MediaType.VXA3; + } + + break; + } + } + } + + break; + case 0x83: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 54m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape54m; + } + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape III.", + mediumType, densityCode); + + return MediaType.DLTtapeIII; + } + + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 54m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape54m; + } + + break; + } + + case 0x17: + case 0x18: + case 0x19: + case 0x80: + case 0x81: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape III.", + mediumType, densityCode); + + return MediaType.DLTtapeIII; + } + + break; + } + } + } + + break; + case 0x84: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 80m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape80m; + } + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IIIxt.", + mediumType, densityCode); + + return MediaType.DLTtapeIIIxt; + } + + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 80m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape80m; + } + + break; + } + + case 0x19: + case 0x80: + case 0x81: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IIIxt.", + mediumType, densityCode); + + return MediaType.DLTtapeIIIxt; + } + + break; + } + } + } + + break; + case 0x85: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 106m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape106m; + } + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IV.", + mediumType, densityCode); + + return MediaType.DLTtapeIV; + } + + if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"stt\" setting media type to Travan 5.", + mediumType, densityCode); + + return MediaType.Travan5; + } + + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 106m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape106m; + } + + break; + } + + case 0x1A: + case 0x1B: + case 0x40: + case 0x41: + case 0x82: + case 0x83: + case 0x84: + case 0x85: + case 0x86: + case 0x87: + case 0x88: + case 0x89: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IV.", + mediumType, densityCode); + + return MediaType.DLTtapeIV; + } + + break; + } + + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"stt\" setting media type to Travan 5.", + mediumType, densityCode); + + return MediaType.Travan5; + } + + break; + } + } + } + + break; + case 0x86: + { + switch(densityCode) + { + case 0x00: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 160m Exatape XL.", + mediumType, densityCode); + + return MediaType.Exatape160mXL; + } + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to SuperDLT.", + mediumType, densityCode); + + return MediaType.SDLT1; + } + + break; + } + + case 0x8C: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 160m Exatape XL.", + mediumType, densityCode); + + return MediaType.Exatape160mXL; + } + + break; + } + + case 0x91: + case 0x92: + case 0x93: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to SuperDLT.", + mediumType, densityCode); + + return MediaType.SDLT1; + } + + break; + } + } + } + + break; + case 0x87: + { + switch(densityCode) + { + case 0x00: + case 0x4A: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to SuperDLT 2.", + mediumType, densityCode); + + return MediaType.SDLT2; + } + + break; + } + } + } + + break; + case 0x90: + { + switch(densityCode) + { + case 0x00: + case 0x50: + case 0x98: + case 0x99: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to VStape I.", + mediumType, densityCode); + + return MediaType.VStapeI; + } + + break; + } + } + } + + break; + case 0x95: + { + if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"stt\" setting media type to Travan 7.", + mediumType, densityCode); + + return MediaType.Travan7; + } + } + + break; + case 0xB6: + { + switch(densityCode) + { + case 0x45: + // HP Colorado tapes have a different capacity but return same density code at least in Seagate drives + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to Travan 4.", + mediumType, densityCode); + + return MediaType.Travan4; + } + } + + break; + case 0xB7: + { + switch(densityCode) + { + case 0x47: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to Travan 5.", + mediumType, densityCode); + + return MediaType.Travan5; + } + } + + break; + case 0xC1: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 22m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape22m; + } + + break; + } + } + } + + break; + case 0xC2: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 40m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape40m; + } + + break; + } + } + } + + break; + case 0xC3: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 76m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape76m; + } + + break; + } + } + } + + break; + case 0xC4: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 112m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape112m; + } + + break; + } + } + } + + break; + case 0xD1: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 22m Exatape AME.", + mediumType, densityCode); + + return MediaType.Exatape22mAME; + } + + break; + } + } + } + + break; + case 0xD2: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 170m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape170m; + } + + break; + } + } + } + + break; + case 0xD3: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 125m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape125m; + } + + break; + } + } + } + + break; + case 0xD4: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 45m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape45m; + } + + break; + } + } + } + + break; + case 0xD5: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 225m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape225m; + } + + break; + } + } + } + + break; + case 0xD6: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 150m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape150m; + } + + break; + } + } + } + + break; + case 0xD7: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 75m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape75m; + } + + break; + } + } + } + + break; + } + + return MediaType.Unknown; + } + } +} \ No newline at end of file