Example #1
0
        /// <summary>
        ///     Fills a device report with parameters specific to a USB device
        /// </summary>
        /// <param name="dev">Device</param>
        /// <param name="report">Device report</param>
        /// <param name="removable">If device is removable</param>
        /// <param name="debug">If debug is enabled</param>
        internal static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
        {
            if(report == null) return;

            ConsoleKeyInfo pressedKey = new ConsoleKeyInfo();
            while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
            {
                DicConsole.Write("Is the device natively USB (in case of doubt, press Y)? (Y/N): ");
                pressedKey = System.Console.ReadKey();
                DicConsole.WriteLine();
            }

            if(pressedKey.Key != ConsoleKey.Y) return;

            report.USB = new usbType
            {
                Manufacturer = dev.UsbManufacturerString,
                Product = dev.UsbProductString,
                ProductID = dev.UsbProductId,
                VendorID = dev.UsbVendorId
            };

            pressedKey = new ConsoleKeyInfo();
            while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
            {
                DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
                pressedKey = System.Console.ReadKey();
                DicConsole.WriteLine();
            }

            report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
            removable = report.USB.RemovableMedia;
            if(debug) report.USB.Descriptors = dev.UsbDescriptors;
        }
Example #2
0
        public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
        {
            if (report == null)
            {
                return;
            }

            throw new NotImplementedException("NVMe devices not yet supported.");
        }
Example #3
0
        /// <summary>
        ///     Fills a device report with parameters specific to a PCMCIA device
        /// </summary>
        /// <param name="dev">Device</param>
        /// <param name="report">Device report</param>
        internal static void Report(Device dev, ref DeviceReport report)
        {
            report.PCMCIA = new pcmciaType {
                CIS = dev.Cis
            };
            Tuple[] tuples = CIS.GetTuples(dev.Cis);
            if (tuples == null)
            {
                return;
            }

            foreach (Tuple tuple in tuples)
            {
                switch (tuple.Code)
                {
                case TupleCodes.CISTPL_MANFID:
                    ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple);

                    if (manfid != null)
                    {
                        report.PCMCIA.ManufacturerCode          = manfid.ManufacturerID;
                        report.PCMCIA.CardCode                  = manfid.CardID;
                        report.PCMCIA.ManufacturerCodeSpecified = true;
                        report.PCMCIA.CardCodeSpecified         = true;
                    }

                    break;

                case TupleCodes.CISTPL_VERS_1:
                    Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);

                    if (vers != null)
                    {
                        report.PCMCIA.Manufacturer          = vers.Manufacturer;
                        report.PCMCIA.ProductName           = vers.Product;
                        report.PCMCIA.Compliance            = $"{vers.MajorVersion}.{vers.MinorVersion}";
                        report.PCMCIA.AdditionalInformation = vers.AdditionalInformation;
                    }

                    break;
                }
            }
        }
Example #4
0
        /// <summary>
        ///     Fills a device report with parameters specific to a FireWire device
        /// </summary>
        /// <param name="dev">Device</param>
        /// <param name="report">Device report</param>
        /// <param name="removable">If device is removable</param>
        internal static void Report(Device dev, ref DeviceReport report, ref bool removable)
        {
            if (report == null)
            {
                return;
            }

            ConsoleKeyInfo pressedKey = new ConsoleKeyInfo();

            while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
            {
                DicConsole.Write("Is the device natively FireWire (in case of doubt, press Y)? (Y/N): ");
                pressedKey = System.Console.ReadKey();
                DicConsole.WriteLine();
            }

            if (pressedKey.Key != ConsoleKey.Y)
            {
                return;
            }

            report.FireWire = new firewireType
            {
                Manufacturer = dev.FireWireVendorName,
                Product      = dev.FireWireModelName,
                ProductID    = dev.FireWireModel,
                VendorID     = dev.FireWireVendor
            };

            pressedKey = new ConsoleKeyInfo();
            while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
            {
                DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
                pressedKey = System.Console.ReadKey();
                DicConsole.WriteLine();
            }

            report.FireWire.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
            removable = report.FireWire.RemovableMedia;
        }
Example #5
0
        /// <summary>
        ///     Fills a SCSI device report with parameters specific to an ATAPI device
        /// </summary>
        /// <param name="dev">Device</param>
        /// <param name="report">Device report</param>
        /// <param name="debug">If debug is enabled</param>
        internal static void Report(Device dev, ref DeviceReport report, bool debug)
        {
            if (report == null)
            {
                return;
            }

            const uint TIMEOUT = 5;

            DicConsole.WriteLine("Querying ATAPI IDENTIFY...");

            dev.AtapiIdentify(out byte[] buffer, out _, TIMEOUT, out _);

            if (!Identify.Decode(buffer).HasValue)
            {
                return;
            }

            Identify.IdentifyDevice?atapiIdNullable = Identify.Decode(buffer);
            if (atapiIdNullable != null)
            {
                Identify.IdentifyDevice atapiId = atapiIdNullable.Value;

                report.ATAPI = new ataType();

                if (!string.IsNullOrWhiteSpace(atapiId.AdditionalPID))
                {
                    report.ATAPI.AdditionalPID          = atapiId.AdditionalPID;
                    report.ATAPI.AdditionalPIDSpecified = true;
                }

                if (atapiId.APIOSupported != 0)
                {
                    report.ATAPI.APIOSupported          = atapiId.APIOSupported;
                    report.ATAPI.APIOSupportedSpecified = true;
                }

                if (atapiId.ATAPIByteCount != 0)
                {
                    report.ATAPI.ATAPIByteCount          = atapiId.ATAPIByteCount;
                    report.ATAPI.ATAPIByteCountSpecified = true;
                }

                if (atapiId.BufferType != 0)
                {
                    report.ATAPI.BufferType          = atapiId.BufferType;
                    report.ATAPI.BufferTypeSpecified = true;
                }

                if (atapiId.BufferSize != 0)
                {
                    report.ATAPI.BufferSize          = atapiId.BufferSize;
                    report.ATAPI.BufferSizeSpecified = true;
                }

                if (atapiId.Capabilities != 0)
                {
                    report.ATAPI.Capabilities          = atapiId.Capabilities;
                    report.ATAPI.CapabilitiesSpecified = true;
                }

                if (atapiId.Capabilities2 != 0)
                {
                    report.ATAPI.Capabilities2          = atapiId.Capabilities2;
                    report.ATAPI.Capabilities2Specified = true;
                }

                if (atapiId.Capabilities3 != 0)
                {
                    report.ATAPI.Capabilities3          = atapiId.Capabilities3;
                    report.ATAPI.Capabilities3Specified = true;
                }

                if (atapiId.CFAPowerMode != 0)
                {
                    report.ATAPI.CFAPowerMode          = atapiId.CFAPowerMode;
                    report.ATAPI.CFAPowerModeSpecified = true;
                }

                if (atapiId.CommandSet != 0)
                {
                    report.ATAPI.CommandSet          = atapiId.CommandSet;
                    report.ATAPI.CommandSetSpecified = true;
                }

                if (atapiId.CommandSet2 != 0)
                {
                    report.ATAPI.CommandSet2          = atapiId.CommandSet2;
                    report.ATAPI.CommandSet2Specified = true;
                }

                if (atapiId.CommandSet3 != 0)
                {
                    report.ATAPI.CommandSet3          = atapiId.CommandSet3;
                    report.ATAPI.CommandSet3Specified = true;
                }

                if (atapiId.CommandSet4 != 0)
                {
                    report.ATAPI.CommandSet4          = atapiId.CommandSet4;
                    report.ATAPI.CommandSet4Specified = true;
                }

                if (atapiId.CommandSet5 != 0)
                {
                    report.ATAPI.CommandSet5          = atapiId.CommandSet5;
                    report.ATAPI.CommandSet5Specified = true;
                }

                if (atapiId.CurrentAAM != 0)
                {
                    report.ATAPI.CurrentAAM          = atapiId.CurrentAAM;
                    report.ATAPI.CurrentAAMSpecified = true;
                }

                if (atapiId.CurrentAPM != 0)
                {
                    report.ATAPI.CurrentAPM          = atapiId.CurrentAPM;
                    report.ATAPI.CurrentAPMSpecified = true;
                }

                if (atapiId.DataSetMgmt != 0)
                {
                    report.ATAPI.DataSetMgmt          = atapiId.DataSetMgmt;
                    report.ATAPI.DataSetMgmtSpecified = true;
                }

                if (atapiId.DataSetMgmtSize != 0)
                {
                    report.ATAPI.DataSetMgmtSize          = atapiId.DataSetMgmtSize;
                    report.ATAPI.DataSetMgmtSizeSpecified = true;
                }

                if (atapiId.DeviceFormFactor != 0)
                {
                    report.ATAPI.DeviceFormFactor          = atapiId.DeviceFormFactor;
                    report.ATAPI.DeviceFormFactorSpecified = true;
                }

                if (atapiId.DMAActive != 0)
                {
                    report.ATAPI.DMAActive          = atapiId.DMAActive;
                    report.ATAPI.DMAActiveSpecified = true;
                }

                if (atapiId.DMASupported != 0)
                {
                    report.ATAPI.DMASupported          = atapiId.DMASupported;
                    report.ATAPI.DMASupportedSpecified = true;
                }

                if (atapiId.DMATransferTimingMode != 0)
                {
                    report.ATAPI.DMATransferTimingMode          = atapiId.DMATransferTimingMode;
                    report.ATAPI.DMATransferTimingModeSpecified = true;
                }

                if (atapiId.EnhancedSecurityEraseTime != 0)
                {
                    report.ATAPI.EnhancedSecurityEraseTime          = atapiId.EnhancedSecurityEraseTime;
                    report.ATAPI.EnhancedSecurityEraseTimeSpecified = true;
                }

                if (atapiId.EnabledCommandSet != 0)
                {
                    report.ATAPI.EnabledCommandSet          = atapiId.EnabledCommandSet;
                    report.ATAPI.EnabledCommandSetSpecified = true;
                }

                if (atapiId.EnabledCommandSet2 != 0)
                {
                    report.ATAPI.EnabledCommandSet2          = atapiId.EnabledCommandSet2;
                    report.ATAPI.EnabledCommandSet2Specified = true;
                }

                if (atapiId.EnabledCommandSet3 != 0)
                {
                    report.ATAPI.EnabledCommandSet3          = atapiId.EnabledCommandSet3;
                    report.ATAPI.EnabledCommandSet3Specified = true;
                }

                if (atapiId.EnabledCommandSet4 != 0)
                {
                    report.ATAPI.EnabledCommandSet4          = atapiId.EnabledCommandSet4;
                    report.ATAPI.EnabledCommandSet4Specified = true;
                }

                if (atapiId.EnabledSATAFeatures != 0)
                {
                    report.ATAPI.EnabledSATAFeatures          = atapiId.EnabledSATAFeatures;
                    report.ATAPI.EnabledSATAFeaturesSpecified = true;
                }

                if (atapiId.ExtendedUserSectors != 0)
                {
                    report.ATAPI.ExtendedUserSectors          = atapiId.ExtendedUserSectors;
                    report.ATAPI.ExtendedUserSectorsSpecified = true;
                }

                if (atapiId.FreeFallSensitivity != 0)
                {
                    report.ATAPI.FreeFallSensitivity          = atapiId.FreeFallSensitivity;
                    report.ATAPI.FreeFallSensitivitySpecified = true;
                }

                if (!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision))
                {
                    report.ATAPI.FirmwareRevision          = atapiId.FirmwareRevision;
                    report.ATAPI.FirmwareRevisionSpecified = true;
                }

                if (atapiId.GeneralConfiguration != 0)
                {
                    report.ATAPI.GeneralConfiguration          = atapiId.GeneralConfiguration;
                    report.ATAPI.GeneralConfigurationSpecified = true;
                }

                if (atapiId.HardwareResetResult != 0)
                {
                    report.ATAPI.HardwareResetResult          = atapiId.HardwareResetResult;
                    report.ATAPI.HardwareResetResultSpecified = true;
                }

                if (atapiId.InterseekDelay != 0)
                {
                    report.ATAPI.InterseekDelay          = atapiId.InterseekDelay;
                    report.ATAPI.InterseekDelaySpecified = true;
                }

                if (atapiId.MajorVersion != 0)
                {
                    report.ATAPI.MajorVersion          = atapiId.MajorVersion;
                    report.ATAPI.MajorVersionSpecified = true;
                }

                if (atapiId.MasterPasswordRevisionCode != 0)
                {
                    report.ATAPI.MasterPasswordRevisionCode          = atapiId.MasterPasswordRevisionCode;
                    report.ATAPI.MasterPasswordRevisionCodeSpecified = true;
                }

                if (atapiId.MaxDownloadMicroMode3 != 0)
                {
                    report.ATAPI.MaxDownloadMicroMode3          = atapiId.MaxDownloadMicroMode3;
                    report.ATAPI.MaxDownloadMicroMode3Specified = true;
                }

                if (atapiId.MaxQueueDepth != 0)
                {
                    report.ATAPI.MaxQueueDepth          = atapiId.MaxQueueDepth;
                    report.ATAPI.MaxQueueDepthSpecified = true;
                }

                if (atapiId.MDMAActive != 0)
                {
                    report.ATAPI.MDMAActive          = atapiId.MDMAActive;
                    report.ATAPI.MDMAActiveSpecified = true;
                }

                if (atapiId.MDMASupported != 0)
                {
                    report.ATAPI.MDMASupported          = atapiId.MDMASupported;
                    report.ATAPI.MDMASupportedSpecified = true;
                }

                if (atapiId.MinDownloadMicroMode3 != 0)
                {
                    report.ATAPI.MinDownloadMicroMode3          = atapiId.MinDownloadMicroMode3;
                    report.ATAPI.MinDownloadMicroMode3Specified = true;
                }

                if (atapiId.MinMDMACycleTime != 0)
                {
                    report.ATAPI.MinMDMACycleTime          = atapiId.MinMDMACycleTime;
                    report.ATAPI.MinMDMACycleTimeSpecified = true;
                }

                if (atapiId.MinorVersion != 0)
                {
                    report.ATAPI.MinorVersion          = atapiId.MinorVersion;
                    report.ATAPI.MinorVersionSpecified = true;
                }

                if (atapiId.MinPIOCycleTimeNoFlow != 0)
                {
                    report.ATAPI.MinPIOCycleTimeNoFlow          = atapiId.MinPIOCycleTimeNoFlow;
                    report.ATAPI.MinPIOCycleTimeNoFlowSpecified = true;
                }

                if (atapiId.MinPIOCycleTimeFlow != 0)
                {
                    report.ATAPI.MinPIOCycleTimeFlow          = atapiId.MinPIOCycleTimeFlow;
                    report.ATAPI.MinPIOCycleTimeFlowSpecified = true;
                }

                if (!string.IsNullOrWhiteSpace(atapiId.Model))
                {
                    report.ATAPI.Model          = atapiId.Model;
                    report.ATAPI.ModelSpecified = true;
                }

                if (atapiId.MultipleMaxSectors != 0)
                {
                    report.ATAPI.MultipleMaxSectors          = atapiId.MultipleMaxSectors;
                    report.ATAPI.MultipleMaxSectorsSpecified = true;
                }

                if (atapiId.MultipleSectorNumber != 0)
                {
                    report.ATAPI.MultipleSectorNumber          = atapiId.MultipleSectorNumber;
                    report.ATAPI.MultipleSectorNumberSpecified = true;
                }

                if (atapiId.NVCacheCaps != 0)
                {
                    report.ATAPI.NVCacheCaps          = atapiId.NVCacheCaps;
                    report.ATAPI.NVCacheCapsSpecified = true;
                }

                if (atapiId.NVCacheSize != 0)
                {
                    report.ATAPI.NVCacheSize          = atapiId.NVCacheSize;
                    report.ATAPI.NVCacheSizeSpecified = true;
                }

                if (atapiId.NVCacheWriteSpeed != 0)
                {
                    report.ATAPI.NVCacheWriteSpeed          = atapiId.NVCacheWriteSpeed;
                    report.ATAPI.NVCacheWriteSpeedSpecified = true;
                }

                if (atapiId.NVEstimatedSpinUp != 0)
                {
                    report.ATAPI.NVEstimatedSpinUp          = atapiId.NVEstimatedSpinUp;
                    report.ATAPI.NVEstimatedSpinUpSpecified = true;
                }

                if (atapiId.PacketBusRelease != 0)
                {
                    report.ATAPI.PacketBusRelease          = atapiId.PacketBusRelease;
                    report.ATAPI.PacketBusReleaseSpecified = true;
                }

                if (atapiId.PIOTransferTimingMode != 0)
                {
                    report.ATAPI.PIOTransferTimingMode          = atapiId.PIOTransferTimingMode;
                    report.ATAPI.PIOTransferTimingModeSpecified = true;
                }

                if (atapiId.RecommendedAAM != 0)
                {
                    report.ATAPI.RecommendedAAM          = atapiId.RecommendedAAM;
                    report.ATAPI.RecommendedAAMSpecified = true;
                }

                if (atapiId.RecMDMACycleTime != 0)
                {
                    report.ATAPI.RecommendedMDMACycleTime          = atapiId.RecMDMACycleTime;
                    report.ATAPI.RecommendedMDMACycleTimeSpecified = true;
                }

                if (atapiId.RemovableStatusSet != 0)
                {
                    report.ATAPI.RemovableStatusSet          = atapiId.RemovableStatusSet;
                    report.ATAPI.RemovableStatusSetSpecified = true;
                }

                if (atapiId.SATACapabilities != 0)
                {
                    report.ATAPI.SATACapabilities          = atapiId.SATACapabilities;
                    report.ATAPI.SATACapabilitiesSpecified = true;
                }

                if (atapiId.SATACapabilities2 != 0)
                {
                    report.ATAPI.SATACapabilities2          = atapiId.SATACapabilities2;
                    report.ATAPI.SATACapabilities2Specified = true;
                }

                if (atapiId.SATAFeatures != 0)
                {
                    report.ATAPI.SATAFeatures          = atapiId.SATAFeatures;
                    report.ATAPI.SATAFeaturesSpecified = true;
                }

                if (atapiId.SCTCommandTransport != 0)
                {
                    report.ATAPI.SCTCommandTransport          = atapiId.SCTCommandTransport;
                    report.ATAPI.SCTCommandTransportSpecified = true;
                }

                if (atapiId.SectorsPerCard != 0)
                {
                    report.ATAPI.SectorsPerCard          = atapiId.SectorsPerCard;
                    report.ATAPI.SectorsPerCardSpecified = true;
                }

                if (atapiId.SecurityEraseTime != 0)
                {
                    report.ATAPI.SecurityEraseTime          = atapiId.SecurityEraseTime;
                    report.ATAPI.SecurityEraseTimeSpecified = true;
                }

                if (atapiId.SecurityStatus != 0)
                {
                    report.ATAPI.SecurityStatus          = atapiId.SecurityStatus;
                    report.ATAPI.SecurityStatusSpecified = true;
                }

                if (atapiId.ServiceBusyClear != 0)
                {
                    report.ATAPI.ServiceBusyClear          = atapiId.ServiceBusyClear;
                    report.ATAPI.ServiceBusyClearSpecified = true;
                }

                if (atapiId.SpecificConfiguration != 0)
                {
                    report.ATAPI.SpecificConfiguration          = atapiId.SpecificConfiguration;
                    report.ATAPI.SpecificConfigurationSpecified = true;
                }

                if (atapiId.StreamAccessLatency != 0)
                {
                    report.ATAPI.StreamAccessLatency          = atapiId.StreamAccessLatency;
                    report.ATAPI.StreamAccessLatencySpecified = true;
                }

                if (atapiId.StreamMinReqSize != 0)
                {
                    report.ATAPI.StreamMinReqSize          = atapiId.StreamMinReqSize;
                    report.ATAPI.StreamMinReqSizeSpecified = true;
                }

                if (atapiId.StreamPerformanceGranularity != 0)
                {
                    report.ATAPI.StreamPerformanceGranularity          = atapiId.StreamPerformanceGranularity;
                    report.ATAPI.StreamPerformanceGranularitySpecified = true;
                }

                if (atapiId.StreamTransferTimeDMA != 0)
                {
                    report.ATAPI.StreamTransferTimeDMA          = atapiId.StreamTransferTimeDMA;
                    report.ATAPI.StreamTransferTimeDMASpecified = true;
                }

                if (atapiId.StreamTransferTimePIO != 0)
                {
                    report.ATAPI.StreamTransferTimePIO          = atapiId.StreamTransferTimePIO;
                    report.ATAPI.StreamTransferTimePIOSpecified = true;
                }

                if (atapiId.TransportMajorVersion != 0)
                {
                    report.ATAPI.TransportMajorVersion          = atapiId.TransportMajorVersion;
                    report.ATAPI.TransportMajorVersionSpecified = true;
                }

                if (atapiId.TransportMinorVersion != 0)
                {
                    report.ATAPI.TransportMinorVersion          = atapiId.TransportMinorVersion;
                    report.ATAPI.TransportMinorVersionSpecified = true;
                }

                if (atapiId.TrustedComputing != 0)
                {
                    report.ATAPI.TrustedComputing          = atapiId.TrustedComputing;
                    report.ATAPI.TrustedComputingSpecified = true;
                }

                if (atapiId.UDMAActive != 0)
                {
                    report.ATAPI.UDMAActive          = atapiId.UDMAActive;
                    report.ATAPI.UDMAActiveSpecified = true;
                }

                if (atapiId.UDMASupported != 0)
                {
                    report.ATAPI.UDMASupported          = atapiId.UDMASupported;
                    report.ATAPI.UDMASupportedSpecified = true;
                }

                if (atapiId.WRVMode != 0)
                {
                    report.ATAPI.WRVMode          = atapiId.WRVMode;
                    report.ATAPI.WRVModeSpecified = true;
                }

                if (atapiId.WRVSectorCountMode3 != 0)
                {
                    report.ATAPI.WRVSectorCountMode3          = atapiId.WRVSectorCountMode3;
                    report.ATAPI.WRVSectorCountMode3Specified = true;
                }

                if (atapiId.WRVSectorCountMode2 != 0)
                {
                    report.ATAPI.WRVSectorCountMode2          = atapiId.WRVSectorCountMode2;
                    report.ATAPI.WRVSectorCountMode2Specified = true;
                }
            }

            if (debug)
            {
                report.ATAPI.Identify = buffer;
            }
        }
Example #6
0
        /// <summary>
        ///     Creates a device report for a SecureDigital or MultiMediaCard flash card
        /// </summary>
        /// <param name="dev">Device</param>
        /// <param name="report">Device report</param>
        public static void Report(Device dev, ref DeviceReport report)
        {
            if (report == null)
            {
                return;
            }

            switch (dev.Type)
            {
            case DeviceType.MMC:
                report.MultiMediaCard = new mmcsdType();
                break;

            case DeviceType.SecureDigital:
                report.SecureDigital = new mmcsdType();
                break;
            }

            DicConsole.WriteLine("Trying to get CID...");
            bool sense = dev.ReadCid(out byte[] cid, out _, dev.Timeout, out _);

            if (!sense)
            {
                DicConsole.WriteLine("CID obtained correctly...");

                switch (dev.Type)
                {
                case DeviceType.SecureDigital:
                    // Clear serial number and manufacturing date
                    cid[9]  = 0;
                    cid[10] = 0;
                    cid[11] = 0;
                    cid[12] = 0;
                    cid[13] = 0;
                    cid[14] = 0;
                    report.SecureDigital.CID = cid;
                    break;

                case DeviceType.MMC:
                    // Clear serial number and manufacturing date
                    cid[10] = 0;
                    cid[11] = 0;
                    cid[12] = 0;
                    cid[13] = 0;
                    cid[14] = 0;
                    report.MultiMediaCard.CID = cid;
                    break;
                }
            }
            else
            {
                DicConsole.WriteLine("Could not read CID...");
            }

            DicConsole.WriteLine("Trying to get CSD...");
            sense = dev.ReadCsd(out byte[] csd, out _, dev.Timeout, out _);

            if (!sense)
            {
                DicConsole.WriteLine("CSD obtained correctly...");

                switch (dev.Type)
                {
                case DeviceType.MMC:
                    report.MultiMediaCard.CSD = csd;
                    break;

                case DeviceType.SecureDigital:
                    report.SecureDigital.CSD = csd;
                    break;
                }
            }
            else
            {
                DicConsole.WriteLine("Could not read CSD...");
            }

            switch (dev.Type)
            {
            case DeviceType.MMC:
            {
                DicConsole.WriteLine("Trying to get OCR...");
                sense = dev.ReadOcr(out byte[] ocr, out _, dev.Timeout, out _);

                if (!sense)
                {
                    DicConsole.WriteLine("OCR obtained correctly...");
                    report.MultiMediaCard.OCR = ocr;
                }
                else
                {
                    DicConsole.WriteLine("Could not read OCR...");
                }

                DicConsole.WriteLine("Trying to get Extended CSD...");
                sense = dev.ReadExtendedCsd(out byte[] ecsd, out _, dev.Timeout, out _);

                if (!sense)
                {
                    DicConsole.WriteLine("Extended CSD obtained correctly...");
                    report.MultiMediaCard.ExtendedCSD = ecsd;
                }
                else
                {
                    DicConsole.WriteLine("Could not read Extended CSD...");
                }

                break;
            }

            case DeviceType.SecureDigital:
            {
                DicConsole.WriteLine("Trying to get OCR...");
                sense = dev.ReadSdocr(out byte[] ocr, out _, dev.Timeout, out _);

                if (!sense)
                {
                    DicConsole.WriteLine("OCR obtained correctly...");
                    report.SecureDigital.OCR = ocr;
                }
                else
                {
                    DicConsole.WriteLine("Could not read OCR...");
                }

                DicConsole.WriteLine("Trying to get SCR...");
                sense = dev.ReadScr(out byte[] scr, out _, dev.Timeout, out _);

                if (!sense)
                {
                    DicConsole.WriteLine("SCR obtained correctly...");
                    report.SecureDigital.SCR = scr;
                }
                else
                {
                    DicConsole.WriteLine("Could not read SCR...");
                }

                break;
            }
            }
        }