2017-09-07 20:30:23 +01:00
|
|
|
|
// /***************************************************************************
|
2020-07-25 02:01:36 +01:00
|
|
|
|
// Aaru Data Preservation Suite
|
2017-09-07 20:30:23 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : Command.cs
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
2017-09-07 20:30:23 +01:00
|
|
|
|
//
|
2020-07-25 02:01:36 +01:00
|
|
|
|
// Component : Aaru 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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2022-02-18 10:02:53 +00:00
|
|
|
|
// Copyright © 2011-2022 Natalia Portillo
|
2017-09-07 20:30:23 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-12-19 03:50:57 +00:00
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
namespace Aaru.Tests.Devices;
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-07-09 04:08:39 +01:00
|
|
|
|
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.Console;
|
|
|
|
|
|
using Aaru.Devices;
|
2017-09-07 20:30:23 +01:00
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
static partial class MainClass
|
2017-09-07 20:30:23 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
public static void Command(string devPath, Device dev)
|
2017-09-07 20:30:23 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
while(true)
|
2017-09-07 20:30:23 +01:00
|
|
|
|
{
|
2022-03-07 07:36:44 +00:00
|
|
|
|
Console.Clear();
|
2022-03-06 13:29:38 +00:00
|
|
|
|
AaruConsole.WriteLine("Device: {0}", devPath);
|
|
|
|
|
|
AaruConsole.WriteLine("Send a command to the device:");
|
|
|
|
|
|
AaruConsole.WriteLine("1.- Send a SCSI command.");
|
|
|
|
|
|
AaruConsole.WriteLine("2.- Send an ATA command.");
|
|
|
|
|
|
AaruConsole.WriteLine("3.- Send a SecureDigital/MultiMediaCard command.");
|
|
|
|
|
|
AaruConsole.WriteLine("4.- Send a NVMe command.");
|
2020-07-09 04:08:39 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
|
|
|
|
|
|
AaruConsole.WriteLine("5.- Send a special sequence of commands for SCSI Multimedia devices.");
|
2020-07-09 04:08:39 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
AaruConsole.WriteLine("0.- Return to device menu.");
|
|
|
|
|
|
AaruConsole.Write("Choose: ");
|
2017-09-07 20:30:23 +01:00
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
string strDev = Console.ReadLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!int.TryParse(strDev, out int item))
|
|
|
|
|
|
{
|
|
|
|
|
|
AaruConsole.WriteLine("Not a number. Press any key to continue...");
|
2022-03-07 07:36:44 +00:00
|
|
|
|
Console.ReadKey();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2017-09-07 20:30:23 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
switch(item)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
AaruConsole.WriteLine("Returning to device menu...");
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
Scsi(devPath, dev);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
Ata(devPath, dev);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
SecureDigital(devPath, dev);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
NVMe(devPath, dev);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
case 5 when dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice:
|
|
|
|
|
|
ScsiMmc.Menu(devPath, dev);
|
2020-07-09 04:08:39 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
continue;
|
2020-07-09 04:08:39 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
default:
|
|
|
|
|
|
AaruConsole.WriteLine("Incorrect option. Press any key to continue...");
|
2022-03-07 07:36:44 +00:00
|
|
|
|
Console.ReadKey();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
continue;
|
2017-09-07 20:30:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|