diff --git a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs index 3f9d81a64..3d4ccff54 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs @@ -439,7 +439,10 @@ namespace DiscImageChef.Devices Error = LastError != 0; - DicConsole.DebugWriteLine("SCSI Device", "READ CD took {0} ms.", duration); + DicConsole.DebugWriteLine("SCSI Device", + "READ CD (LBA: {1}, Block Size: {2}, Transfer Length: {3}, Expected Sector Type: {4}, DAP: {5}, Relative Address: {6}, Sync: {7}, Headers: {8}, User Data: {9}, ECC/EDC: {10}, C2: {11}, Subchannel: {12}, Sense: {13}, Last Error: {14}) took {0} ms.", + duration, lba, blockSize, transferLength, expectedSectorType, dap, relAddr, sync, + headerCodes, userData, edcEcc, c2Error, subchannel, sense, LastError); return sense; } diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs index f664b71c1..63a3e61b7 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs @@ -36,9 +36,7 @@ namespace DiscImageChef.Devices { public partial class Device { - /// - /// Sends the Plextor READ CD-DA command - /// + /// Sends the Plextor READ CD-DA command /// true if the command failed and contains the sense buffer. /// Buffer where the Plextor READ CD-DA response will be stored /// Sense buffer. @@ -48,8 +46,8 @@ namespace DiscImageChef.Devices /// How many blocks to read. /// Block size. /// Subchannel selection. - public bool PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, - uint transferLength, PlextorSubchannel subchannel, uint timeout, + public bool PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, + uint transferLength, PlextorSubchannel subchannel, uint timeout, out double duration) { senseBuffer = new byte[32]; @@ -70,16 +68,17 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; - DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration); + DicConsole.DebugWriteLine("SCSI Device", + "Plextor READ CD-DA (LBA: {1}, Block Size: {2}, Transfer Length: {3}, Subchannel: {4}, Sense: {5}, Last Error: {6}) took {0} ms.", + duration, lba, blockSize, transferLength, subchannel, sense, LastError); return sense; } - /// - /// Reads a "raw" sector from DVD on Plextor drives. Does it reading drive's cache. - /// + /// Reads a "raw" sector from DVD on Plextor drives. Does it reading drive's cache. /// true if the command failed and contains the sense buffer. /// Buffer where the Plextor READ DVD (RAW) response will be stored /// Sense buffer. @@ -87,8 +86,8 @@ namespace DiscImageChef.Devices /// Duration in milliseconds it took for the device to execute the command. /// Start block address. /// How many blocks to read. - public bool PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, - uint timeout, out double duration) + public bool PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, + uint timeout, out double duration) { senseBuffer = new byte[32]; byte[] cdb = new byte[10]; @@ -105,6 +104,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "Plextor READ DVD (RAW) took {0} ms.", duration); @@ -112,9 +112,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Reads the statistics EEPROM from Plextor CD recorders - /// + /// Reads the statistics EEPROM from Plextor CD recorders /// true, if EEPROM is correctly read, false otherwise. /// Buffer. /// Sense buffer. @@ -131,6 +129,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration); @@ -138,9 +137,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Reads the statistics EEPROM from Plextor PX-708 and PX-712 recorders - /// + /// Reads the statistics EEPROM from Plextor PX-708 and PX-712 recorders /// true, if EEPROM is correctly read, false otherwise. /// Buffer. /// Sense buffer. @@ -157,6 +154,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration); @@ -164,9 +162,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Reads a block from the statistics EEPROM from Plextor DVD recorders - /// + /// Reads a block from the statistics EEPROM from Plextor DVD recorders /// true, if EEPROM is correctly read, false otherwise. /// Buffer. /// Sense buffer. @@ -174,8 +170,8 @@ namespace DiscImageChef.Devices /// How many bytes are in the EEPROM block /// Timeout. /// Duration. - public bool PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, byte block, ushort blockSize, - uint timeout, out double duration) + public bool PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, byte block, ushort blockSize, + uint timeout, out double duration) { buffer = new byte[blockSize]; senseBuffer = new byte[32]; @@ -189,6 +185,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration); @@ -196,9 +193,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Gets speeds set by Plextor PoweRec - /// + /// Gets speeds set by Plextor PoweRec /// true, if speeds were got correctly, false otherwise. /// Sense buffer. /// Selected write speed. @@ -207,7 +202,7 @@ namespace DiscImageChef.Devices /// Timeout. /// Duration. public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last, - uint timeout, out double duration) + uint timeout, out double duration) { byte[] buf = new byte[10]; senseBuffer = new byte[32]; @@ -222,11 +217,13 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration); - if(sense || Error) return sense; + if(sense || Error) + return sense; selected = BigEndianBitConverter.ToUInt16(buf, 4); max = BigEndianBitConverter.ToUInt16(buf, 6); @@ -235,9 +232,7 @@ namespace DiscImageChef.Devices return false; } - /// - /// Gets the Plextor PoweRec status - /// + /// Gets the Plextor PoweRec status /// true, if PoweRec is supported, false otherwise. /// Sense buffer. /// PoweRec is enabled. @@ -260,11 +255,13 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration); - if(sense || Error) return sense; + if(sense || Error) + return sense; enabled = buf[2] != 0; speed = BigEndianBitConverter.ToUInt16(buf, 4); @@ -272,9 +269,7 @@ namespace DiscImageChef.Devices return false; } - /// - /// Gets the Plextor SilentMode status - /// + /// Gets the Plextor SilentMode status /// true, if SilentMode is supported, false otherwise. /// Buffer. /// Sense buffer. @@ -294,6 +289,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SILENT MODE took {0} ms.", duration); @@ -301,9 +297,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Gets the Plextor GigaRec status - /// + /// Gets the Plextor GigaRec status /// true, if GigaRec is supported, false otherwise. /// Buffer. /// Sense buffer. @@ -322,6 +316,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET GIGAREC took {0} ms.", duration); @@ -329,9 +324,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Gets the Plextor VariRec status - /// + /// Gets the Plextor VariRec status /// true, if VariRec is supported, false otherwise. /// Buffer. /// Sense buffer. @@ -350,11 +343,14 @@ namespace DiscImageChef.Devices cdb[2] = (byte)PlextorSubCommands.VariRec; cdb[10] = (byte)buffer.Length; - if(dvd) cdb[3] = 0x12; - else cdb[3] = 0x02; + if(dvd) + cdb[3] = 0x12; + else + cdb[3] = 0x02; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET VARIREC took {0} ms.", duration); @@ -362,9 +358,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Gets the Plextor SecuRec status - /// + /// Gets the Plextor SecuRec status /// true, if SecuRec is supported, false otherwise. /// Buffer. /// Sense buffer. @@ -382,6 +376,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SECUREC took {0} ms.", duration); @@ -389,9 +384,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Gets the Plextor SpeedRead status - /// + /// Gets the Plextor SpeedRead status /// true, if SpeedRead is supported, false otherwise. /// Buffer. /// Sense buffer. @@ -410,6 +403,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SPEEDREAD took {0} ms.", duration); @@ -417,9 +411,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Gets the Plextor CD-R and multi-session hiding status - /// + /// Gets the Plextor CD-R and multi-session hiding status /// true, if CD-R and multi-session hiding is supported, false otherwise. /// Buffer. /// Sense buffer. @@ -438,6 +430,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SINGLE-SESSION / HIDE CD-R took {0} ms.", duration); @@ -445,9 +438,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Gets the Plextor DVD+ book bitsetting status - /// + /// Gets the Plextor DVD+ book bitsetting status /// true, if DVD+ book bitsetting is supported, false otherwise. /// Buffer. /// Sense buffer. @@ -466,11 +457,14 @@ namespace DiscImageChef.Devices cdb[2] = (byte)PlextorSubCommands.BitSet; cdb[9] = (byte)buffer.Length; - if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRdl; - else cdb[3] = (byte)PlextorSubCommands.BitSetR; + if(dualLayer) + cdb[3] = (byte)PlextorSubCommands.BitSetRdl; + else + cdb[3] = (byte)PlextorSubCommands.BitSetR; LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET BOOK BITSETTING took {0} ms.", duration); @@ -478,9 +472,7 @@ namespace DiscImageChef.Devices return sense; } - /// - /// Gets the Plextor DVD+ test writing status - /// + /// Gets the Plextor DVD+ test writing status /// true, if DVD+ test writing is supported, false otherwise. /// Buffer. /// Sense buffer. @@ -500,6 +492,7 @@ namespace DiscImageChef.Devices LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out bool sense); + Error = LastError != 0; DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET TEST WRITE DVD+ took {0} ms.", duration);