// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // Filename : Atapi.cs // Author(s) : Natalia Portillo // // Component : ATA commands. // // --[ Description ] ---------------------------------------------------------- // // Contains ATAPI commands. // // --[ License ] -------------------------------------------------------------- // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 2.1 of the // License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, see . // // ---------------------------------------------------------------------------- // Copyright © 2011-2018 Natalia Portillo // ****************************************************************************/ using DiscImageChef.Console; using DiscImageChef.Decoders.ATA; namespace DiscImageChef.Devices { public partial class Device { /// /// Sends the ATA IDENTIFY PACKET DEVICE command to the device, using default device timeout /// /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. public bool AtapiIdentify(out byte[] buffer, out AtaErrorRegistersChs statusRegisters) { return AtapiIdentify(out buffer, out statusRegisters, Timeout); } /// /// Sends the ATA IDENTIFY PACKET DEVICE command to the device, using default device timeout /// /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. /// Duration. public bool AtapiIdentify(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, out double duration) { return AtapiIdentify(out buffer, out statusRegisters, Timeout, out duration); } /// /// Sends the ATA IDENTIFY PACKET DEVICE command to the device /// /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. /// Timeout. public bool AtapiIdentify(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, uint timeout) { double duration; return AtapiIdentify(out buffer, out statusRegisters, timeout, out duration); } /// /// Sends the ATA IDENTIFY PACKET DEVICE command to the device /// /// true if the command failed and contains the error registers. /// Buffer. /// Status registers. /// Timeout. /// Duration. public bool AtapiIdentify(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration) { buffer = new byte[512]; AtaRegistersChs registers = new AtaRegistersChs(); bool sense; registers.Command = (byte)AtaCommands.IdentifyPacketDevice; LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn, AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration, out sense); Error = LastError != 0; DicConsole.DebugWriteLine("ATA Device", "IDENTIFY PACKET DEVICE took {0} ms.", duration); return sense; } } }