diff --git a/DiscImageChef.Devices/ChangeLog b/DiscImageChef.Devices/ChangeLog index 53753d3c6..1abe020cd 100644 --- a/DiscImageChef.Devices/ChangeLog +++ b/DiscImageChef.Devices/ChangeLog @@ -1,3 +1,9 @@ +2016-01-11 Natalia Portillo + + * Enums.cs: + * Device/ScsiCommands.cs: + Added Plextor vendor commands. + 2015-12-31 Natalia Portillo * Device/Variables.cs: diff --git a/DiscImageChef.Devices/Device/ScsiCommands.cs b/DiscImageChef.Devices/Device/ScsiCommands.cs index 7754ab464..b122277ca 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands.cs @@ -1623,6 +1623,401 @@ namespace DiscImageChef.Devices return sense; } + + /// + /// Reads the statistics EEPROM from Plextor CD recorders + /// + /// true, if EEPROM is correctly read, false otherwise. + /// Buffer. + /// Sense buffer. + /// Timeout. + /// Duration. + public bool PlextorReadEepromCDR(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + buffer = new byte[256]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom; + cdb[8] = 1; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration); + + return sense; + } + + /// + /// Reads the statistics EEPROM from Plextor PX-708 and PX-712 recorders + /// + /// true, if EEPROM is correctly read, false otherwise. + /// Buffer. + /// Sense buffer. + /// Timeout. + /// Duration. + public bool PlextorReadEeprom(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + buffer = new byte[512]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom; + cdb[8] = 2; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration); + + return sense; + } + + /// + /// Reads a block from the statistics EEPROM from Plextor DVD recorders + /// + /// true, if EEPROM is correctly read, false otherwise. + /// Buffer. + /// Sense buffer. + /// EEPROM block to read + /// 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) + { + buffer = new byte[blockSize]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom; + cdb[1] = 1; + cdb[7] = block; + cdb[8] = (byte)((blockSize & 0xFF00) >> 8); + cdb[9] = (byte)(blockSize & 0xFF); + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR READ EEPROM took {0} ms.", duration); + + return sense; + } + + /// + /// Gets speeds set by Plextor PoweRec + /// + /// true, if speeds were got correctly, false otherwise. + /// Sense buffer. + /// Selected write speed. + /// Max speed for currently inserted media. + /// Last actual speed. + /// Timeout. + /// Duration. + public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last, uint timeout, out double duration) + { + byte[] buf = new byte[10]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + selected = 0; + max = 0; + last = 0; + + cdb[0] = (byte)ScsiCommands.Plextor_PoweRec; + cdb[9] = (byte)buf.Length; + + lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration); + + if (!sense && !error) + { + BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; + selected = BigEndianBitConverter.ToUInt16(buf, 4); + max = BigEndianBitConverter.ToUInt16(buf, 6); + last = BigEndianBitConverter.ToUInt16(buf, 8); + } + + return sense; + } + + /// + /// Gets the Plextor PoweRec status + /// + /// true, if PoweRec is supported, false otherwise. + /// Sense buffer. + /// PoweRec is enabled. + /// PoweRec recommended speed. + /// Timeout. + /// Duration. + public bool PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, uint timeout, out double duration) + { + byte[] buf = new byte[8]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + enabled = false; + speed = 0; + + cdb[0] = (byte)ScsiCommands.Plextor_Extend2; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[9] = (byte)buf.Length; + + lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration); + + if (!sense && !error) + { + BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; + enabled = buf[2] != 0; + speed = BigEndianBitConverter.ToUInt16(buf, 4); + } + + return sense; + } + + /// + /// Gets the Plextor SilentMode status + /// + /// true, if SilentMode is supported, false otherwise. + /// Buffer. + /// Sense buffer. + /// Timeout. + /// Duration. + public bool PlextorGetSilentMode(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + buffer = new byte[8]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_Extend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.Silent; + cdb[3] = 4; + cdb[10] = (byte)buffer.Length; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SILENT MODE took {0} ms.", duration); + + return sense; + } + + /// + /// Gets the Plextor GigaRec status + /// + /// true, if GigaRec is supported, false otherwise. + /// Buffer. + /// Sense buffer. + /// Timeout. + /// Duration. + public bool PlextorGetGigaRec(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + buffer = new byte[8]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_Extend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.GigaRec; + cdb[10] = (byte)buffer.Length; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET GIGAREC took {0} ms.", duration); + + return sense; + } + + /// + /// Gets the Plextor VariRec status + /// + /// true, if VariRec is supported, false otherwise. + /// Buffer. + /// Sense buffer. + /// Timeout. + /// Duration. + public bool PlextorGetVariRec(out byte[] buffer, out byte[] senseBuffer, bool dvd, uint timeout, out double duration) + { + buffer = new byte[8]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_Extend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.VariRec; + cdb[10] = (byte)buffer.Length; + + if(dvd) + cdb[3] = 0x12; + else + cdb[3] = 0x02; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET VARIREC took {0} ms.", duration); + + return sense; + } + + /// + /// Gets the Plextor SecuRec status + /// + /// true, if SecuRec is supported, false otherwise. + /// Buffer. + /// Sense buffer. + /// Timeout. + /// Duration. + public bool PlextorGetSecuRec(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + buffer = new byte[8]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_Extend; + cdb[2] = (byte)PlextorSubCommands.SecuRec; + cdb[10] = (byte)buffer.Length; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SECUREC took {0} ms.", duration); + + return sense; + } + + /// + /// Gets the Plextor SpeedRead status + /// + /// true, if SpeedRead is supported, false otherwise. + /// Buffer. + /// Sense buffer. + /// Timeout. + /// Duration. + public bool PlextorGetSpeedRead(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + buffer = new byte[8]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_Extend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.SpeedRead; + cdb[10] = (byte)buffer.Length; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SPEEDREAD took {0} ms.", duration); + + return sense; + } + + /// + /// 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. + /// Timeout. + /// Duration. + public bool PlextorGetHiding(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + buffer = new byte[8]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_Extend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.SessionHide; + cdb[9] = (byte)buffer.Length; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET SINGLE-SESSION / HIDE CD-R took {0} ms.", duration); + + return sense; + } + + /// + /// Gets the Plextor DVD+ book bitsetting status + /// + /// true, if DVD+ book bitsetting is supported, false otherwise. + /// Buffer. + /// Sense buffer. + /// Timeout. + /// Duration. + public bool PlextorGetBitsetting(out byte[] buffer, out byte[] senseBuffer, bool dualLayer, uint timeout, out double duration) + { + buffer = new byte[8]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_Extend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.BitSet; + cdb[9] = (byte)buffer.Length; + + 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 sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET BOOK BITSETTING took {0} ms.", duration); + + return sense; + } + + /// + /// Gets the Plextor DVD+ test writing status + /// + /// true, if DVD+ test writing is supported, false otherwise. + /// Buffer. + /// Sense buffer. + /// Timeout. + /// Duration. + public bool PlextorGetTestWriteDvdPlus(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) + { + buffer = new byte[8]; + senseBuffer = new byte[32]; + byte[] cdb = new byte[12]; + bool sense; + + cdb[0] = (byte)ScsiCommands.Plextor_Extend; + cdb[1] = (byte)PlextorSubCommands.GetMode; + cdb[2] = (byte)PlextorSubCommands.TestWriteDvdPlus; + cdb[10] = (byte)buffer.Length; + + lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); + error = lastError != 0; + + DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR GET TEST WRITE DVD+ took {0} ms.", duration); + + return sense; + } } } diff --git a/DiscImageChef.Devices/Enums.cs b/DiscImageChef.Devices/Enums.cs index a71b26eae..7ebf7bf59 100644 --- a/DiscImageChef.Devices/Enums.cs +++ b/DiscImageChef.Devices/Enums.cs @@ -2567,6 +2567,14 @@ namespace DiscImageChef.Devices /// Plextor_Extend = 0xE9, /// + /// Command for Plextor PoweRec + /// + Plextor_PoweRec = 0xEB, + /// + /// Sends extended commands (like PoweRec) to Plextor drives + /// + Plextor_Extend2 = 0xED, + /// /// Resets Plextor drives /// Plextor_Reset = 0xEE, @@ -3169,5 +3177,67 @@ namespace DiscImageChef.Devices /// RawC2 = 0x08 } + + public enum PlextorSubCommands : byte + { + /// + /// Gets Plextor mode + /// + GetMode = 0x00, + /// + /// Sets Plextor mode + /// + SetMode = 0x10, + + /// + /// Plextor force single session or hide CD-R + /// + SessionHide = 0x01, + /// + /// Plextor VariRec + /// + VariRec = 0x02, + /// + /// Plextor GigaRec + /// + GigaRec = 0x04, + /// + /// Plextor accoustic management (disc related) + /// + SilentDisc = 0x06, + /// + /// Plextor accoustic management (tra related) + /// + SilentTray = 0x07, + /// + /// Plextor accoustic management + /// + Silent = 0x08, + /// + /// Plextor test write DVD+ + /// + TestWriteDvdPlus = 0x21, + /// + /// Plextor book setting + /// + BitSet = 0x22, + /// + /// Plextor SecuRec + /// + SecuRec = 0xD5, + + /// + /// Book setting for DVD+R + /// + BitSetR = 0x0A, + /// + /// Book setting for DVD+R DL + /// + BitSetRDL = 0x0E, + /// + /// Plextor SpeedRead + /// + SpeedRead = 0xBB + } } diff --git a/DiscImageChef/ChangeLog b/DiscImageChef/ChangeLog index 405d281bc..2905da0a1 100644 --- a/DiscImageChef/ChangeLog +++ b/DiscImageChef/ChangeLog @@ -1,3 +1,14 @@ +2016-01-11 Natalia Portillo + + * Plugins.cs: + * Commands/Analyze.cs: + * Commands/Compare.cs: + * Commands/CreateSidecar.cs: + Do not call system console directly. + + * Commands/DeviceInfo.cs: + Added Plextor vendor commands. + 2015-12-31 Natalia Portillo * Commands/CreateSidecar.cs: diff --git a/DiscImageChef/Commands/Analyze.cs b/DiscImageChef/Commands/Analyze.cs index 04323a6d1..3832ae6de 100644 --- a/DiscImageChef/Commands/Analyze.cs +++ b/DiscImageChef/Commands/Analyze.cs @@ -102,7 +102,7 @@ namespace DiscImageChef.Commands } catch (Exception ex) { - System.Console.Error.WriteLine("Unable to open image format"); + DicConsole.ErrorWriteLine("Unable to open image format"); DicConsole.ErrorWriteLine("Error: {0}", ex.Message); return; } diff --git a/DiscImageChef/Commands/Compare.cs b/DiscImageChef/Commands/Compare.cs index 195ade1db..95c869159 100644 --- a/DiscImageChef/Commands/Compare.cs +++ b/DiscImageChef/Commands/Compare.cs @@ -54,13 +54,13 @@ namespace DiscImageChef.Commands if (!System.IO.File.Exists(options.InputFile1)) { - System.Console.Error.WriteLine("Input file 1 does not exist."); + DicConsole.ErrorWriteLine("Input file 1 does not exist."); return; } if (!System.IO.File.Exists(options.InputFile2)) { - System.Console.Error.WriteLine("Input file 2 does not exist."); + DicConsole.ErrorWriteLine("Input file 2 does not exist."); return; } diff --git a/DiscImageChef/Commands/CreateSidecar.cs b/DiscImageChef/Commands/CreateSidecar.cs index 9bfe3d00f..1790acb66 100644 --- a/DiscImageChef/Commands/CreateSidecar.cs +++ b/DiscImageChef/Commands/CreateSidecar.cs @@ -88,7 +88,7 @@ namespace DiscImageChef.Commands } catch (Exception ex) { - System.Console.Error.WriteLine("Unable to open image format"); + DicConsole.ErrorWriteLine("Unable to open image format"); DicConsole.ErrorWriteLine("Error: {0}", ex.Message); return; } diff --git a/DiscImageChef/Commands/DeviceInfo.cs b/DiscImageChef/Commands/DeviceInfo.cs index 9b29fa0a1..200cfda07 100644 --- a/DiscImageChef/Commands/DeviceInfo.cs +++ b/DiscImageChef/Commands/DeviceInfo.cs @@ -888,6 +888,226 @@ namespace DiscImageChef.Commands */ } + #region Plextor + if(dev.Manufacturer == "PLEXTOR") + { + bool plxtSense = true; + bool plxtDvd = false; + byte[] plxtBuf = null; + + switch(dev.Model) + { + case "DVDR PX-708A": + case "DVDR PX-708A2": + case "DVDR PX-712A": + plxtDvd = true; + plxtSense = dev.PlextorReadEeprom(out plxtBuf, out senseBuf, dev.Timeout, out duration); + break; + case "DVDR PX-714A": + case "DVDR PX-716A": + case "DVDR PX-716AL": + case "DVDR PX-755A": + case "DVDR PX-760A": + { + byte[] plxtBufSmall; + plxtBuf = new byte[256 * 4]; + for(byte i = 0; i < 4; i++) + { + plxtSense = dev.PlextorReadEepromBlock(out plxtBufSmall, out senseBuf, i, 256, dev.Timeout, out duration); + if(plxtSense) + break; + Array.Copy(plxtBufSmall, 0, plxtBuf, i * 256, 256); + } + plxtDvd = true; + break; + } + default: + { + if(dev.Model.StartsWith("CD-R ")) + { + plxtSense = dev.PlextorReadEepromCDR(out plxtBuf, out senseBuf, dev.Timeout, out duration); + } + break; + } + } + + if (!plxtSense) + { + if(!string.IsNullOrEmpty(options.OutputPrefix)) + { + if (!File.Exists(options.OutputPrefix + "_plextor_eeprom.bin")) + { + try + { + DicConsole.DebugWriteLine("Device-Info command", "Writing PLEXTOR READ EEPROM to {0}{1}", options.OutputPrefix, "_plextor_eeprom.bin"); + outputFs = new FileStream(options.OutputPrefix +"_plextor_eeprom.bin", FileMode.CreateNew); + outputFs.Write(plxtBuf, 0, plxtBuf.Length); + outputFs.Close(); + } + catch + { + DicConsole.ErrorWriteLine("Unable to write file {0}{1}", options.OutputPrefix, "_plextor_eeprom.bin"); + } + } + else + DicConsole.ErrorWriteLine("Not overwriting file {0}{1}", options.OutputPrefix, "_plextor_eeprom.bin"); + } + + ushort discs; + uint cdReadTime, cdWriteTime, dvdReadTime = 0, dvdWriteTime = 0; + + BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; + if(plxtDvd) + { + discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0120); + cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0122); + cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0126); + dvdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012A); + dvdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x012E); + } + else + { + discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0078); + cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x006C); + cdWriteTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x007A); + } + + DicConsole.WriteLine("Drive has loaded a total of {0} discs", discs); + DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading CDs", + cdReadTime / 3600, (cdReadTime / 60) % 60, cdReadTime % 60); + DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing CDs", + cdWriteTime / 3600, (cdWriteTime / 60) % 60, cdWriteTime % 60); + if(plxtDvd) + { + DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading DVDs", + dvdReadTime / 3600, (dvdReadTime / 60) % 60, dvdReadTime % 60); + DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing DVDs", + dvdWriteTime / 3600, (dvdWriteTime / 60) % 60, dvdWriteTime % 60); + } + } + + bool plxtPwrRecEnabled; + ushort plxtPwrRecSpeed; + plxtSense = dev.PlextorGetPoweRec(out senseBuf, out plxtPwrRecEnabled, out plxtPwrRecSpeed, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.Write("Drive supports PoweRec"); + if(plxtPwrRecEnabled) + { + DicConsole.Write(", has it enabled"); + + if(plxtPwrRecSpeed > 0) + DicConsole.WriteLine(" and recommends {0} Kb/sec.", plxtPwrRecSpeed); + else + DicConsole.WriteLine("."); + + ushort plxtPwrRecSelected, plxtPwrRecMax, plxtPwrRecLast; + plxtSense = dev.PlextorGetSpeeds(out senseBuf, out plxtPwrRecSelected, out plxtPwrRecMax, out plxtPwrRecLast, dev.Timeout, out duration); + + if(!plxtSense) + { + if(plxtPwrRecSelected > 0) + DicConsole.WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", plxtPwrRecSelected, plxtPwrRecSelected/177); + if(plxtPwrRecMax > 0) + DicConsole.WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", plxtPwrRecMax, plxtPwrRecMax/177); + if(plxtPwrRecLast > 0) + DicConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)", plxtPwrRecLast, plxtPwrRecLast/177); + } + } + else + DicConsole.WriteLine("PoweRec is disabled"); + } + + // TODO: Check it with a drive + plxtSense = dev.PlextorGetSilentMode(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports Plextor SilentMode"); + if(plxtBuf[0] == 1) + { + DicConsole.WriteLine("Plextor SilentMode is enabled:"); + if(plxtBuf[1] == 2) + DicConsole.WriteLine("\tAccess time is slow"); + else + DicConsole.WriteLine("\tAccess time is fast"); + + if(plxtBuf[2] > 0) + DicConsole.WriteLine("\tCD read speed limited to {0}x", plxtBuf[2]); + if(plxtBuf[3] > 0 && plxtDvd) + DicConsole.WriteLine("\tDVD read speed limited to {0}x", plxtBuf[3]); + if(plxtBuf[4] > 0) + DicConsole.WriteLine("\tCD write speed limited to {0}x", plxtBuf[4]); + if(plxtBuf[6] > 0) + DicConsole.WriteLine("\tTray eject speed limited to {0}", -(plxtBuf[6] + 48)); + if(plxtBuf[7] > 0) + DicConsole.WriteLine("\tTray eject speed limited to {0}", plxtBuf[7] - 47); + } + } + + plxtSense = dev.PlextorGetGigaRec(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports Plextor GigaRec"); + // TODO: Pretty print it + } + + plxtSense = dev.PlextorGetSecuRec(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports Plextor SecuRec"); + // TODO: Pretty print it + } + + plxtSense = dev.PlextorGetSpeedRead(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.Write("Drive supports Plextor SpeedRead"); + if((plxtBuf[2] & 0x01) == 0x01) + DicConsole.WriteLine("and has it enabled"); + else + DicConsole.WriteLine(); + } + + plxtSense = dev.PlextorGetHiding(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports hiding CD-Rs and forcing single session"); + + if((plxtBuf[2] & 0x02) == 0x02) + DicConsole.WriteLine("Drive currently hides CD-Rs"); + if((plxtBuf[2] & 0x01) == 0x01) + DicConsole.WriteLine("Drive currently forces single session"); + } + + plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, false, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports Plextor VariRec"); + // TODO: Pretty print it + } + + if(plxtDvd) + { + plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, true, dev.Timeout, out duration); + if(!plxtSense) + { + DicConsole.WriteLine("Drive supports Plextor VariRec for DVDs"); + // TODO: Pretty print it + } + + plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, false, dev.Timeout, out duration); + if(!plxtSense) + DicConsole.WriteLine("Drive supports bitsetting DVD+R book type"); + plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, true, dev.Timeout, out duration); + if(!plxtSense) + DicConsole.WriteLine("Drive supports bitsetting DVD+R DL book type"); + plxtSense = dev.PlextorGetTestWriteDvdPlus(out plxtBuf, out senseBuf, dev.Timeout, out duration); + if(!plxtSense) + DicConsole.WriteLine("Drive supports test writing DVD+"); + } + } + #endregion Plextor + break; } default: diff --git a/DiscImageChef/Plugins.cs b/DiscImageChef/Plugins.cs index 59a777411..ac00fbfd5 100644 --- a/DiscImageChef/Plugins.cs +++ b/DiscImageChef/Plugins.cs @@ -42,6 +42,7 @@ using System.Reflection; using DiscImageChef.ImagePlugins; using DiscImageChef.PartPlugins; using DiscImageChef.Plugins; +using DiscImageChef.Console; namespace DiscImageChef { @@ -76,7 +77,7 @@ namespace DiscImageChef } catch (Exception exception) { - System.Console.Error.WriteLine(exception); + DicConsole.ErrorWriteLine("Exception {0}", exception); } } @@ -94,7 +95,7 @@ namespace DiscImageChef } catch (Exception exception) { - System.Console.Error.WriteLine(exception); + DicConsole.ErrorWriteLine("Exception {0}", exception); } } @@ -112,7 +113,7 @@ namespace DiscImageChef } catch (Exception exception) { - System.Console.Error.WriteLine(exception); + DicConsole.ErrorWriteLine("Exception {0}", exception); } } }