diff --git a/MediaTypeFromDevice/FromMmc.cs b/MediaTypeFromDevice/FromMmc.cs index f097917..bea2a68 100644 --- a/MediaTypeFromDevice/FromMmc.cs +++ b/MediaTypeFromDevice/FromMmc.cs @@ -40,7 +40,7 @@ namespace Aaru.CommonTypes public static partial class MediaTypeFromDevice { static MediaType GetFromMmc(string model, byte mediumType, byte densityCode, ulong blocks, uint blockSize, - bool isUsb) + bool isUsb, bool opticalDisc) { switch(mediumType) { @@ -122,9 +122,9 @@ namespace Aaru.CommonTypes "SCSI medium type is {0:X2}h, setting media type to CD-RW.", mediumType); return MediaType.CDRW; - case 0x40 when isUsb: - case 0x41 when isUsb: - case 0x42 when isUsb: + case 0x40 when isUsb && !opticalDisc: + case 0x41 when isUsb && !opticalDisc: + case 0x42 when isUsb && !opticalDisc: AaruConsole.DebugWriteLine("Media detection", "SCSI medium type is {0:X2}h and device is USB, setting media type to Flash Drive.", mediumType); diff --git a/MediaTypeFromDevice/FromScsi.cs b/MediaTypeFromDevice/FromScsi.cs index 508b157..cbaa394 100644 --- a/MediaTypeFromDevice/FromScsi.cs +++ b/MediaTypeFromDevice/FromScsi.cs @@ -48,9 +48,11 @@ namespace Aaru.CommonTypes /// How many blocks are on the media /// Size in bytes of each block /// Device is USB + /// /// public static MediaType GetFromScsi(byte scsiPeripheralType, string vendor, string model, byte mediumType, - byte densityCode, ulong blocks, uint blockSize, bool isUsb) + byte densityCode, ulong blocks, uint blockSize, bool isUsb, + bool opticalDisc) { switch(scsiPeripheralType) { @@ -75,7 +77,7 @@ namespace Aaru.CommonTypes case 0x07: return GetFromOdc(mediumType, blocks, blockSize); // MultiMedia Device - case 0x05: return GetFromMmc(model, mediumType, densityCode, blocks, blockSize, isUsb); + case 0x05: return GetFromMmc(model, mediumType, densityCode, blocks, blockSize, isUsb, opticalDisc); // MD DATA drives case 0x10 when model.StartsWith("MDM", StringComparison.Ordinal) || diff --git a/Structs/Devices/ATA/Identify.cs b/Structs/Devices/ATA/Identify.cs index edd90f8..5aaaa54 100644 --- a/Structs/Devices/ATA/Identify.cs +++ b/Structs/Devices/ATA/Identify.cs @@ -1029,7 +1029,7 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA static string DescrambleATAString(IList buffer, int offset, int length) { - byte[] outbuf = buffer[(offset + length) - 1] != 0x00 ? new byte[length + 1] : new byte[length]; + byte[] outbuf = buffer[offset + length - 1] != 0x00 ? new byte[length + 1] : new byte[length]; for(int i = 0; i < length; i += 2) {