2017-09-07 20:30:23 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : Plextor.cs
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
2017-09-07 20:30:23 +01:00
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : DiscImageChef device testing.
|
2017-09-07 20:30:23 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program 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 General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2017-09-07 20:30:23 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-12-19 03:50:57 +00:00
|
|
|
|
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using System;
|
2017-09-07 20:30:23 +01:00
|
|
|
|
using DiscImageChef.Console;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using DiscImageChef.Decoders.SCSI;
|
2017-09-07 20:30:23 +01:00
|
|
|
|
using DiscImageChef.Devices;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Tests.Devices.SCSI
|
|
|
|
|
|
{
|
2017-12-20 02:08:37 +00:00
|
|
|
|
static class Plextor
|
2017-09-07 20:30:23 +01:00
|
|
|
|
{
|
2017-12-20 02:08:37 +00:00
|
|
|
|
internal static void Menu(string devPath, Device dev)
|
2017-09-07 20:30:23 +01:00
|
|
|
|
{
|
|
|
|
|
|
while(true)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Send a Plextor vendor command to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Send GET BOOK BITSETTING command.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Send GET GIGAREC command.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Send GET SECUREC command.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send GET SILENT MODE command.");
|
|
|
|
|
|
DicConsole.WriteLine("5.- Send GET SINGLE-SESSION / HIDE CD-R command.");
|
|
|
|
|
|
DicConsole.WriteLine("6.- Send GET SPEEDREAD command.");
|
|
|
|
|
|
DicConsole.WriteLine("7.- Send GET TEST WRITE DVD+ command.");
|
|
|
|
|
|
DicConsole.WriteLine("8.- Send GET VARIREC command.");
|
|
|
|
|
|
DicConsole.WriteLine("9.- Send POWEREC GET SPEEDS command.");
|
|
|
|
|
|
DicConsole.WriteLine("10.- Send READ CD-DA command.");
|
|
|
|
|
|
DicConsole.WriteLine("11.- Send READ DVD (RAW) command.");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("12.- Send READ EEPROM (CD recorders) command.");
|
|
|
|
|
|
DicConsole.WriteLine("13.- Send READ EEPROM (DVD recorders) command.");
|
|
|
|
|
|
DicConsole.WriteLine("14.- Send READ EEPROM (PX-708 and PX-712) command.");
|
2017-09-07 20:30:23 +01:00
|
|
|
|
DicConsole.WriteLine("0.- Return to SCSI commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to SCSI commands menu...");
|
|
|
|
|
|
return;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
case 1:
|
|
|
|
|
|
GetBookBitsetting(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
GetGigaRec(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
GetSecuRec(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
GetSilentMode(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
GetSingleSessionHideCdR(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 6:
|
|
|
|
|
|
GetSpeedRead(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 7:
|
|
|
|
|
|
GetTestWriteDvdPlus(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 8:
|
|
|
|
|
|
GetVariRec(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 9:
|
|
|
|
|
|
PoweRecGetSpeeds(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 10:
|
|
|
|
|
|
ReadCdDa(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 11:
|
|
|
|
|
|
ReadDvdRaw(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 12:
|
|
|
|
|
|
ReadEepromCdR(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 13:
|
|
|
|
|
|
ReadEeprom(devPath, dev);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
case 14:
|
|
|
|
|
|
ReadEepromBlock(devPath, dev);
|
|
|
|
|
|
continue;
|
2017-09-07 20:30:23 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
|
|
|
|
|
static void GetBookBitsetting(string devPath, Device dev)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool dl = false;
|
|
|
|
|
|
string strDev;
|
|
|
|
|
|
int item;
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
parameters:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
while(true)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Parameters for GET BOOK BITSETTING command:");
|
|
|
|
|
|
DicConsole.WriteLine("Dual layer?: {0}", dl);
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Send command with these parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
DicConsole.Write("Dual layer?: ");
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!bool.TryParse(strDev, out dl))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a boolean. Press any key to continue...");
|
|
|
|
|
|
dl = false;
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
break;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 2: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorGetBitsetting(out byte[] buffer, out byte[] senseBuffer, dl, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending GET BOOK BITSETTING to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("5.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET BOOK BITSETTING response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET BOOK BITSETTING sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET BOOK BITSETTING decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
|
|
|
|
|
case 5: goto parameters;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void GetGigaRec(string devPath, Device dev)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorGetGigaRec(out byte[] buffer, out byte[] senseBuffer, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending GET GIGAREC to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET GIGAREC response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET GIGAREC sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET GIGAREC decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void GetSecuRec(string devPath, Device dev)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorGetSecuRec(out byte[] buffer, out byte[] senseBuffer, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending GET SECUREC to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SECUREC response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SECUREC sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SECUREC decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void GetSilentMode(string devPath, Device dev)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorGetSilentMode(out byte[] buffer, out byte[] senseBuffer, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending GET SILENT MODE to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SILENT MODE response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SILENT MODE sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SILENT MODE decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void GetSingleSessionHideCdR(string devPath, Device dev)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorGetHiding(out byte[] buffer, out byte[] senseBuffer, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending GET SINGLE-SESSION / HIDE CD-R to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SINGLE-SESSION / HIDE CD-R response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SINGLE-SESSION / HIDE CD-R sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SINGLE-SESSION / HIDE CD-R decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void GetSpeedRead(string devPath, Device dev)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorGetSpeedRead(out byte[] buffer, out byte[] senseBuffer, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending GET SPEEDREAD to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SPEEDREAD response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SPEEDREAD sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET SPEEDREAD decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void GetTestWriteDvdPlus(string devPath, Device dev)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense =
|
|
|
|
|
|
dev.PlextorGetTestWriteDvdPlus(out byte[] buffer, out byte[] senseBuffer, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending GET TEST WRITE DVD+ to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET TEST WRITE DVD+ response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET TEST WRITE DVD+ sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET TEST WRITE DVD+ decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void GetVariRec(string devPath, Device dev)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool dvd = false;
|
|
|
|
|
|
string strDev;
|
|
|
|
|
|
int item;
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
parameters:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
while(true)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Parameters for GET VARIREC command:");
|
|
|
|
|
|
DicConsole.WriteLine("DVD?: {0}", dvd);
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Send command with these parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
DicConsole.Write("DVD?: ");
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!bool.TryParse(strDev, out dvd))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a boolean. Press any key to continue...");
|
|
|
|
|
|
dvd = false;
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
break;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 2: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorGetVariRec(out byte[] buffer, out byte[] senseBuffer, dvd, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending GET VARIREC to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("5.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET VARIREC response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET VARIREC sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("GET VARIREC decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
|
|
|
|
|
case 5: goto parameters;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void PoweRecGetSpeeds(string devPath, Device dev)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending POWEREC GET SPEEDS to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
|
|
|
|
|
DicConsole.WriteLine("PoweRec is {0}.", enabled ? "enabled" : "disabled");
|
|
|
|
|
|
DicConsole.WriteLine("Speed: {0}", speed);
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine("POWEREC GET SPEEDS decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("POWEREC GET SPEEDS sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 2: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void ReadCdDa(string devPath, Device dev)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint address = 0;
|
|
|
|
|
|
uint length = 1;
|
|
|
|
|
|
PlextorSubchannel subchan = PlextorSubchannel.None;
|
|
|
|
|
|
uint blockSize = 2352;
|
|
|
|
|
|
string strDev;
|
|
|
|
|
|
int item;
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
parameters:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
while(true)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Parameters for READ CD-DA command:");
|
|
|
|
|
|
DicConsole.WriteLine("LBA: {0}", address);
|
|
|
|
|
|
DicConsole.WriteLine("Will transfer {0} sectors", length);
|
|
|
|
|
|
DicConsole.WriteLine("Subchannel mode: {0}", subchan);
|
|
|
|
|
|
DicConsole.WriteLine("{0} bytes per sectors", blockSize);
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Send command with these parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
DicConsole.Write("Logical Block Address?: ");
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!uint.TryParse(strDev, out address))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
address = 0;
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.Write("How many sectors to transfer?: ");
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!uint.TryParse(strDev, out length))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
length = 1;
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Subchannel mode");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4}", PlextorSubchannel.None,
|
|
|
|
|
|
PlextorSubchannel.Q16, PlextorSubchannel.All, PlextorSubchannel.Pack,
|
|
|
|
|
|
PlextorSubchannel.RawC2);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.Write("Choose?: ");
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(!Enum.TryParse(strDev, true, out subchan))
|
2017-09-09 18:47:18 +01:00
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a correct subchannel mode. Press any key to continue...");
|
|
|
|
|
|
subchan = PlextorSubchannel.None;
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
switch(subchan)
|
|
|
|
|
|
{
|
|
|
|
|
|
case PlextorSubchannel.Q16:
|
|
|
|
|
|
blockSize = 2368;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case PlextorSubchannel.Pack:
|
|
|
|
|
|
case PlextorSubchannel.All:
|
|
|
|
|
|
blockSize = 2448;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case PlextorSubchannel.RawC2:
|
|
|
|
|
|
blockSize = 2742;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
blockSize = 2352;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
break;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 2: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, address, blockSize, length,
|
|
|
|
|
|
subchan, dev.Timeout, out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending READ CD-DA to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("5.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ CD-DA response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ CD-DA sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ CD-DA decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
|
|
|
|
|
case 5: goto parameters;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void ReadDvdRaw(string devPath, Device dev)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint count = 1;
|
|
|
|
|
|
uint lba = 0;
|
|
|
|
|
|
string strDev;
|
|
|
|
|
|
int item;
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
parameters:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
while(true)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Parameters for READ DVD (RAW) command:");
|
|
|
|
|
|
DicConsole.WriteLine("LBA: {0}", lba);
|
|
|
|
|
|
DicConsole.WriteLine("Count: {0}", count);
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Send command with these parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
DicConsole.Write("How many sectors?: ");
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!uint.TryParse(strDev, out count))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a numbr. Press any key to continue...");
|
|
|
|
|
|
count = 1;
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.Write("LBA?: ");
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!uint.TryParse(strDev, out lba))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
lba = 0;
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
break;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 2: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorReadRawDvd(out byte[] buffer, out byte[] senseBuffer, lba, count, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending READ DVD (RAW) to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("5.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ DVD (RAW) response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ DVD (RAW) sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ DVD (RAW) decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
|
|
|
|
|
case 5: goto parameters;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void ReadEepromCdR(string devPath, Device dev)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-20 17:15:26 +00:00
|
|
|
|
bool sense = dev.PlextorReadEepromCdr(out byte[] buffer, out byte[] senseBuffer, dev.Timeout,
|
2017-12-19 20:33:03 +00:00
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending READ EEPROM to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ EEPROM response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ EEPROM sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ EEPROM decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void ReadEepromBlock(string devPath, Device dev)
|
|
|
|
|
|
{
|
|
|
|
|
|
byte block = 0;
|
|
|
|
|
|
ushort blockSize = 256;
|
|
|
|
|
|
string strDev;
|
|
|
|
|
|
int item;
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
parameters:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
while(true)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Parameters for READ EEPROM command:");
|
|
|
|
|
|
DicConsole.WriteLine("EEPROM block to read: {0}", block);
|
|
|
|
|
|
DicConsole.WriteLine("EEPROM block size: {0}", blockSize);
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Send command with these parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
DicConsole.Write("EEPROM block to read?: ");
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!byte.TryParse(strDev, out block))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
block = 0;
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.Write("EEPROM block size?: ");
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!ushort.TryParse(strDev, out blockSize))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
blockSize = 0;
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-09-09 18:47:18 +01:00
|
|
|
|
break;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 2: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorReadEepromBlock(out byte[] buffer, out byte[] senseBuffer, block, blockSize,
|
|
|
|
|
|
dev.Timeout, out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending READ EEPROM to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("5.- Change parameters.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ EEPROM response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ EEPROM sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ EEPROM decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
|
|
|
|
|
case 5: goto parameters;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void ReadEeprom(string devPath, Device dev)
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
start:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
System.Console.Clear();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bool sense = dev.PlextorReadEeprom(out byte[] buffer, out byte[] senseBuffer, dev.Timeout,
|
|
|
|
|
|
out double duration);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
menu:
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("Sending READ EEPROM to the device:");
|
|
|
|
|
|
DicConsole.WriteLine("Command took {0} ms.", duration);
|
|
|
|
|
|
DicConsole.WriteLine("Sense is {0}.", sense);
|
2017-12-22 22:31:01 +00:00
|
|
|
|
DicConsole.WriteLine("Buffer is {0} bytes.", buffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
2017-12-24 04:01:36 +00:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer?.Length.ToString() ?? "null");
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
|
|
|
|
|
DicConsole.WriteLine();
|
|
|
|
|
|
DicConsole.WriteLine("Choose what to do:");
|
|
|
|
|
|
DicConsole.WriteLine("1.- Print buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("2.- Print sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("3.- Decode sense buffer.");
|
|
|
|
|
|
DicConsole.WriteLine("4.- Send command again.");
|
|
|
|
|
|
DicConsole.WriteLine("0.- Return to Plextor vendor commands menu.");
|
|
|
|
|
|
DicConsole.Write("Choose: ");
|
|
|
|
|
|
|
|
|
|
|
|
string strDev = System.Console.ReadLine();
|
|
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole.WriteLine("Not a number. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
DicConsole.WriteLine("Returning to Plextor vendor commands menu...");
|
|
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ EEPROM response:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ EEPROM sense:");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
DicConsole.WriteLine("READ EEPROM decoded sense:");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
DicConsole.Write("{0}", Sense.PrettifySense(senseBuffer));
|
2017-09-09 18:47:18 +01:00
|
|
|
|
DicConsole.WriteLine("Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
DicConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
goto menu;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
case 4: goto start;
|
2017-09-09 18:47:18 +01:00
|
|
|
|
default:
|
|
|
|
|
|
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
|
|
|
|
|
System.Console.ReadKey();
|
|
|
|
|
|
System.Console.Clear();
|
|
|
|
|
|
goto menu;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-09-07 20:30:23 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|