2016-01-11 19:40:58 +00:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : Plextor.cs
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
2016-01-11 19:40:58 +00:00
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Component : Plextor vendor commands.
|
2016-01-11 19:40:58 +00:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Contains vendor commands for Plextor SCSI devices.
|
2016-01-11 19:40:58 +00:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
2016-01-11 19:40:58 +00:00
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
// Lesser General Public License for more details.
|
2016-01-11 19:40:58 +00:00
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2016-01-11 19:40:58 +00:00
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Copyright © 2011-2016 Natalia Portillo
|
2016-01-11 19:40:58 +00:00
|
|
|
|
// ****************************************************************************/
|
2016-07-28 18:13:49 +01:00
|
|
|
|
|
2016-01-11 19:40:58 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using DiscImageChef.Console;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Devices
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class Device
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Sends the Plextor READ CD-DA command
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer where the Plextor READ CD-DA response will be stored</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout in seconds.</param>
|
|
|
|
|
|
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
|
|
|
|
|
/// <param name="lba">Start block address.</param>
|
|
|
|
|
|
/// <param name="transferLength">How many blocks to read.</param>
|
|
|
|
|
|
/// <param name="blockSize">Block size.</param>
|
|
|
|
|
|
/// <param name="subchannel">Subchannel selection.</param>
|
* DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs:
* DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj:
Added method to calculate MediaType from SCSI parameters
(mode, density, medium type, device type, etc).
* DiscImageChef.Metadata/DeviceReport.cs:
Added command to guess drive and media parameters and output
an XML report of them.
* DiscImageChef/Commands/DeviceReport.cs:
* DiscImageChef.Metadata/DiscImageChef.Metadata.csproj:
Added command to guess drive and media parameters and output
an XML report of them.
* DiscImageChef/Commands/DumpMedia.cs:
Added preliminary command to dump media. Only SCSI for now.
CDs and tapes are not supported. Errors are blalanty
ignored. Options are incomplete. Not yet usable.
* DiscImageChef/Core/Checksum.cs:
* DiscImageChef/Commands/CreateSidecar.cs:
Moved checksum generation to a separate class.
* CICMMetadata:
Added support for ADIP.
* DiscImageChef.CommonTypes/MediaType.cs:
Added parameters of UDO media.
Moved DataPlay outside of Iomega, as it's not from that
manufacturer.
Added missing Exatape media and corrected 160m XL one.
Added SyJet media.
Added all ECMA defined magneto-optical (sectors calculated
from specifications, unchecked).
Added PD media.
Added Imation 320Gb RDX.
Added generic USB flash drives.
* DiscImageChef.Decoders/SCSI/Enums.cs:
Make enumerations public.
* DiscImageChef.Decoders/SCSI/Inquiry.cs:
* DiscImageChef.Devices/Device/Constructor.cs:
Trim space padded strings on SCSI INQUIRY.
* DiscImageChef.Devices/Device/ScsiCommands/MMC.cs:
Added PREVENT ALLOW MEDIUM REMOVAL.
Added START STOP UNIT.
* DiscImageChef.Devices/Device/ScsiCommands/NEC.cs:
Rename NEC methods.
* DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs:
Corrected Pioneer transfer length calculation.
* DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs:
Renamed Plextor methods.
* DiscImageChef.Devices/Device/ScsiCommands/SPC.cs:
Renamed SSC PREVENT ALLOW MEDIUM REMOVAL to uncollide with
MMC same name but different command.
* DiscImageChef.Devices/DiscImageChef.Devices.csproj:
Set platform target to x86 (does it really matter?).
* DiscImageChef.Devices/Linux/Command.cs:
Reduced allocation for readlink() to current kernel
MAX_PATH.
* DiscImageChef.Devices/Linux/Enums.cs:
Modified Linux ioctl to 32-bit. Works on 64-bit also. Solves
commands not working on 32-bit environments.
* DiscImageChef.DiscImages/ZZZRawImage.cs:
Changed ECMA-184 and ECMA-183 enums.
* DiscImageChef.Metadata/Dimensions.cs:
Added all ECMA defined magneto-opticals.
Added PD media.
Added 320Gb RDX.
Corrected Exatape 160m XL.
Added Exatape 22m and 28m.
* DiscImageChef.Metadata/MediaType.cs:
Added 356mm magneto-optical media.
Changed ECMA-184 and ECMA-183 enums.
Added USB generic flash drive.
* DiscImageChef/Commands/DeviceInfo.cs:
Corrected SCSI INQUIRY naming.
Corrected SCSI MODE SENSE (6) parameters.
Reduced SCSI MODE SENSE timeout, some devices just get stuck
with unsupported MODE SENSE commanda and must be left to
timeout.
Changed FUJITSU vendor string comparison.
* DiscImageChef/Commands/MediaInfo.cs:
Added method to calculate MediaType from SCSI parameters
(mode, density, medium type, device type, etc).
Changed some error WriteLine() to debug ones. Too much
verbosity.
Added DVD media type decoding from PFI.
Found a drive that dumps ADIP, enabling it again (not
decoded).
* DiscImageChef/Commands/MediaScan.cs:
Added option to generate ImgBurn compatible log to
media-scan command.
* DiscImageChef/DiscImageChef.csproj:
Moved checksum generation to a separate class.
Added command to guess drive and media parameters and output
an XML report of them.
Added preliminary command to dump media. Only SCSI for now.
CDs and tapes are not supported. Errors are blalanty
ignored. Options are incomplete. Not yet usable.
* DiscImageChef/Main.cs:
Added command to guess drive and media parameters and output
an XML report of them.
Added preliminary command to dump media. Only SCSI for now.
CDs and tapes are not supported. Errors are blalanty
ignored. Options are incomplete. Not yet usable.
* DiscImageChef/Options.cs:
Added command to guess drive and media parameters and output
an XML report of them.
Added preliminary command to dump media. Only SCSI for now.
CDs and tapes are not supported. Errors are blalanty
ignored. Options are incomplete. Not yet usable.
Added option to generate ImgBurn compatible log to media-scan
command.
2016-01-31 08:05:56 +00:00
|
|
|
|
public bool PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, PlextorSubchannel subchannel, uint timeout, out double duration)
|
2016-01-11 19:40:58 +00:00
|
|
|
|
{
|
|
|
|
|
|
senseBuffer = new byte[32];
|
|
|
|
|
|
byte[] cdb = new byte[12];
|
|
|
|
|
|
bool sense;
|
|
|
|
|
|
|
|
|
|
|
|
cdb[0] = (byte)ScsiCommands.ReadCdDa;
|
|
|
|
|
|
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
|
|
|
|
|
|
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
|
|
|
|
|
|
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
|
|
|
|
|
cdb[5] = (byte)(lba & 0xFF);
|
|
|
|
|
|
cdb[6] = (byte)((transferLength & 0xFF000000) >> 24);
|
|
|
|
|
|
cdb[7] = (byte)((transferLength & 0xFF0000) >> 16);
|
|
|
|
|
|
cdb[8] = (byte)((transferLength & 0xFF00) >> 8);
|
|
|
|
|
|
cdb[9] = (byte)(transferLength & 0xFF);
|
|
|
|
|
|
cdb[10] = (byte)subchannel;
|
|
|
|
|
|
|
|
|
|
|
|
buffer = new byte[blockSize * transferLength];
|
|
|
|
|
|
|
|
|
|
|
|
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
|
|
|
|
|
error = lastError != 0;
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.DebugWriteLine("SCSI Device", "READ CD-DA took {0} ms.", duration);
|
|
|
|
|
|
|
|
|
|
|
|
return sense;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Reads a "raw" sector from DVD on Plextor drives. Does it reading drive's cache.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer"/> contains the sense buffer.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer where the Plextor READ DVD (RAW) response will be stored</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout in seconds.</param>
|
|
|
|
|
|
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
|
|
|
|
|
/// <param name="lba">Start block address.</param>
|
|
|
|
|
|
/// <param name="transferLength">How many blocks to read.</param>
|
|
|
|
|
|
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];
|
|
|
|
|
|
buffer = new byte[2064 * transferLength];
|
|
|
|
|
|
bool sense;
|
|
|
|
|
|
|
|
|
|
|
|
cdb[0] = (byte)ScsiCommands.ReadBuffer;
|
|
|
|
|
|
cdb[1] = 0x02;
|
|
|
|
|
|
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
|
|
|
|
|
|
cdb[4] = (byte)((lba & 0xFF00) >> 8);
|
|
|
|
|
|
cdb[5] = (byte)(lba & 0xFF);
|
|
|
|
|
|
cdb[3] = (byte)((buffer.Length & 0xFF0000) >> 16);
|
|
|
|
|
|
cdb[4] = (byte)((buffer.Length & 0xFF00) >> 8);
|
|
|
|
|
|
cdb[5] = (byte)(buffer.Length & 0xFF);
|
|
|
|
|
|
|
|
|
|
|
|
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
|
|
|
|
|
error = lastError != 0;
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.DebugWriteLine("SCSI Device", "Plextor READ DVD (RAW) took {0} ms.", duration);
|
|
|
|
|
|
|
|
|
|
|
|
return sense;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Reads the statistics EEPROM from Plextor CD recorders
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if EEPROM is correctly read, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Reads the statistics EEPROM from Plextor PX-708 and PX-712 recorders
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if EEPROM is correctly read, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Reads a block from the statistics EEPROM from Plextor DVD recorders
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if EEPROM is correctly read, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="block">EEPROM block to read</param>
|
|
|
|
|
|
/// <param name="blockSize">How many bytes are in the EEPROM block</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets speeds set by Plextor PoweRec
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if speeds were got correctly, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="selected">Selected write speed.</param>
|
|
|
|
|
|
/// <param name="max">Max speed for currently inserted media.</param>
|
|
|
|
|
|
/// <param name="last">Last actual speed.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
if(!sense && !error)
|
2016-01-11 19:40:58 +00:00
|
|
|
|
{
|
|
|
|
|
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
|
|
|
|
|
selected = BigEndianBitConverter.ToUInt16(buf, 4);
|
|
|
|
|
|
max = BigEndianBitConverter.ToUInt16(buf, 6);
|
|
|
|
|
|
last = BigEndianBitConverter.ToUInt16(buf, 8);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return sense;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the Plextor PoweRec status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if PoweRec is supported, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="enabled">PoweRec is enabled.</param>
|
|
|
|
|
|
/// <param name="speed">PoweRec recommended speed.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
if(!sense && !error)
|
2016-01-11 19:40:58 +00:00
|
|
|
|
{
|
|
|
|
|
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
|
|
|
|
|
enabled = buf[2] != 0;
|
|
|
|
|
|
speed = BigEndianBitConverter.ToUInt16(buf, 4);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return sense;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the Plextor SilentMode status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if SilentMode is supported, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the Plextor GigaRec status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if GigaRec is supported, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the Plextor VariRec status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if VariRec is supported, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the Plextor SecuRec status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if SecuRec is supported, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the Plextor SpeedRead status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if SpeedRead is supported, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the Plextor CD-R and multi-session hiding status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if CD-R and multi-session hiding is supported, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the Plextor DVD+ book bitsetting status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if DVD+ book bitsetting is supported, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the Plextor DVD+ test writing status
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns><c>true</c>, if DVD+ test writing is supported, <c>false</c> otherwise.</returns>
|
|
|
|
|
|
/// <param name="buffer">Buffer.</param>
|
|
|
|
|
|
/// <param name="senseBuffer">Sense buffer.</param>
|
|
|
|
|
|
/// <param name="timeout">Timeout.</param>
|
|
|
|
|
|
/// <param name="duration">Duration.</param>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|