Added manual test subapplication for device commands.

This commit is contained in:
2017-09-07 20:30:23 +01:00
parent 95e0d3f596
commit be736496fa
37 changed files with 3186 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Ata28.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using DiscImageChef.Console;
using DiscImageChef.Devices;
namespace DiscImageChef.Tests.Devices.ATA
{
public static class Ata28
{
public static void Menu(string devPath, Device dev)
{
while(true)
{
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
DicConsole.WriteLine("Send a 28-bit ATA command to the device:");
DicConsole.WriteLine("1.- Send READ BUFFER command.");
DicConsole.WriteLine("2.- Send READ BUFFER DMA command.");
DicConsole.WriteLine("3.- Send READ DMA command.");
DicConsole.WriteLine("4.- Send READ DMA WITH RETRIES command.");
DicConsole.WriteLine("5.- Send READ LONG command.");
DicConsole.WriteLine("6.- Send READ LONG WITH RETRIES command.");
DicConsole.WriteLine("7.- Send READ MULTIPLE command.");
DicConsole.WriteLine("8.- Send READ NATIVE MAX ADDRESS command.");
DicConsole.WriteLine("9.- Send READ SECTORS WITH RETRIES command.");
DicConsole.WriteLine("10.- Send SEEK command.");
DicConsole.WriteLine("0.- Return to ATA 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 ATA commands menu...");
return;
default:
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
System.Console.ReadKey();
continue;
}
}
}
}
}

View File

@@ -0,0 +1,84 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Ata48.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using DiscImageChef.Console;
using DiscImageChef.Devices;
namespace DiscImageChef.Tests.Devices.ATA
{
public static class Ata48
{
public static void Menu(string devPath, Device dev)
{
while(true)
{
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
DicConsole.WriteLine("Send a 48-bit ATA command to the device:");
DicConsole.WriteLine("1.- Send GET NATIVE MAX ADDRESS EXT command.");
DicConsole.WriteLine("2.- Send READ DMA EXT command.");
DicConsole.WriteLine("3.- Send READ LOG DMA EXT command.");
DicConsole.WriteLine("4.- Send READ LOG EXT command.");
DicConsole.WriteLine("5.- Send READ MATIVE MAX ADDRESS EXT command.");
DicConsole.WriteLine("6.- Send READ MULTIPLE EXT command.");
DicConsole.WriteLine("7.- Send READ SECTORS EXT command.");
DicConsole.WriteLine("0.- Return to ATA 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 ATA commands menu...");
return;
default:
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
System.Console.ReadKey();
continue;
}
}
}
}
}

View File

@@ -0,0 +1,86 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : AtaCHS.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using DiscImageChef.Console;
using DiscImageChef.Devices;
namespace DiscImageChef.Tests.Devices.ATA
{
public static class AtaCHS
{
public static void Menu(string devPath, Device dev)
{
while(true)
{
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
DicConsole.WriteLine("Send a CHS ATA command to the device:");
DicConsole.WriteLine("1.- Send IDENTIFY DEVICE command.");
DicConsole.WriteLine("2.- Send READ DMA command.");
DicConsole.WriteLine("3.- Send READ DMA WITH RETRIES command.");
DicConsole.WriteLine("4.- Send READ LONG command.");
DicConsole.WriteLine("5.- Send READ LONG WITH RETRIES command.");
DicConsole.WriteLine("6.- Send READ MULTIPLE command.");
DicConsole.WriteLine("7.- Send READ SECTORS command.");
DicConsole.WriteLine("8.- Send READ SECTORS WITH RETRIES command.");
DicConsole.WriteLine("9.- Send SEEK command.");
DicConsole.WriteLine("0.- Return to ATA 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 ATA commands menu...");
return;
default:
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
System.Console.ReadKey();
continue;
}
}
}
}
}

View File

@@ -0,0 +1,161 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Atapi.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using DiscImageChef.Console;
using DiscImageChef.Devices;
using DiscImageChef.Decoders.ATA;
using System.Threading;
namespace DiscImageChef.Tests.Devices.ATA
{
public static class Atapi
{
public static void Menu(string devPath, Device dev)
{
while(true)
{
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
DicConsole.WriteLine("Send an ATAPI command to the device:");
DicConsole.WriteLine("1.- Send IDENTIFY PACKET DEVICE command.");
DicConsole.WriteLine("0.- Return to ATA 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 ATA commands menu...");
return;
case 1:
Identify(devPath, dev);
continue;
default:
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
System.Console.ReadKey();
continue;
}
}
}
public static void Identify(string devPath, Device dev)
{
start:
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
DicConsole.WriteLine("Sending IDENTIFY PACKET DEVICE to the device:");
bool sense = dev.AtapiIdentify(out byte[] buffer, out AtaErrorRegistersCHS errorRegisters, out double duration);
menu:
DicConsole.WriteLine("Command took {0} ms.", duration);
DicConsole.WriteLine("Sense is {0}.", sense);
DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString());
DicConsole.WriteLine();
DicConsole.WriteLine("Choose what to do:");
DicConsole.WriteLine("1.- Print buffer.");
DicConsole.WriteLine("2.- Decode buffer.");
DicConsole.WriteLine("3.- Decode error registers.");
DicConsole.WriteLine("4.- Send command again.");
DicConsole.WriteLine("0.- Return to ATAPI 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 ATAPI commands menu...");
return;
case 1:
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
DicConsole.WriteLine("IDENTIFY PACKET DEVICE response:");
if(buffer != null)
PrintHex.PrintHexArray(buffer, 64);
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("IDENTIFY PACKET DEVICE decoded response:");
if(buffer != null)
DicConsole.WriteLine("{0}", Decoders.ATA.Identify.Prettify(buffer));
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("IDENTIFY PACKET DEVICE status registers:");
DicConsole.Write("{0}", MainClass.DecodeATARegisters(errorRegisters));
DicConsole.WriteLine("Press any key to continue...");
System.Console.ReadKey();
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
goto menu;
case 4:
goto start;
default:
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
System.Console.ReadKey();
System.Console.Clear();
goto menu;
}
}
}
}

View File

@@ -0,0 +1,79 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Cfa.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using DiscImageChef.Console;
using DiscImageChef.Devices;
namespace DiscImageChef.Tests.Devices.ATA
{
public static class Cfa
{
public static void Menu(string devPath, Device dev)
{
while(true)
{
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
DicConsole.WriteLine("Send a CompactFlash command to the device:");
DicConsole.WriteLine("1.- Send REQUEST EXTENDED ERROR CODE command.");
DicConsole.WriteLine("2.- Send TRANSLATE SECTOR command.");
DicConsole.WriteLine("0.- Return to ATA 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 ATA commands menu...");
return;
default:
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
System.Console.ReadKey();
continue;
}
}
}
}
}

View File

@@ -0,0 +1,78 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : MCPT.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using DiscImageChef.Console;
using DiscImageChef.Devices;
namespace DiscImageChef.Tests.Devices.ATA
{
public static class MCPT
{
public static void Menu(string devPath, Device dev)
{
while(true)
{
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
DicConsole.WriteLine("Send a Media Card Pass Through command to the device:");
DicConsole.WriteLine("1.- Send CHECK MEDIA CARD TYPE command.");
DicConsole.WriteLine("0.- Return to ATA 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 ATA commands menu...");
return;
default:
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
System.Console.ReadKey();
continue;
}
}
}
}
}

View File

@@ -0,0 +1,84 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Smart.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using DiscImageChef.Console;
using DiscImageChef.Devices;
namespace DiscImageChef.Tests.Devices.ATA
{
public static class Smart
{
public static void Menu(string devPath, Device dev)
{
while(true)
{
System.Console.Clear();
DicConsole.WriteLine("Device: {0}", devPath);
DicConsole.WriteLine("Send a S.M.A.R.T. command to the device:");
DicConsole.WriteLine("1.- Send DISABLE OPERATIONS command.");
DicConsole.WriteLine("2.- Send ENABLE ATTRIBUTE AUTOSAVE command.");
DicConsole.WriteLine("3.- Send ENABLE OPERATIONS command.");
DicConsole.WriteLine("4.- Send EXECUTE OFF-LINE IMMEDIATE command.");
DicConsole.WriteLine("5.- Send READ DATA command.");
DicConsole.WriteLine("6.- Send READ LOG command.");
DicConsole.WriteLine("7.- Send RETURN STATUS command.");
DicConsole.WriteLine("0.- Return to ATA 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 ATA commands menu...");
return;
default:
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
System.Console.ReadKey();
continue;
}
}
}
}
}