From 1e1f3e2c3841ccf8f77b43fbe54b63ca8efe0e04 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 13 May 2020 10:42:58 +0000 Subject: [PATCH] Fix opening SD/MMC devices. --- .idea/.idea.Aaru/.idea/contentModel.xml | 1 - Aaru.Devices/Device/Constructor.cs | 26 ++++++++++++------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.idea/.idea.Aaru/.idea/contentModel.xml b/.idea/.idea.Aaru/.idea/contentModel.xml index 205e7f856..497d442ee 100644 --- a/.idea/.idea.Aaru/.idea/contentModel.xml +++ b/.idea/.idea.Aaru/.idea/contentModel.xml @@ -1372,7 +1372,6 @@ - diff --git a/Aaru.Devices/Device/Constructor.cs b/Aaru.Devices/Device/Constructor.cs index 1bf89df63..37646f4db 100644 --- a/Aaru.Devices/Device/Constructor.cs +++ b/Aaru.Devices/Device/Constructor.cs @@ -92,8 +92,7 @@ namespace Aaru.Devices case PlatformID.Win32NT: { FileHandle = Extern.CreateFile(devicePath, FileAccess.GenericRead | FileAccess.GenericWrite, - FileShare.Read | FileShare.Write, - IntPtr.Zero, + FileShare.Read | FileShare.Write, IntPtr.Zero, FileMode.OpenExisting, FileAttributes.Normal, IntPtr.Zero); if(((SafeFileHandle)FileHandle).IsInvalid) @@ -204,19 +203,16 @@ namespace Aaru.Devices { var descriptor = new StorageDeviceDescriptor { - Version = BitConverter.ToUInt32(descriptorB, 0), - Size = BitConverter.ToUInt32(descriptorB, 4), - DeviceType = descriptorB[8], - DeviceTypeModifier = descriptorB[9], - RemovableMedia = descriptorB[10] > 0, - CommandQueueing = - descriptorB[11] > 0, - VendorIdOffset = BitConverter.ToInt32(descriptorB, 12), - ProductIdOffset = BitConverter.ToInt32(descriptorB, 16), + Version = BitConverter.ToUInt32(descriptorB, 0), + Size = BitConverter.ToUInt32(descriptorB, 4), DeviceType = descriptorB[8], + DeviceTypeModifier = descriptorB[9], RemovableMedia = descriptorB[10] > 0, + CommandQueueing = descriptorB[11] > 0, + VendorIdOffset = BitConverter.ToInt32(descriptorB, 12), + ProductIdOffset = BitConverter.ToInt32(descriptorB, 16), ProductRevisionOffset = BitConverter.ToInt32(descriptorB, 20), - SerialNumberOffset = BitConverter.ToInt32(descriptorB, 24), - BusType = (StorageBusType)BitConverter.ToUInt32(descriptorB, 28), - RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32) + SerialNumberOffset = BitConverter.ToInt32(descriptorB, 24), + BusType = (StorageBusType)BitConverter.ToUInt32(descriptorB, 28), + RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32) }; descriptor.RawDeviceProperties = new byte[descriptor.RawPropertiesLength]; @@ -466,6 +462,8 @@ namespace Aaru.Devices Serial = $"{decoded.ProductSerialNumber}"; } + + return; } #endregion SecureDigital / MultiMediaCard