mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add XML comments to public entities.
This commit is contained in:
@@ -46,26 +46,37 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Archives
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public sealed class Register : IPluginRegister
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllChecksumPlugins() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllFilesystemPlugins() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllFilterPlugins() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllFloppyImagePlugins() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllMediaImagePlugins() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllPartitionPlugins() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllReadOnlyFilesystemPlugins() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllWritableFloppyImagePlugins() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllWritableImagePlugins() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetAllArchivePlugins() => Assembly.GetExecutingAssembly().GetTypes().
|
||||
Where(t => t.GetInterfaces().
|
||||
Contains(typeof(IArchive
|
||||
|
||||
Submodule Aaru.Checksums updated: b7f3192eff...8ca59cbcd0
Submodule Aaru.CommonTypes updated: 433bed2145...fb6e3cf361
@@ -35,6 +35,9 @@ using System.IO;
|
||||
|
||||
namespace Aaru.Compression
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the Apple version of RLE
|
||||
/// </summary>
|
||||
public class AppleRle
|
||||
{
|
||||
const uint DART_CHUNK = 20960;
|
||||
@@ -45,6 +48,10 @@ namespace Aaru.Compression
|
||||
byte _repeatedByteA, _repeatedByteB;
|
||||
bool _repeatMode; // true if we're repeating, false if we're just copying
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a decompressor for the specified stream
|
||||
/// </summary>
|
||||
/// <param name="stream">Stream containing the compressed data</param>
|
||||
public AppleRle(Stream stream)
|
||||
{
|
||||
_inStream = stream;
|
||||
@@ -59,6 +66,10 @@ namespace Aaru.Compression
|
||||
_repeatMode = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decompresses a byte
|
||||
/// </summary>
|
||||
/// <returns>Decompressed byte</returns>
|
||||
public int ProduceByte()
|
||||
{
|
||||
if(_repeatMode && _count > 0)
|
||||
|
||||
@@ -53,6 +53,9 @@ namespace Aaru.Compression
|
||||
* Adaptive Huffman Coding coded by Haruyasu YOSHIZAKI
|
||||
* Edited and translated to English by Kenji RIKITAKE
|
||||
*/
|
||||
/// <summary>
|
||||
/// Implements the TeleDisk version of LZH
|
||||
/// </summary>
|
||||
public class TeleDiskLzh
|
||||
{
|
||||
const int BUFSZ = 512;
|
||||
@@ -133,6 +136,10 @@ namespace Aaru.Compression
|
||||
|
||||
Tdlzhuf _tdctl;
|
||||
|
||||
/// <summary>
|
||||
/// Implements the TeleDisk LZH algorithm over the specified stream.
|
||||
/// </summary>
|
||||
/// <param name="dataStream">Stream with compressed data.</param>
|
||||
public TeleDiskLzh(Stream dataStream)
|
||||
{
|
||||
int i;
|
||||
@@ -156,6 +163,12 @@ namespace Aaru.Compression
|
||||
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Decompresses data
|
||||
/// </summary>
|
||||
/// <param name="buf">Buffer to write the decompressed data to</param>
|
||||
/// <param name="len">Number of bytes to decompress</param>
|
||||
/// <returns>Number of decompressed bytes</returns>
|
||||
public int Decode(out byte[] buf, int len) /* Decoding/Uncompressing */
|
||||
{
|
||||
short c;
|
||||
|
||||
Submodule Aaru.Console updated: 75db40d0e3...dc0e013d8d
@@ -39,18 +39,68 @@ using Schemas;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Enabled checksums
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum EnableChecksum
|
||||
{
|
||||
Adler32 = 1, Crc16 = 2, Crc32 = 4,
|
||||
Crc64 = 8, Md5 = 16, Sha1 = 64,
|
||||
Sha256 = 128, Sha384 = 256, Sha512 = 512,
|
||||
SpamSum = 1024, Fletcher16 = 2048, Fletcher32 = 4096,
|
||||
/// <summary>
|
||||
/// Enables Adler-32
|
||||
/// </summary>
|
||||
Adler32 = 1,
|
||||
/// <summary>
|
||||
/// Enables CRC-16
|
||||
/// </summary>
|
||||
Crc16 = 2,
|
||||
/// <summary>
|
||||
/// Enables CRC-32
|
||||
/// </summary>
|
||||
Crc32 = 4,
|
||||
/// <summary>
|
||||
/// Enables CRC-64
|
||||
/// </summary>
|
||||
Crc64 = 8,
|
||||
/// <summary>
|
||||
/// Enables MD5
|
||||
/// </summary>
|
||||
Md5 = 16,
|
||||
/// <summary>
|
||||
/// Enables SHA1
|
||||
/// </summary>
|
||||
Sha1 = 64,
|
||||
/// <summary>
|
||||
/// Enables SHA2-256
|
||||
/// </summary>
|
||||
Sha256 = 128,
|
||||
/// <summary>
|
||||
/// Enables SHA2-384
|
||||
/// </summary>
|
||||
Sha384 = 256,
|
||||
/// <summary>
|
||||
/// Enables SHA2-512
|
||||
/// </summary>
|
||||
Sha512 = 512,
|
||||
/// <summary>
|
||||
/// Enables SpamSum
|
||||
/// </summary>
|
||||
SpamSum = 1024,
|
||||
/// <summary>
|
||||
/// Enables Fletcher-16
|
||||
/// </summary>
|
||||
Fletcher16 = 2048,
|
||||
/// <summary>
|
||||
/// Enables Fletcher-32
|
||||
/// </summary>
|
||||
Fletcher32 = 4096,
|
||||
/// <summary>
|
||||
/// Enables all known checksums
|
||||
/// </summary>
|
||||
All = Adler32 | Crc16 | Crc32 | Crc64 | Md5 | Sha1 | Sha256 | Sha384 | Sha512 | SpamSum | Fletcher16 |
|
||||
Fletcher32
|
||||
}
|
||||
|
||||
/// <summary>Checksums and hashes data, with different algorithms multithreaded</summary>
|
||||
/// <summary>Checksums and hashes data, with different algorithms, multithreaded</summary>
|
||||
public sealed class Checksum
|
||||
{
|
||||
readonly IChecksum _adler32Ctx;
|
||||
@@ -91,6 +141,10 @@ namespace Aaru.Core
|
||||
HashPacket _spamsumPkt;
|
||||
Thread _spamsumThread;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance of the checksum operations
|
||||
/// </summary>
|
||||
/// <param name="enabled">Enabled checksums</param>
|
||||
public Checksum(EnableChecksum enabled = EnableChecksum.All)
|
||||
{
|
||||
_enabled = enabled;
|
||||
@@ -229,6 +283,10 @@ namespace Aaru.Core
|
||||
_f32Thread = new Thread(UpdateHash);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the checksum with new data
|
||||
/// </summary>
|
||||
/// <param name="data">New data</param>
|
||||
public void Update(byte[] data)
|
||||
{
|
||||
if(_enabled.HasFlag(EnableChecksum.Adler32))
|
||||
@@ -353,6 +411,10 @@ namespace Aaru.Core
|
||||
_f32Thread = new Thread(UpdateHash);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finishes the checksums
|
||||
/// </summary>
|
||||
/// <returns>Returns the checksum results</returns>
|
||||
public List<ChecksumType> End()
|
||||
{
|
||||
List<ChecksumType> chks = new List<ChecksumType>();
|
||||
|
||||
@@ -48,10 +48,19 @@ using Schemas;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping
|
||||
{
|
||||
/// <summary>Subchannel requested to dump</summary>
|
||||
public enum DumpSubchannel
|
||||
{
|
||||
Any, Rw, RwOrPq,
|
||||
Pq, None
|
||||
/// <summary>Any available subchannel, in order: raw P to W, PQ, none</summary>
|
||||
Any,
|
||||
/// <summary>Raw P to W</summary>
|
||||
Rw,
|
||||
/// <summary>Raw P to W or PQ if not possible</summary>
|
||||
RwOrPq,
|
||||
/// <summary>PQ</summary>
|
||||
Pq,
|
||||
/// <summary>None</summary>
|
||||
None
|
||||
}
|
||||
|
||||
public partial class Dump
|
||||
@@ -266,6 +275,9 @@ namespace Aaru.Core.Devices.Dumping
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aborts the dump in progress
|
||||
/// </summary>
|
||||
public void Abort()
|
||||
{
|
||||
_aborted = true;
|
||||
|
||||
@@ -36,6 +36,9 @@ namespace Aaru.Core.Devices.Dumping
|
||||
{
|
||||
public partial class Dump
|
||||
{
|
||||
/// <summary>
|
||||
/// Dumps an NVMe device
|
||||
/// </summary>
|
||||
public void NVMe() => StoppingErrorMessage?.Invoke("NVMe devices not yet supported.");
|
||||
}
|
||||
}
|
||||
@@ -47,8 +47,15 @@ using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
|
||||
|
||||
namespace Aaru.Core.Devices.Info
|
||||
{
|
||||
/// <summary>
|
||||
/// Obtains and contains information about a device
|
||||
/// </summary>
|
||||
public partial class DeviceInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes an instance of this class for the specified device
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
public DeviceInfo(Device dev)
|
||||
{
|
||||
Type = dev.Type;
|
||||
|
||||
@@ -32,38 +32,134 @@
|
||||
|
||||
namespace Aaru.Core.Devices.Info
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains information about Plextor features
|
||||
/// </summary>
|
||||
public class Plextor
|
||||
{
|
||||
/// <summary>
|
||||
/// Access time limit
|
||||
/// </summary>
|
||||
public byte AccessTimeLimit;
|
||||
/// <summary>
|
||||
/// Drive supports setting book type bit for DVD+R
|
||||
/// </summary>
|
||||
public bool BitSetting;
|
||||
/// <summary>
|
||||
/// Drive supports setting book type bit for DVD+R DL
|
||||
/// </summary>
|
||||
public bool BitSettingDl;
|
||||
/// <summary>
|
||||
/// CD read speed limit
|
||||
/// </summary>
|
||||
public byte CdReadSpeedLimit;
|
||||
/// <summary>
|
||||
/// Time drive has spent reading CDs
|
||||
/// </summary>
|
||||
public uint CdReadTime;
|
||||
/// <summary>
|
||||
/// CD write speed limit
|
||||
/// </summary>
|
||||
public byte CdWriteSpeedLimit;
|
||||
/// <summary>
|
||||
/// Time drive has spent writing CDs
|
||||
/// </summary>
|
||||
public uint CdWriteTime;
|
||||
/// <summary>
|
||||
/// Total number of loaded discs
|
||||
/// </summary>
|
||||
public ushort Discs;
|
||||
/// <summary>
|
||||
/// Drive supports test writing DVD+
|
||||
/// </summary>
|
||||
public bool DvdPlusWriteTest;
|
||||
/// <summary>
|
||||
/// DVD read limit
|
||||
/// </summary>
|
||||
public byte DvdReadSpeedLimit;
|
||||
/// <summary>
|
||||
/// Time drive has spent reading DVDs
|
||||
/// </summary>
|
||||
public uint DvdReadTime;
|
||||
/// <summary>
|
||||
/// Time drive has spent writing DVDs
|
||||
/// </summary>
|
||||
public uint DvdWriteTime;
|
||||
/// <summary>
|
||||
/// Raw contents of EEPROM
|
||||
/// </summary>
|
||||
public byte[] Eeprom;
|
||||
/// <summary>
|
||||
/// Drive supports GigaRec
|
||||
/// </summary>
|
||||
public bool GigaRec;
|
||||
/// <summary>
|
||||
/// Drive will show recordable CDs as embossed
|
||||
/// </summary>
|
||||
public bool HidesRecordables;
|
||||
/// <summary>
|
||||
/// Drive will hide sessions
|
||||
/// </summary>
|
||||
public bool HidesSessions;
|
||||
/// <summary>
|
||||
/// Drive supports hiding recordable CDs and sessions
|
||||
/// </summary>
|
||||
public bool Hiding;
|
||||
/// <summary>
|
||||
/// Drive is a DVD capable drive
|
||||
/// </summary>
|
||||
public bool IsDvd;
|
||||
/// <summary>
|
||||
/// Drive supports PoweRec
|
||||
/// </summary>
|
||||
public bool PoweRec;
|
||||
/// <summary>
|
||||
/// Drive has PoweRec enabled
|
||||
/// </summary>
|
||||
public bool PoweRecEnabled;
|
||||
/// <summary>
|
||||
/// Last used PoweRec in KiB/sec
|
||||
/// </summary>
|
||||
public ushort PoweRecLast;
|
||||
/// <summary>
|
||||
/// Maximum supported PoweRec for currently inserted media in KiB/sec
|
||||
/// </summary>
|
||||
public ushort PoweRecMax;
|
||||
/// <summary>
|
||||
/// Recommended supported PoweRec for currently inserted media in KiB/sec
|
||||
/// </summary>
|
||||
public ushort PoweRecRecommendedSpeed;
|
||||
/// <summary>
|
||||
/// Selected supported PoweRec for currently inserted media in KiB/sec
|
||||
/// </summary>
|
||||
public ushort PoweRecSelected;
|
||||
/// <summary>
|
||||
/// Drive supports SecuRec
|
||||
/// </summary>
|
||||
public bool SecuRec;
|
||||
/// <summary>
|
||||
/// Drive supports SilentMode
|
||||
/// </summary>
|
||||
public bool SilentMode;
|
||||
/// <summary>
|
||||
/// Drive has SilentMode enabled
|
||||
/// </summary>
|
||||
public bool SilentModeEnabled;
|
||||
/// <summary>
|
||||
/// Drive supports SpeedRead
|
||||
/// </summary>
|
||||
public bool SpeedRead;
|
||||
/// <summary>
|
||||
/// Drive has SpeedRead enabled
|
||||
/// </summary>
|
||||
public bool SpeedReadEnabled;
|
||||
/// <summary>
|
||||
/// Drive supports VariRec
|
||||
/// </summary>
|
||||
public bool VariRec;
|
||||
/// <summary>
|
||||
/// Drive supports VariRec for DVDs
|
||||
/// </summary>
|
||||
public bool VariRecDvd;
|
||||
}
|
||||
}
|
||||
@@ -44,51 +44,189 @@ namespace Aaru.Core.Devices.Info
|
||||
{
|
||||
public partial class DeviceInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Raw IDENTIFY DEVICE response
|
||||
/// </summary>
|
||||
public byte[] AtaIdentify { get; }
|
||||
/// <summary>
|
||||
/// Raw IDENTIFY PACKET DEVICE response
|
||||
/// </summary>
|
||||
public byte[] AtapiIdentify { get; }
|
||||
/// <summary>
|
||||
/// Raw INQUIRY response
|
||||
/// </summary>
|
||||
public byte[] ScsiInquiryData { get; }
|
||||
/// <summary>
|
||||
/// Decoded INQUIRY response
|
||||
/// </summary>
|
||||
public Inquiry? ScsiInquiry { get; }
|
||||
/// <summary>
|
||||
/// Response for ATA Memory Card Pass Through
|
||||
/// </summary>
|
||||
public AtaErrorRegistersChs? AtaMcptError { get; }
|
||||
/// <summary>
|
||||
/// List of raw EVPD page indexed by page number
|
||||
/// </summary>
|
||||
public Dictionary<byte, byte[]> ScsiEvpdPages { get; }
|
||||
/// <summary>
|
||||
/// Decoded MODE SENSE response
|
||||
/// </summary>
|
||||
public Modes.DecodedMode? ScsiMode { get; }
|
||||
/// <summary>
|
||||
/// Raw MODE SENSE(6) response
|
||||
/// </summary>
|
||||
public byte[] ScsiModeSense6 { get; }
|
||||
/// <summary>
|
||||
/// Raw MODE SENSE(10) response
|
||||
/// </summary>
|
||||
public byte[] ScsiModeSense10 { get; }
|
||||
/// <summary>
|
||||
/// Raw GET CONFIGURATION response
|
||||
/// </summary>
|
||||
public byte[] MmcConfiguration { get; }
|
||||
/// <summary>
|
||||
/// Decoded Plextor features
|
||||
/// </summary>
|
||||
public Plextor PlextorFeatures { get; }
|
||||
/// <summary>
|
||||
/// Decoded Kreon features
|
||||
/// </summary>
|
||||
public KreonFeatures KreonFeatures { get; }
|
||||
/// <summary>
|
||||
/// Raw GET BLOCK LIMITS support
|
||||
/// </summary>
|
||||
public byte[] BlockLimits { get; }
|
||||
/// <summary>
|
||||
/// Raw density support
|
||||
/// </summary>
|
||||
public byte[] DensitySupport { get; }
|
||||
/// <summary>
|
||||
/// Decoded density support
|
||||
/// </summary>
|
||||
public DensitySupport.DensitySupportHeader? DensitySupportHeader { get; }
|
||||
/// <summary>
|
||||
/// Raw medium density support
|
||||
/// </summary>
|
||||
public byte[] MediumDensitySupport { get; }
|
||||
/// <summary>
|
||||
/// Decoded medium density support
|
||||
/// </summary>
|
||||
public DensitySupport.MediaTypeSupportHeader? MediaTypeSupportHeader { get; }
|
||||
/// <summary>
|
||||
/// Raw CID registers
|
||||
/// </summary>
|
||||
public byte[] CID { get; }
|
||||
/// <summary>
|
||||
/// Raw CSD
|
||||
/// </summary>
|
||||
public byte[] CSD { get; }
|
||||
/// <summary>
|
||||
/// Raw extended CSD
|
||||
/// </summary>
|
||||
public byte[] ExtendedCSD { get; }
|
||||
/// <summary>
|
||||
/// Raw SCR registers
|
||||
/// </summary>
|
||||
public byte[] SCR { get; }
|
||||
/// <summary>
|
||||
/// Raw OCR registers
|
||||
/// </summary>
|
||||
public byte[] OCR { get; }
|
||||
/// <summary>
|
||||
/// Aaru's device type
|
||||
/// </summary>
|
||||
public DeviceType Type { get; }
|
||||
/// <summary>
|
||||
/// Device manufacturer
|
||||
/// </summary>
|
||||
public string Manufacturer { get; }
|
||||
/// <summary>
|
||||
/// Device model
|
||||
/// </summary>
|
||||
public string Model { get; }
|
||||
/// <summary>
|
||||
/// Device firmware version or revision
|
||||
/// </summary>
|
||||
public string FirmwareRevision { get; }
|
||||
/// <summary>
|
||||
/// Device serial number
|
||||
/// </summary>
|
||||
public string Serial { get; }
|
||||
/// <summary>
|
||||
/// SCSI Peripheral Device Type
|
||||
/// </summary>
|
||||
public PeripheralDeviceTypes ScsiType { get; }
|
||||
/// <summary>
|
||||
/// Is media removable from device?
|
||||
/// </summary>
|
||||
public bool IsRemovable { get; }
|
||||
/// <summary>
|
||||
/// Is device attached via USB?
|
||||
/// </summary>
|
||||
public bool IsUsb { get; }
|
||||
/// <summary>
|
||||
/// USB vendor ID
|
||||
/// </summary>
|
||||
public ushort UsbVendorId { get; }
|
||||
/// <summary>
|
||||
/// USB product ID
|
||||
/// </summary>
|
||||
public ushort UsbProductId { get; }
|
||||
/// <summary>
|
||||
/// Raw USB descriptors
|
||||
/// </summary>
|
||||
public byte[] UsbDescriptors { get; }
|
||||
/// <summary>
|
||||
/// USB manufacturer string
|
||||
/// </summary>
|
||||
public string UsbManufacturerString { get; }
|
||||
/// <summary>
|
||||
/// USB product string
|
||||
/// </summary>
|
||||
public string UsbProductString { get; }
|
||||
/// <summary>
|
||||
/// USB serial number string
|
||||
/// </summary>
|
||||
public string UsbSerialString { get; }
|
||||
/// <summary>
|
||||
/// Is device attached via FireWire?
|
||||
/// </summary>
|
||||
public bool IsFireWire { get; }
|
||||
/// <summary>
|
||||
/// FireWire's device GUID
|
||||
/// </summary>
|
||||
public ulong FireWireGuid { get; }
|
||||
/// <summary>
|
||||
/// FireWire's device model ID
|
||||
/// </summary>
|
||||
public uint FireWireModel { get; }
|
||||
/// <summary>
|
||||
/// FireWire's device model name
|
||||
/// </summary>
|
||||
public string FireWireModelName { get; }
|
||||
/// <summary>
|
||||
/// FireWire's device vendor ID
|
||||
/// </summary>
|
||||
public uint FireWireVendor { get; }
|
||||
/// <summary>
|
||||
/// FireWire's device vendor name
|
||||
/// </summary>
|
||||
public string FireWireVendorName { get; }
|
||||
/// <summary>
|
||||
/// Is device a CompactFlash device?
|
||||
/// </summary>
|
||||
public bool IsCompactFlash { get; }
|
||||
/// <summary>
|
||||
/// Is device a PCMCIA or CardBus device?
|
||||
/// </summary>
|
||||
public bool IsPcmcia { get; }
|
||||
/// <summary>
|
||||
/// PCMCIA/CardBus CIS
|
||||
/// </summary>
|
||||
public byte[] Cis { get; }
|
||||
/// <summary>
|
||||
/// MMC device CSS/CPRM Region Protection Code
|
||||
/// </summary>
|
||||
public CSS_CPRM.RegionalPlaybackControlState? RPC { get; }
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,10 @@ namespace Aaru.Core.Devices.Report
|
||||
{
|
||||
public sealed partial class DeviceReport
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a report for media inserted into an ATA device
|
||||
/// </summary>
|
||||
/// <returns>Media report</returns>
|
||||
public TestedMedia ReportAtaMedia()
|
||||
{
|
||||
var mediaTest = new TestedMedia();
|
||||
@@ -721,6 +725,11 @@ namespace Aaru.Core.Devices.Report
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear serial numbers and other private fields from an IDENTIFY ATA DEVICE response
|
||||
/// </summary>
|
||||
/// <param name="buffer">IDENTIFY ATA DEVICE response</param>
|
||||
/// <returns>IDENTIFY ATA DEVICE response without the private fields</returns>
|
||||
public static byte[] ClearIdentify(byte[] buffer)
|
||||
{
|
||||
byte[] empty = new byte[512];
|
||||
|
||||
@@ -38,6 +38,10 @@ namespace Aaru.Core.Devices.Report
|
||||
{
|
||||
readonly Device _dev;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a device report for the specified device (must be opened)
|
||||
/// </summary>
|
||||
/// <param name="device">Device</param>
|
||||
public DeviceReport(Device device) => _dev = device;
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,10 @@ namespace Aaru.Core.Devices.Report
|
||||
{
|
||||
public sealed partial class DeviceReport
|
||||
{
|
||||
/// <summary>
|
||||
/// Tries and checks reading a GD-ROM disc using the swap disc trick and adds the result to a device report
|
||||
/// </summary>
|
||||
/// <param name="report">Device report</param>
|
||||
public void ReportGdRomSwapTrick(ref DeviceReportV2 report)
|
||||
{
|
||||
report.GdRomSwapDiscCapabilities = new GdRomSwapDiscCapabilities();
|
||||
|
||||
@@ -71,6 +71,10 @@ namespace Aaru.Core.Devices.Report
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a report for the GET CONFIGURATION response of an MMC device
|
||||
/// </summary>
|
||||
/// <returns>MMC features report</returns>
|
||||
public MmcFeatures ReportMmcFeatures()
|
||||
{
|
||||
AaruConsole.WriteLine("Querying MMC GET CONFIGURATION...");
|
||||
@@ -570,6 +574,16 @@ namespace Aaru.Core.Devices.Report
|
||||
return report;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a report for media inserted into an MMC device
|
||||
/// </summary>
|
||||
/// <param name="mediaType">Expected media type name</param>
|
||||
/// <param name="tryPlextor">Try Plextor vendor commands</param>
|
||||
/// <param name="tryPioneer">Try Pioneer vendor commands</param>
|
||||
/// <param name="tryNec">Try NEC vendor commands</param>
|
||||
/// <param name="tryHldtst">Try HL-DT-ST vendor commands</param>
|
||||
/// <param name="tryMediaTekF106">Try MediaTek vendor commands</param>
|
||||
/// <returns></returns>
|
||||
public TestedMedia ReportMmcMedia(string mediaType, bool tryPlextor, bool tryPioneer, bool tryNec,
|
||||
bool tryHldtst, bool tryMediaTekF106)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,10 @@ namespace Aaru.Core.Devices.Report
|
||||
{
|
||||
public sealed partial class DeviceReport
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a report from a SCSI Sequential Commands device
|
||||
/// </summary>
|
||||
/// <returns>SSC report</returns>
|
||||
public Ssc ReportScsiSsc()
|
||||
{
|
||||
var report = new Ssc();
|
||||
@@ -137,6 +141,10 @@ namespace Aaru.Core.Devices.Report
|
||||
return report;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a report for media inserted into an SSC device
|
||||
/// </summary>
|
||||
/// <returns>Media report</returns>
|
||||
public TestedSequentialMedia ReportSscMedia()
|
||||
{
|
||||
var seqTest = new TestedSequentialMedia();
|
||||
|
||||
@@ -45,6 +45,10 @@ namespace Aaru.Core.Devices.Report
|
||||
{
|
||||
public sealed partial class DeviceReport
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a report for the SCSI INQUIRY response
|
||||
/// </summary>
|
||||
/// <returns>SCSI report</returns>
|
||||
public Scsi ReportScsiInquiry()
|
||||
{
|
||||
AaruConsole.WriteLine("Querying SCSI INQUIRY...");
|
||||
@@ -85,6 +89,11 @@ namespace Aaru.Core.Devices.Report
|
||||
return inquiry;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of decoded SCSI EVPD pages
|
||||
/// </summary>
|
||||
/// <param name="vendor">Decoded SCSI vendor identification</param>
|
||||
/// <returns>List of decoded SCSI EVPD pages</returns>
|
||||
public List<ScsiPage> ReportEvpdPages(string vendor)
|
||||
{
|
||||
AaruConsole.WriteLine("Querying list of SCSI EVPDs...");
|
||||
@@ -187,6 +196,12 @@ namespace Aaru.Core.Devices.Report
|
||||
return pageResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds reports for the decoded SCSI MODE SENSE pages to a device report
|
||||
/// </summary>
|
||||
/// <param name="report">Device report</param>
|
||||
/// <param name="cdromMode">Returns raw MODE SENSE page 2Ah, aka CD-ROM page</param>
|
||||
/// <param name="mediumType">Returns decoded list of supported media types response</param>
|
||||
public void ReportScsiModes(ref DeviceReportV2 report, out byte[] cdromMode, out MediumTypes mediumType)
|
||||
{
|
||||
Modes.DecodedMode? decMode = null;
|
||||
@@ -419,6 +434,10 @@ namespace Aaru.Core.Devices.Report
|
||||
report.SCSI.ModeSense.ModePages = modePages;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a report for media inserted into a SCSI device
|
||||
/// </summary>
|
||||
/// <returns>Media report</returns>
|
||||
public TestedMedia ReportScsiMedia()
|
||||
{
|
||||
var mediaTest = new TestedMedia();
|
||||
@@ -684,6 +703,10 @@ namespace Aaru.Core.Devices.Report
|
||||
return mediaTest;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a media report for a non-removable SCSI device
|
||||
/// </summary>
|
||||
/// <returns>Media report</returns>
|
||||
public TestedMedia ReportScsi()
|
||||
{
|
||||
var capabilities = new TestedMedia
|
||||
|
||||
@@ -68,6 +68,11 @@ namespace Aaru.Core.Devices.Scanning
|
||||
_useBufferedReads = useBufferedReads;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts a media scan
|
||||
/// </summary>
|
||||
/// <returns>Media scan results</returns>
|
||||
/// <exception cref="NotSupportedException">Unknown device type</exception>
|
||||
public ScanResults Scan()
|
||||
{
|
||||
switch(_dev.Type)
|
||||
@@ -82,6 +87,9 @@ namespace Aaru.Core.Devices.Scanning
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aborts the running media scan
|
||||
/// </summary>
|
||||
public void Abort() => _aborted = true;
|
||||
|
||||
/// <summary>Event raised when the progress bar is not longer needed</summary>
|
||||
@@ -96,9 +104,13 @@ namespace Aaru.Core.Devices.Scanning
|
||||
public event UpdateProgressHandler UpdateProgress;
|
||||
/// <summary>Event raised to update the status of an indeterminate progress bar</summary>
|
||||
public event PulseProgressHandler PulseProgress;
|
||||
/// <summary>Updates lists of time taken on scanning from the specified sector</summary>
|
||||
public event ScanTimeHandler ScanTime;
|
||||
/// <summary>Specified a number of blocks could not be read on scan</summary>
|
||||
public event ScanUnreadableHandler ScanUnreadable;
|
||||
/// <summary>Initializes a block map that's going to be filled with a media scan</summary>
|
||||
public event InitBlockMapHandler InitBlockMap;
|
||||
/// <summary>Sends the speed of scanning a specific sector</summary>
|
||||
public event ScanSpeedHandler ScanSpeed;
|
||||
}
|
||||
}
|
||||
@@ -41,24 +41,43 @@ using Aaru.Console;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Media image entropy operations
|
||||
/// </summary>
|
||||
public sealed class Entropy
|
||||
{
|
||||
readonly bool _debug;
|
||||
readonly IMediaImage _inputFormat;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an instance with the specified parameters
|
||||
/// </summary>
|
||||
/// <param name="debug">Debug enabled</param>
|
||||
/// <param name="inputFormat">Media image</param>
|
||||
public Entropy(bool debug, IMediaImage inputFormat)
|
||||
{
|
||||
_debug = debug;
|
||||
_inputFormat = inputFormat;
|
||||
}
|
||||
|
||||
/// <summary>Event raised when a progress bar is needed</summary>
|
||||
public event InitProgressHandler InitProgressEvent;
|
||||
/// <summary>Event raised to update the values of a determinate progress bar</summary>
|
||||
public event UpdateProgressHandler UpdateProgressEvent;
|
||||
/// <summary>Event raised when the progress bar is not longer needed</summary>
|
||||
public event EndProgressHandler EndProgressEvent;
|
||||
/// <summary>Event raised when a progress bar is needed</summary>
|
||||
public event InitProgressHandler InitProgress2Event;
|
||||
/// <summary>Event raised to update the values of a determinate progress bar</summary>
|
||||
public event UpdateProgressHandler UpdateProgress2Event;
|
||||
/// <summary>Event raised when the progress bar is not longer needed</summary>
|
||||
public event EndProgressHandler EndProgress2Event;
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the tracks entropy
|
||||
/// </summary>
|
||||
/// <param name="duplicatedSectors">Checks for duplicated sectors</param>
|
||||
/// <returns>Calculated entropy</returns>
|
||||
public EntropyResults[] CalculateTracksEntropy(bool duplicatedSectors)
|
||||
{
|
||||
List<EntropyResults> entropyResults = new List<EntropyResults>();
|
||||
@@ -144,6 +163,11 @@ namespace Aaru.Core
|
||||
return entropyResults.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the media entropy
|
||||
/// </summary>
|
||||
/// <param name="duplicatedSectors">Checks for duplicated sectors</param>
|
||||
/// <returns>Calculated entropy</returns>
|
||||
public EntropyResults CalculateMediaEntropy(bool duplicatedSectors)
|
||||
{
|
||||
var entropy = new EntropyResults
|
||||
@@ -190,11 +214,26 @@ namespace Aaru.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entropy results
|
||||
/// </summary>
|
||||
public struct EntropyResults
|
||||
{
|
||||
/// <summary>
|
||||
/// Track number, if applicable
|
||||
/// </summary>
|
||||
public uint Track;
|
||||
/// <summary>
|
||||
/// Entropy
|
||||
/// </summary>
|
||||
public double Entropy;
|
||||
/// <summary>
|
||||
/// Number of unique sectors
|
||||
/// </summary>
|
||||
public int? UniqueSectors;
|
||||
/// <summary>
|
||||
/// Number of total sectors
|
||||
/// </summary>
|
||||
public ulong Sectors;
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,16 @@ using Aaru.CommonTypes.Interop;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Prints the description of a system error number.
|
||||
/// </summary>
|
||||
public static class Error
|
||||
{
|
||||
/// <summary>
|
||||
/// Prints the description of a system error number.
|
||||
/// </summary>
|
||||
/// <param name="errno">System error number.</param>
|
||||
/// <returns>Error description.</returns>
|
||||
public static string Print(int errno)
|
||||
{
|
||||
switch(DetectOS.GetRealPlatformID())
|
||||
|
||||
@@ -37,6 +37,9 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Core filesystem operations
|
||||
/// </summary>
|
||||
public static class Filesystems
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -36,8 +36,14 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Plugin base operations
|
||||
/// </summary>
|
||||
public static class GetPluginBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets an instance with all the known plugins
|
||||
/// </summary>
|
||||
public static PluginBase Instance
|
||||
{
|
||||
get
|
||||
|
||||
@@ -38,6 +38,9 @@ using Aaru.Console;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Core media image format operations
|
||||
/// </summary>
|
||||
public static class ImageFormat
|
||||
{
|
||||
/// <summary>Detects the image plugin that recognizes the data inside a filter</summary>
|
||||
|
||||
@@ -56,6 +56,9 @@ using Tuple = Aaru.Decoders.PCMCIA.Tuple;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Image information operations
|
||||
/// </summary>
|
||||
public static class ImageInfo
|
||||
{
|
||||
const string MANUFACTURER_STRING = "Manufacturer";
|
||||
@@ -67,6 +70,10 @@ namespace Aaru.Core
|
||||
const string START_STRING = "Start";
|
||||
const string END_STRING = "End";
|
||||
|
||||
/// <summary>
|
||||
/// Prints image information to console
|
||||
/// </summary>
|
||||
/// <param name="imageFormat">Media image</param>
|
||||
public static void PrintImageInfo(IMediaImage imageFormat)
|
||||
{
|
||||
AaruConsole.WriteLine("Image information:");
|
||||
|
||||
@@ -35,6 +35,9 @@ using Aaru.Decoders.SCSI;
|
||||
|
||||
namespace Aaru.Core.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Logs errors
|
||||
/// </summary>
|
||||
public sealed class ErrorLog
|
||||
{
|
||||
readonly StreamWriter _logSw;
|
||||
|
||||
@@ -32,13 +32,16 @@ using Aaru.Decoders.CD;
|
||||
|
||||
namespace Aaru.Core.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Logs subchannel data
|
||||
/// </summary>
|
||||
public class SubchannelLog
|
||||
{
|
||||
const int _subSize = 96;
|
||||
readonly bool _bcd;
|
||||
readonly StreamWriter _logSw;
|
||||
|
||||
/// <summary>Initializes the dump log</summary>
|
||||
/// <summary>Initializes the subchannel log</summary>
|
||||
/// <param name="outputFile">Output log file</param>
|
||||
/// <param name="bcd">Drive returns subchannel in BCD format</param>
|
||||
public SubchannelLog(string outputFile, bool bcd)
|
||||
@@ -55,7 +58,7 @@ namespace Aaru.Core.Logging
|
||||
_logSw.Flush();
|
||||
}
|
||||
|
||||
/// <summary>Finishes and closes the dump log</summary>
|
||||
/// <summary>Finishes and closes the subchannel log</summary>
|
||||
public void Close()
|
||||
{
|
||||
_logSw.WriteLine("######################################################");
|
||||
@@ -63,6 +66,15 @@ namespace Aaru.Core.Logging
|
||||
_logSw.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an entry to the subchannel log
|
||||
/// </summary>
|
||||
/// <param name="subchannel">Subchannel data</param>
|
||||
/// <param name="raw">Set to <c>true</c> if the subchannel data is raw</param>
|
||||
/// <param name="startingLba">First LBA read from drive to retrieve the data</param>
|
||||
/// <param name="blocks">Number of blocks read</param>
|
||||
/// <param name="generated">Set to <c>true</c> if the subchannel has been generated, <c>false</c> if read from media</param>
|
||||
/// <param name="fixed">Set to <c>true</c> if the subchannel has been fixed, <c>false</c> if as is</param>
|
||||
public void WriteEntry(byte[] subchannel, bool raw, long startingLba, uint blocks, bool generated, bool @fixed)
|
||||
{
|
||||
if(subchannel.Length / _subSize != blocks)
|
||||
@@ -219,34 +231,87 @@ namespace Aaru.Core.Logging
|
||||
_logSw.Flush();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the P subchannel has been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WritePFix(long lba) => WriteMessageWithPosition(lba, "fixed P subchannel using weight average.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the R-W subchannels have been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteRwFix(long lba) => WriteMessageWithPosition(lba, "fixed R-W subchannels writing empty data.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the ADR field of the Q subchannel has been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQAdrFix(long lba) => WriteMessageWithPosition(lba, "fixed Q subchannel with correct ADR.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the CONTROL field of the Q subchannel has been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQCtrlFix(long lba) =>
|
||||
WriteMessageWithPosition(lba, "fixed Q subchannel with correct CONTROL.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the ZERO field of the Q subchannel has been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQZeroFix(long lba) => WriteMessageWithPosition(lba, "fixed Q subchannel with correct ZERO.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the TNO field of the Q subchannel has been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQTnoFix(long lba) => WriteMessageWithPosition(lba, "fixed Q subchannel with correct TNO.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the INDEX field of the Q subchannel has been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQIndexFix(long lba) => WriteMessageWithPosition(lba, "fixed Q subchannel with correct INDEX.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the relative position of the Q subchannel has been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQRelPosFix(long lba) =>
|
||||
WriteMessageWithPosition(lba, "fixed Q subchannel with correct RELATIVE POSITION.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the absolute position of the Q subchannel has been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQAbsPosFix(long lba) =>
|
||||
WriteMessageWithPosition(lba, "fixed Q subchannel with correct ABSOLUTE POSITION.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the CRC of the Q subchannel has been fixed
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQCrcFix(long lba) => WriteMessageWithPosition(lba, "fixed Q subchannel with correct CRC.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the the Q subchannel has been fixed with a known good MCN
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQMcnFix(long lba) => WriteMessageWithPosition(lba, "fixed Q subchannel with known good MCN.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs message indicating the the Q subchannel has been fixed with a known good ISRC
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA fix belongs to</param>
|
||||
public void WriteQIsrcFix(long lba) =>
|
||||
WriteMessageWithPosition(lba, "fixed Q subchannel with known good ISRC.");
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message with a specified position
|
||||
/// </summary>
|
||||
/// <param name="lba">LBA position</param>
|
||||
/// <param name="message">Message to log</param>
|
||||
public void WriteMessageWithPosition(long lba, string message)
|
||||
{
|
||||
long minute = (lba + 150) / 4500;
|
||||
|
||||
@@ -41,6 +41,9 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.Core.Media
|
||||
{
|
||||
/// <summary>
|
||||
/// Operations over CD based media
|
||||
/// </summary>
|
||||
public static class CompactDisc
|
||||
{
|
||||
/// <summary>Writes subchannel data to an image</summary>
|
||||
|
||||
@@ -51,6 +51,9 @@ using DMI = Aaru.Decoders.Xbox.DMI;
|
||||
|
||||
namespace Aaru.Core.Media.Detection
|
||||
{
|
||||
/// <summary>
|
||||
/// Detects media type for MMC class devices
|
||||
/// </summary>
|
||||
public static class MMC
|
||||
{
|
||||
/// <summary>SHA256 of PlayStation 2 boot sectors, seen in PAL discs</summary>
|
||||
|
||||
@@ -45,6 +45,9 @@ using Device = Aaru.Database.Models.Device;
|
||||
|
||||
namespace Aaru.Core.Media.Info
|
||||
{
|
||||
/// <summary>
|
||||
/// Core operations for retrieving information about CD based media
|
||||
/// </summary>
|
||||
public static class CompactDisc
|
||||
{
|
||||
/// <summary>Gets the offset bytes from a Compact Disc</summary>
|
||||
|
||||
@@ -53,8 +53,15 @@ using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
|
||||
|
||||
namespace Aaru.Core.Media.Info
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves information from a SCSI device
|
||||
/// </summary>
|
||||
public sealed class ScsiInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes this class with the specific device, and fills in the information
|
||||
/// </summary>
|
||||
/// <param name="dev">Device</param>
|
||||
public ScsiInfo(Device dev)
|
||||
{
|
||||
if(dev.Type != DeviceType.SCSI &&
|
||||
@@ -1492,74 +1499,281 @@ namespace Aaru.Core.Media.Info
|
||||
MediaType = tmpType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decoded DVD Pre-Recorded Information
|
||||
/// </summary>
|
||||
public PRI.PreRecordedInformation? DecodedDvdPrePitInformation { get; }
|
||||
/// <summary>
|
||||
/// Decoded recordable DVD Physical Format Information
|
||||
/// </summary>
|
||||
public PFI.PhysicalFormatInformation? DecodedDvdrPfi { get; }
|
||||
/// <summary>
|
||||
/// Raw media serial number
|
||||
/// </summary>
|
||||
public byte[] MediaSerialNumber { get; }
|
||||
/// <summary>
|
||||
/// Raw Xbox security sectors
|
||||
/// </summary>
|
||||
public byte[] XboxSecuritySector { get; }
|
||||
/// <summary>
|
||||
/// Decoded Xbox security sectors
|
||||
/// </summary>
|
||||
public SS.SecuritySector? DecodedXboxSecuritySector { get; }
|
||||
/// <summary>
|
||||
/// Information about an XGD, XGD2 or XGD3 media
|
||||
/// </summary>
|
||||
public XgdInfo XgdInfo { get; }
|
||||
/// <summary>
|
||||
/// MMC drive raw GET CONFIGURATION
|
||||
/// </summary>
|
||||
public byte[] MmcConfiguration { get; }
|
||||
/// <summary>
|
||||
/// Raw recognized format layers
|
||||
/// </summary>
|
||||
public byte[] RecognizedFormatLayers { get; }
|
||||
/// <summary>
|
||||
/// Raw write protection status
|
||||
/// </summary>
|
||||
public byte[] WriteProtectionStatus { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD Physical Format Information
|
||||
/// </summary>
|
||||
public byte[] DvdPfi { get; }
|
||||
/// <summary>
|
||||
/// Decoded DVD Physical Format Information
|
||||
/// </summary>
|
||||
public PFI.PhysicalFormatInformation? DecodedPfi { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD Disc Manufacturing Information
|
||||
/// </summary>
|
||||
public byte[] DvdDmi { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD Copyright Management Information
|
||||
/// </summary>
|
||||
public byte[] DvdCmi { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD Burst Cutting Area
|
||||
/// </summary>
|
||||
public byte[] DvdBca { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD AACS information
|
||||
/// </summary>
|
||||
public byte[] DvdAacs { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-RAM Disc Definition Structure
|
||||
/// </summary>
|
||||
public byte[] DvdRamDds { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-RAM Cartridge Status
|
||||
/// </summary>
|
||||
public byte[] DvdRamCartridgeStatus { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-RAM Spare Area Information
|
||||
/// </summary>
|
||||
public byte[] DvdRamSpareArea { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-R(W) Last Border-Out RMD
|
||||
/// </summary>
|
||||
public byte[] LastBorderOutRmd { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-R(W) Pre-Recorded Information
|
||||
/// </summary>
|
||||
public byte[] DvdPreRecordedInfo { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-R Media ID
|
||||
/// </summary>
|
||||
public byte[] DvdrMediaIdentifier { get; }
|
||||
/// <summary>
|
||||
/// Raw recordable DVD Physical Format Information
|
||||
/// </summary>
|
||||
public byte[] DvdrPhysicalInformation { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD+R(W) ADIP
|
||||
/// </summary>
|
||||
public byte[] DvdPlusAdip { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD+R(W) Disc Control Blocks
|
||||
/// </summary>
|
||||
public byte[] DvdPlusDcb { get; }
|
||||
/// <summary>
|
||||
/// Raw HD DVD Copyright Management Information
|
||||
/// </summary>
|
||||
public byte[] HddvdCopyrightInformation { get; }
|
||||
/// <summary>
|
||||
/// Raw HD DVD-R Medium Status
|
||||
/// </summary>
|
||||
public byte[] HddvdrMediumStatus { get; }
|
||||
/// <summary>
|
||||
/// Raw HD DVD-R(W) Last Border-Out RMD
|
||||
/// </summary>
|
||||
public byte[] HddvdrLastRmd { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-R(W) Layer Capacity
|
||||
/// </summary>
|
||||
public byte[] DvdrLayerCapacity { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-R DL Middle Zone start
|
||||
/// </summary>
|
||||
public byte[] DvdrDlMiddleZoneStart { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-R DL Jump Interval size
|
||||
/// </summary>
|
||||
public byte[] DvdrDlJumpIntervalSize { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-R DL Manual Layer Jump Start LBA
|
||||
/// </summary>
|
||||
public byte[] DvdrDlManualLayerJumpStartLba { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD-R DL Remap Anchor Point
|
||||
/// </summary>
|
||||
public byte[] DvdrDlRemapAnchorPoint { get; }
|
||||
/// <summary>
|
||||
/// Raw Blu-ray Disc Information
|
||||
/// </summary>
|
||||
public byte[] BlurayDiscInformation { get; }
|
||||
/// <summary>
|
||||
/// Raw Blu-ray PAC
|
||||
/// </summary>
|
||||
public byte[] BlurayPac { get; }
|
||||
/// <summary>
|
||||
/// Raw Blu-ray Burst Cutting Area
|
||||
/// </summary>
|
||||
public byte[] BlurayBurstCuttingArea { get; }
|
||||
/// <summary>
|
||||
/// Raw Blu-ray Disc Definition Structure
|
||||
/// </summary>
|
||||
public byte[] BlurayDds { get; }
|
||||
/// <summary>
|
||||
/// Raw Blu-ray Cartridge Status
|
||||
/// </summary>
|
||||
public byte[] BlurayCartridgeStatus { get; }
|
||||
/// <summary>
|
||||
/// Raw Blu-ray Spare Area Information
|
||||
/// </summary>
|
||||
public byte[] BluraySpareAreaInformation { get; }
|
||||
/// <summary>
|
||||
/// Raw Blu-ray DFL
|
||||
/// </summary>
|
||||
public byte[] BlurayRawDfl { get; }
|
||||
/// <summary>
|
||||
/// Raw Blu-ray Pseudo OverWrite Resources
|
||||
/// </summary>
|
||||
public byte[] BlurayPowResources { get; }
|
||||
/// <summary>
|
||||
/// Raw READ TOC response
|
||||
/// </summary>
|
||||
public byte[] Toc { get; }
|
||||
/// <summary>
|
||||
/// Raw READ ATIP response
|
||||
/// </summary>
|
||||
public byte[] Atip { get; }
|
||||
/// <summary>
|
||||
/// Raw READ DISC INFORMATION response
|
||||
/// </summary>
|
||||
public byte[] DiscInformation { get; }
|
||||
/// <summary>
|
||||
/// Raw READ SESSION response
|
||||
/// </summary>
|
||||
public byte[] Session { get; }
|
||||
/// <summary>
|
||||
/// Raw READ FULL TOC response
|
||||
/// </summary>
|
||||
public byte[] RawToc { get; }
|
||||
/// <summary>
|
||||
/// Raw READ PMA response
|
||||
/// </summary>
|
||||
public byte[] Pma { get; }
|
||||
/// <summary>
|
||||
/// Raw Lead-In's CD-TEXT response
|
||||
/// </summary>
|
||||
public byte[] CdTextLeadIn { get; }
|
||||
/// <summary>
|
||||
/// Decoded READ TOC response
|
||||
/// </summary>
|
||||
public TOC.CDTOC? DecodedToc { get; }
|
||||
/// <summary>
|
||||
/// Decoded READ ATIP response
|
||||
/// </summary>
|
||||
public ATIP.CDATIP DecodedAtip { get; }
|
||||
/// <summary>
|
||||
/// Decoded READ SESSION response
|
||||
/// </summary>
|
||||
public Session.CDSessionInfo? DecodedSession { get; }
|
||||
/// <summary>
|
||||
/// Decoded READ FULL TOC response
|
||||
/// </summary>
|
||||
public FullTOC.CDFullTOC? FullToc { get; }
|
||||
/// <summary>
|
||||
/// Decoded Lead-In CD-TEXT response
|
||||
/// </summary>
|
||||
public CDTextOnLeadIn.CDText? DecodedCdTextLeadIn { get; }
|
||||
/// <summary>
|
||||
/// Raw Blu-ray track resources
|
||||
/// </summary>
|
||||
public byte[] BlurayTrackResources { get; }
|
||||
/// <summary>
|
||||
/// Decoded Blu-ray Disc Information
|
||||
/// </summary>
|
||||
public DiscInformation.StandardDiscInformation? DecodedDiscInformation { get; }
|
||||
/// <summary>
|
||||
/// Decoded Media Catalogue Number
|
||||
/// </summary>
|
||||
public string Mcn { get; }
|
||||
/// <summary>
|
||||
/// List of decoded track ISRCs
|
||||
/// </summary>
|
||||
public Dictionary<byte, string> Isrcs { get; }
|
||||
/// <summary>
|
||||
/// Set if media is inserted in drive
|
||||
/// </summary>
|
||||
public bool MediaInserted { get; }
|
||||
/// <summary>
|
||||
/// Detected media type
|
||||
/// </summary>
|
||||
public MediaType MediaType { get; }
|
||||
/// <summary>
|
||||
/// Device information
|
||||
/// </summary>
|
||||
public DeviceInfo DeviceInfo { get; }
|
||||
/// <summary>
|
||||
/// Raw READ CAPACITY(10) response
|
||||
/// </summary>
|
||||
public byte[] ReadCapacity { get; }
|
||||
/// <summary>
|
||||
/// Number of blocks in media
|
||||
/// </summary>
|
||||
public ulong Blocks { get; }
|
||||
/// <summary>
|
||||
/// Logical block size
|
||||
/// </summary>
|
||||
public uint BlockSize { get; }
|
||||
/// <summary>
|
||||
/// Raw READ CAPACITY(16) response
|
||||
/// </summary>
|
||||
public byte[] ReadCapacity16 { get; }
|
||||
/// <summary>
|
||||
/// Raw SSC Density support
|
||||
/// </summary>
|
||||
public byte[] DensitySupport { get; }
|
||||
/// <summary>
|
||||
/// Decoded SSC Density support
|
||||
/// </summary>
|
||||
public DensitySupport.DensitySupportHeader? DensitySupportHeader { get; }
|
||||
/// <summary>
|
||||
/// Raw SSC media support
|
||||
/// </summary>
|
||||
public byte[] MediaTypeSupport { get; }
|
||||
/// <summary>
|
||||
/// Decoded SSC media support
|
||||
/// </summary>
|
||||
public DensitySupport.MediaTypeSupportHeader? MediaTypeSupportHeader { get; }
|
||||
/// <summary>
|
||||
/// Raw data from DVD sector Copyright Management Information
|
||||
/// </summary>
|
||||
public byte[] DvdSectorCmi { get; }
|
||||
/// <summary>
|
||||
/// Raw DVD Disc Key
|
||||
/// </summary>
|
||||
public byte[] DvdDiscKey { get; }
|
||||
}
|
||||
}
|
||||
@@ -32,13 +32,34 @@
|
||||
|
||||
namespace Aaru.Core.Media.Info
|
||||
{
|
||||
/// <summary>
|
||||
/// Information about an XGD, XGD2 or XGD3 media.
|
||||
/// </summary>
|
||||
public sealed class XgdInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Size of the game partition
|
||||
/// </summary>
|
||||
public ulong GameSize;
|
||||
/// <summary>
|
||||
/// Size of layer 0 of the video partition
|
||||
/// </summary>
|
||||
public ulong L0Video;
|
||||
/// <summary>
|
||||
/// Size of layer 1 of the video partition
|
||||
/// </summary>
|
||||
public ulong L1Video;
|
||||
/// <summary>
|
||||
/// Real layer break
|
||||
/// </summary>
|
||||
public ulong LayerBreak;
|
||||
/// <summary>
|
||||
/// Size of the middle zone
|
||||
/// </summary>
|
||||
public ulong MiddleZone;
|
||||
/// <summary>
|
||||
/// Total size of media
|
||||
/// </summary>
|
||||
public ulong TotalSize;
|
||||
}
|
||||
}
|
||||
@@ -36,8 +36,16 @@ using System.Text;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Option parsing
|
||||
/// </summary>
|
||||
public static class Options
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses a string with options
|
||||
/// </summary>
|
||||
/// <param name="options">Options string</param>
|
||||
/// <returns>Options name-value dictionary</returns>
|
||||
public static Dictionary<string, string> Parse(string options)
|
||||
{
|
||||
Dictionary<string, string> parsed = new Dictionary<string, string>();
|
||||
|
||||
@@ -37,8 +37,17 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Prints all SCSI MODE pages
|
||||
/// </summary>
|
||||
public static class PrintScsiModePages
|
||||
{
|
||||
/// <summary>
|
||||
/// Prints all SCSI MODE pages
|
||||
/// </summary>
|
||||
/// <param name="decMode">Decoded SCSI MODE SENSE</param>
|
||||
/// <param name="devType">SCSI Peripheral Type</param>
|
||||
/// <param name="vendorId">SCSI vendor identification</param>
|
||||
public static void Print(Modes.DecodedMode decMode, PeripheralDeviceTypes devType, byte[] vendorId)
|
||||
{
|
||||
AaruConsole.WriteLine(Modes.PrettifyModeHeader(decMode.Header, devType));
|
||||
|
||||
@@ -111,6 +111,10 @@ namespace Aaru.Core
|
||||
submitThread.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the main database
|
||||
/// </summary>
|
||||
/// <param name="create">If <c>true</c> creates the database from scratch, otherwise updates an existing database</param>
|
||||
public static void UpdateMainDatabase(bool create)
|
||||
{
|
||||
var mctx = AaruContext.Create(Settings.Settings.MainDbPath);
|
||||
|
||||
@@ -36,6 +36,9 @@ using Schemas;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Sidecar operations
|
||||
/// </summary>
|
||||
public sealed partial class Sidecar
|
||||
{
|
||||
/// <summary>Creates a metadata sidecar for a block tape (e.g. scsi streaming)</summary>
|
||||
|
||||
@@ -36,28 +36,42 @@ namespace Aaru.Core
|
||||
{
|
||||
public sealed partial class Sidecar
|
||||
{
|
||||
/// <summary>Initializes a progress indicator (e.g. makes a progress bar visible)</summary>
|
||||
public event InitProgressHandler InitProgressEvent;
|
||||
/// <summary>Updates a progress indicator with text</summary>
|
||||
public event UpdateProgressHandler UpdateProgressEvent;
|
||||
/// <summary>Uninitializes a progress indicator (e.g. adds a newline to the console)</summary>
|
||||
public event EndProgressHandler EndProgressEvent;
|
||||
/// <summary>Initializes a secondary progress indicator (e.g. makes a progress bar visible)</summary>
|
||||
public event InitProgressHandler2 InitProgressEvent2;
|
||||
/// <summary>Event raised to update the values of a determinate progress bar</summary>
|
||||
public event UpdateProgressHandler2 UpdateProgressEvent2;
|
||||
/// <summary>Event raised when the progress bar is not longer needed</summary>
|
||||
public event EndProgressHandler2 EndProgressEvent2;
|
||||
/// <summary>Updates a status indicator</summary>
|
||||
public event UpdateStatusHandler UpdateStatusEvent;
|
||||
|
||||
/// <summary>Initializes a progress indicator (e.g. makes a progress bar visible)</summary>
|
||||
public void InitProgress() => InitProgressEvent?.Invoke();
|
||||
|
||||
/// <summary>Updates a progress indicator with text</summary>
|
||||
public void UpdateProgress(string text, long current, long maximum) =>
|
||||
UpdateProgressEvent?.Invoke(string.Format(text, current, maximum), current, maximum);
|
||||
|
||||
/// <summary>Uninitializes a progress indicator (e.g. adds a newline to the console)</summary>
|
||||
public void EndProgress() => EndProgressEvent?.Invoke();
|
||||
|
||||
/// <summary>Initializes a secondary progress indicator (e.g. makes a progress bar visible)</summary>
|
||||
public void InitProgress2() => InitProgressEvent2?.Invoke();
|
||||
|
||||
/// <summary>Event raised to update the values of a determinate progress bar</summary>
|
||||
public void UpdateProgress2(string text, long current, long maximum) =>
|
||||
UpdateProgressEvent2?.Invoke(string.Format(text, current, maximum), current, maximum);
|
||||
|
||||
/// <summary>Event raised when the progress bar is not longer needed</summary>
|
||||
public void EndProgress2() => EndProgressEvent2?.Invoke();
|
||||
|
||||
/// <summary>Updates a status indicator</summary>
|
||||
public void UpdateStatus(string text, params object[] args) =>
|
||||
UpdateStatusEvent?.Invoke(string.Format(text, args));
|
||||
}
|
||||
|
||||
@@ -56,6 +56,9 @@ namespace Aaru.Core
|
||||
FileStream _fs;
|
||||
CICMMetadataType _sidecar;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of this class
|
||||
/// </summary>
|
||||
public Sidecar()
|
||||
{
|
||||
_plugins = GetPluginBase.Instance;
|
||||
@@ -167,6 +170,9 @@ namespace Aaru.Core
|
||||
return _sidecar;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aborts sidecar running operation
|
||||
/// </summary>
|
||||
public void Abort()
|
||||
{
|
||||
UpdateStatus("Aborting...");
|
||||
|
||||
@@ -35,30 +35,94 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Aaru.Database
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Database context
|
||||
/// </summary>
|
||||
public sealed class AaruContext : DbContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a database context with the specified options
|
||||
/// </summary>
|
||||
/// <param name="options">Options</param>
|
||||
public AaruContext(DbContextOptions options) : base(options) {}
|
||||
|
||||
/// <summary>
|
||||
/// List of known devices
|
||||
/// </summary>
|
||||
public DbSet<Device> Devices { get; set; }
|
||||
/// <summary>
|
||||
/// List of local device reports
|
||||
/// </summary>
|
||||
public DbSet<Report> Reports { get; set; }
|
||||
/// <summary>
|
||||
/// Command usage statistics
|
||||
/// </summary>
|
||||
public DbSet<Command> Commands { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics for found filesystems
|
||||
/// </summary>
|
||||
public DbSet<Filesystem> Filesystems { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics for used filters
|
||||
/// </summary>
|
||||
public DbSet<Filter> Filters { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics for media image formats
|
||||
/// </summary>
|
||||
public DbSet<MediaFormat> MediaFormats { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics for partitioning schemes
|
||||
/// </summary>
|
||||
public DbSet<Partition> Partitions { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics for media types
|
||||
/// </summary>
|
||||
public DbSet<Media> Medias { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics for devices seen using commands
|
||||
/// </summary>
|
||||
public DbSet<DeviceStat> SeenDevices { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics for operating systems
|
||||
/// </summary>
|
||||
public DbSet<OperatingSystem> OperatingSystems { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics for used Aaru versions
|
||||
/// </summary>
|
||||
public DbSet<Version> Versions { get; set; }
|
||||
/// <summary>
|
||||
/// List of known USB vendors
|
||||
/// </summary>
|
||||
public DbSet<UsbVendor> UsbVendors { get; set; }
|
||||
/// <summary>
|
||||
/// List of known USB products
|
||||
/// </summary>
|
||||
public DbSet<UsbProduct> UsbProducts { get; set; }
|
||||
/// <summary>
|
||||
/// List of CD reading offsets
|
||||
/// </summary>
|
||||
public DbSet<CdOffset> CdOffsets { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics of remote applications
|
||||
/// </summary>
|
||||
public DbSet<RemoteApplication> RemoteApplications { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics of remote architectures
|
||||
/// </summary>
|
||||
public DbSet<RemoteArchitecture> RemoteArchitectures { get; set; }
|
||||
/// <summary>
|
||||
/// Statistics of remote operating systems
|
||||
/// </summary>
|
||||
public DbSet<RemoteOperatingSystem> RemoteOperatingSystems { get; set; }
|
||||
|
||||
// Note: If table does not appear check that last migration has been REALLY added to the project
|
||||
|
||||
/// <summary>
|
||||
/// Creates a database context with the database in the specified path
|
||||
/// </summary>
|
||||
/// <param name="dbPath">Path to database file</param>
|
||||
/// <returns>Database context</returns>
|
||||
public static AaruContext Create(string dbPath)
|
||||
{
|
||||
var optionsBuilder = new DbContextOptionsBuilder();
|
||||
@@ -67,6 +131,7 @@ namespace Aaru.Database
|
||||
return new AaruContext(optionsBuilder.Options);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
@@ -34,8 +34,16 @@ using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace Aaru.Database
|
||||
{
|
||||
/// <summary>
|
||||
/// Database context factory, for design time
|
||||
/// </summary>
|
||||
public class AaruContextFactory : IDesignTimeDbContextFactory<AaruContext>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a database context
|
||||
/// </summary>
|
||||
/// <param name="args">Ignored parameters</param>
|
||||
/// <returns>A database context</returns>
|
||||
public AaruContext CreateDbContext(string[] args) => AaruContext.Create("aaru.db");
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,14 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Base database model
|
||||
/// </summary>
|
||||
public abstract class BaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Database ID
|
||||
/// </summary>
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
||||
@@ -32,11 +32,26 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Operating system statistics
|
||||
/// </summary>
|
||||
public abstract class BaseOperatingSystem : BaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Operating system name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Operating system version
|
||||
/// </summary>
|
||||
public string Version { get; set; }
|
||||
/// <summary>
|
||||
/// Has already been synchronized with Aaru's server
|
||||
/// </summary>
|
||||
public bool Synchronized { get; set; }
|
||||
/// <summary>
|
||||
/// Statistical count
|
||||
/// </summary>
|
||||
public ulong Count { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -34,10 +34,24 @@ using System;
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// CD read offset
|
||||
/// </summary>
|
||||
public class CdOffset : CommonTypes.Metadata.CdOffset
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds an empty CD read offset
|
||||
/// </summary>
|
||||
public CdOffset() {}
|
||||
|
||||
/// <summary>
|
||||
/// Builds a CD read offset with the specified parameters
|
||||
/// </summary>
|
||||
/// <param name="manufacturer">Manufacturer</param>
|
||||
/// <param name="model">Model</param>
|
||||
/// <param name="offset">Read offset</param>
|
||||
/// <param name="submissions">Number of submissions</param>
|
||||
/// <param name="agreement">Percentage of agreement of submissions</param>
|
||||
public CdOffset(string manufacturer, string model, short offset, int submissions, float agreement)
|
||||
{
|
||||
Manufacturer = manufacturer;
|
||||
@@ -48,6 +62,10 @@ namespace Aaru.Database.Models
|
||||
AddedWhen = ModifiedWhen = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds a CD read offset from the metadata type
|
||||
/// </summary>
|
||||
/// <param name="offset">Read offset metadata</param>
|
||||
public CdOffset(CommonTypes.Metadata.CdOffset offset)
|
||||
{
|
||||
Manufacturer = offset.Manufacturer;
|
||||
@@ -58,8 +76,17 @@ namespace Aaru.Database.Models
|
||||
AddedWhen = ModifiedWhen = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Database ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Date when model has been added to the database
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
/// <summary>
|
||||
/// Date when model was last modified
|
||||
/// </summary>
|
||||
public DateTime ModifiedWhen { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Command statistics.
|
||||
/// </summary>
|
||||
public class Command : NameCountModel {}
|
||||
}
|
||||
@@ -36,10 +36,20 @@ using Aaru.CommonTypes.Metadata;
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Known device
|
||||
/// </summary>
|
||||
public class Device : DeviceReportV2
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds an empty device
|
||||
/// </summary>
|
||||
public Device() => LastSynchronized = DateTime.UtcNow;
|
||||
|
||||
/// <summary>
|
||||
/// Builds a device from a device report
|
||||
/// </summary>
|
||||
/// <param name="report">Device report</param>
|
||||
public Device(DeviceReportV2 report)
|
||||
{
|
||||
ATA = report.ATA;
|
||||
@@ -59,11 +69,20 @@ namespace Aaru.Database.Models
|
||||
GdRomSwapDiscCapabilities = report.GdRomSwapDiscCapabilities;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When this known device was last synchronized with the server
|
||||
/// </summary>
|
||||
public DateTime LastSynchronized { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optimal number of blocks to read at once
|
||||
/// </summary>
|
||||
[DefaultValue(0)]
|
||||
public int OptimalMultipleSectorsRead { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Can read GD-ROM using swap trick?
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
public bool? CanReadGdRomUsingSwapDisc { get; set; }
|
||||
}
|
||||
|
||||
@@ -32,12 +32,30 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Device found in usage
|
||||
/// </summary>
|
||||
public class DeviceStat : BaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Manufacturer
|
||||
/// </summary>
|
||||
public string Manufacturer { get; set; }
|
||||
/// <summary>
|
||||
/// Model
|
||||
/// </summary>
|
||||
public string Model { get; set; }
|
||||
/// <summary>
|
||||
/// Revision or firmware version
|
||||
/// </summary>
|
||||
public string Revision { get; set; }
|
||||
/// <summary>
|
||||
/// Bus
|
||||
/// </summary>
|
||||
public string Bus { get; set; }
|
||||
/// <summary>
|
||||
/// Has already been synchronized with Aaru's server
|
||||
/// </summary>
|
||||
public bool Synchronized { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Filesystem found
|
||||
/// </summary>
|
||||
public class Filesystem : NameCountModel {}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Filter used
|
||||
/// </summary>
|
||||
public class Filter : NameCountModel {}
|
||||
}
|
||||
@@ -32,11 +32,26 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Media type found
|
||||
/// </summary>
|
||||
public class Media : BaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Media type name
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
/// <summary>
|
||||
/// Found physically, or in image
|
||||
/// </summary>
|
||||
public bool Real { get; set; }
|
||||
/// <summary>
|
||||
/// Has already been synchronized with Aaru's server
|
||||
/// </summary>
|
||||
public bool Synchronized { get; set; }
|
||||
/// <summary>
|
||||
/// Count of times found
|
||||
/// </summary>
|
||||
public ulong Count { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Media image format
|
||||
/// </summary>
|
||||
public class MediaFormat : NameCountModel {}
|
||||
}
|
||||
@@ -32,10 +32,22 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Model for name-count values.
|
||||
/// </summary>
|
||||
public abstract class NameCountModel : BaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Value name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Has already been synchronized with Aaru's server
|
||||
/// </summary>
|
||||
public bool Synchronized { get; set; }
|
||||
/// <summary>
|
||||
/// Value count
|
||||
/// </summary>
|
||||
public ulong Count { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Operating system
|
||||
/// </summary>
|
||||
public class OperatingSystem : BaseOperatingSystem {}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Partitioning scheme
|
||||
/// </summary>
|
||||
public class Partition : NameCountModel {}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Remote application
|
||||
/// </summary>
|
||||
public class RemoteApplication : BaseOperatingSystem {}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Remote architecture
|
||||
/// </summary>
|
||||
public class RemoteArchitecture : NameCountModel {}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Remote operating system
|
||||
/// </summary>
|
||||
public class RemoteOperatingSystem : BaseOperatingSystem {}
|
||||
}
|
||||
@@ -35,14 +35,24 @@ using Aaru.CommonTypes.Metadata;
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Device report
|
||||
/// </summary>
|
||||
public class Report : DeviceReportV2
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds an empty device report
|
||||
/// </summary>
|
||||
public Report()
|
||||
{
|
||||
Created = DateTime.UtcNow;
|
||||
Uploaded = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds a device report model from a device report
|
||||
/// </summary>
|
||||
/// <param name="report">Device report</param>
|
||||
public Report(DeviceReportV2 report)
|
||||
{
|
||||
ATA = report.ATA;
|
||||
@@ -62,7 +72,13 @@ namespace Aaru.Database.Models
|
||||
Type = report.Type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Date when the device report was created
|
||||
/// </summary>
|
||||
public DateTime Created { get; set; }
|
||||
/// <summary>
|
||||
/// If this model has already been upload
|
||||
/// </summary>
|
||||
public bool Uploaded { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -35,10 +35,22 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// USB product
|
||||
/// </summary>
|
||||
public class UsbProduct
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds an empty USB product
|
||||
/// </summary>
|
||||
public UsbProduct() {}
|
||||
|
||||
/// <summary>
|
||||
/// Builds a USB product with the specified parameters
|
||||
/// </summary>
|
||||
/// <param name="vendorId">Vendor ID</param>
|
||||
/// <param name="id">Product ID</param>
|
||||
/// <param name="product">Product name</param>
|
||||
public UsbProduct(ushort vendorId, ushort id, string product)
|
||||
{
|
||||
VendorId = vendorId;
|
||||
@@ -47,13 +59,34 @@ namespace Aaru.Database.Models
|
||||
AddedWhen = ModifiedWhen = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Database ID
|
||||
/// </summary>
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Product ID
|
||||
/// </summary>
|
||||
public ushort ProductId { get; set; }
|
||||
/// <summary>
|
||||
/// Product name
|
||||
/// </summary>
|
||||
public string Product { get; set; }
|
||||
/// <summary>
|
||||
/// Date when model has been added to the database
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
/// <summary>
|
||||
/// Date when model was last modified
|
||||
/// </summary>
|
||||
public DateTime ModifiedWhen { get; set; }
|
||||
/// <summary>
|
||||
/// USB vendor ID
|
||||
/// </summary>
|
||||
public ushort VendorId { get; set; }
|
||||
/// <summary>
|
||||
/// Database link to USB vendor
|
||||
/// </summary>
|
||||
public virtual UsbVendor Vendor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -36,10 +36,21 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// USB vendor
|
||||
/// </summary>
|
||||
public class UsbVendor
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds an empty USB vendor
|
||||
/// </summary>
|
||||
public UsbVendor() {}
|
||||
|
||||
/// <summary>
|
||||
/// Builds a USB vendor with the specified parameters
|
||||
/// </summary>
|
||||
/// <param name="id">Vendor ID</param>
|
||||
/// <param name="vendor">Vendor name</param>
|
||||
public UsbVendor(ushort id, string vendor)
|
||||
{
|
||||
Id = id;
|
||||
@@ -47,12 +58,27 @@ namespace Aaru.Database.Models
|
||||
AddedWhen = ModifiedWhen = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Database ID
|
||||
/// </summary>
|
||||
[Key]
|
||||
public ushort Id { get; set; }
|
||||
/// <summary>
|
||||
/// Vendor name
|
||||
/// </summary>
|
||||
public string Vendor { get; set; }
|
||||
/// <summary>
|
||||
/// Date when model has been added to the database
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
/// <summary>
|
||||
/// Date when model was last modified
|
||||
/// </summary>
|
||||
public DateTime ModifiedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of products from this vendor
|
||||
/// </summary>
|
||||
public virtual ICollection<UsbProduct> Products { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,8 @@
|
||||
|
||||
namespace Aaru.Database.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Aaru version
|
||||
/// </summary>
|
||||
public class Version : NameCountModel {}
|
||||
}
|
||||
Submodule Aaru.Decoders updated: 6e744af7f3...f7fa226727
@@ -37,6 +37,14 @@ namespace Aaru.Devices
|
||||
{
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Reads the drive buffer using PIO transfer
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadBuffer(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -58,6 +66,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the drive buffer using DMA transfer
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadBufferDma(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -78,10 +94,31 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using 28-bit addressing and DMA transfer, retrying on error
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, byte count,
|
||||
uint timeout, out double duration) =>
|
||||
ReadDma(out buffer, out statusRegisters, true, lba, count, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using 48-bit addressing and DMA transfer
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="retry">Retry on error</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, bool retry, uint lba,
|
||||
byte count, uint timeout, out double duration)
|
||||
{
|
||||
@@ -109,6 +146,16 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using 28-bit addressing and PIO transfer, sending an interrupt only after all the sectors have been transferred
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, byte count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
@@ -137,6 +184,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads native max address using 28-bit addressing
|
||||
/// </summary>
|
||||
/// <param name="lba">Maximum addressable block</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadNativeMaxAddress(out uint lba, out AtaErrorRegistersLba28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -170,10 +225,31 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using 28-bit addressing and PIO transfer, retrying on error
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, byte count,
|
||||
uint timeout, out double duration) =>
|
||||
Read(out buffer, out statusRegisters, true, lba, count, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using 28-bit addressing and PIO transfer, retrying on error
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="retry">Retry on error</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, bool retry, uint lba,
|
||||
byte count, uint timeout, out double duration)
|
||||
{
|
||||
@@ -202,10 +278,31 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a long sector using 28-bit addressing and PIO transfer, retrying on error
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="blockSize">Size in bytes of the long sector</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, uint blockSize,
|
||||
uint timeout, out double duration) =>
|
||||
ReadLong(out buffer, out statusRegisters, true, lba, blockSize, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Reads a long sector using 28-bit addressing and PIO transfer, retrying on error
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="retry">Retry on error</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="blockSize">Size in bytes of the long sector</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, bool retry, uint lba,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
@@ -234,6 +331,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the reading mechanism ready to read the specified block using 28-bit LBA addressing
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="lba">LBA to position reading mechanism ready to read</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool Seek(out AtaErrorRegistersLba28 statusRegisters, uint lba, uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
|
||||
@@ -37,6 +37,14 @@ namespace Aaru.Devices
|
||||
{
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets native max address using 48-bit addressing
|
||||
/// </summary>
|
||||
/// <param name="lba">Maximum addressable block</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -71,6 +79,16 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using 48-bit addressing and DMA transfer
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 65536 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, ulong lba, ushort count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
@@ -100,6 +118,17 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a drive log using PIO transfer
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="logAddress">Log address</param>
|
||||
/// <param name="pageNumber">Log page number</param>
|
||||
/// <param name="count">How log blocks to read</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadLog(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, byte logAddress,
|
||||
ushort pageNumber, ushort count, uint timeout, out double duration)
|
||||
{
|
||||
@@ -126,6 +155,17 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a drive log using DMA transfer
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="logAddress">Log address</param>
|
||||
/// <param name="pageNumber">Log page number</param>
|
||||
/// <param name="count">How log blocks to read</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadLogDma(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, byte logAddress,
|
||||
ushort pageNumber, ushort count, uint timeout, out double duration)
|
||||
{
|
||||
@@ -151,6 +191,16 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using 48-bit addressing and PIO transfer, sending an interrupt only after all the sectors have been transferred
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, ulong lba, ushort count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
@@ -181,6 +231,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads native max address using 48-bit addressing
|
||||
/// </summary>
|
||||
/// <param name="lba">Maximum addressable block</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadNativeMaxAddress(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -216,6 +274,16 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using 48-bit addressing and PIO transfer
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="lba">LBA of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersLba48 statusRegisters, ulong lba, ushort count,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
|
||||
@@ -87,10 +87,35 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using CHS addressing and DMA transfer, retrying on error
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="cylinder">Cylinder of read start</param>
|
||||
/// <param name="head">Head of read start</param>
|
||||
/// <param name="sector">Sector of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head,
|
||||
byte sector, byte count, uint timeout, out double duration) =>
|
||||
ReadDma(out buffer, out statusRegisters, true, cylinder, head, sector, count, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using CHS addressing and DMA transfer
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="retry">Retry on error</param>
|
||||
/// <param name="cylinder">Cylinder of read start</param>
|
||||
/// <param name="head">Head of read start</param>
|
||||
/// <param name="sector">Sector of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadDma(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder,
|
||||
byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
{
|
||||
@@ -116,6 +141,18 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using CHS addressing and PIO transfer, sending an interrupt only after all the sectors have been transferred
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="cylinder">Cylinder of read start</param>
|
||||
/// <param name="head">Head of read start</param>
|
||||
/// <param name="sector">Sector of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder,
|
||||
byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
{
|
||||
@@ -142,10 +179,35 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using CHS addressing and PIO transfer, retrying on error
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="cylinder">Cylinder of read start</param>
|
||||
/// <param name="head">Head of read start</param>
|
||||
/// <param name="sector">Sector of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head,
|
||||
byte sector, byte count, uint timeout, out double duration) =>
|
||||
Read(out buffer, out statusRegisters, true, cylinder, head, sector, count, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Reads sectors using CHS addressing and PIO transfer
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="retry">Retry on error</param>
|
||||
/// <param name="cylinder">Cylinder of read start</param>
|
||||
/// <param name="head">Head of read start</param>
|
||||
/// <param name="sector">Sector of read start</param>
|
||||
/// <param name="count">How many blocks to read, or 0 to indicate 256 blocks</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool Read(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder,
|
||||
byte head, byte sector, byte count, uint timeout, out double duration)
|
||||
{
|
||||
@@ -172,10 +234,35 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a long sector using CHS addressing and PIO transfer, retrying on error
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="cylinder">Cylinder of read start</param>
|
||||
/// <param name="head">Head of read start</param>
|
||||
/// <param name="sector">Sector of read start</param>
|
||||
/// <param name="blockSize">Size in bytes of the long sector</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head,
|
||||
byte sector, uint blockSize, uint timeout, out double duration) =>
|
||||
ReadLong(out buffer, out statusRegisters, true, cylinder, head, sector, blockSize, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Reads a long sector using CHS addressing and PIO transfer, retrying on error
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer that contains the read data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="retry">Retry on error</param>
|
||||
/// <param name="cylinder">Cylinder of read start</param>
|
||||
/// <param name="head">Head of read start</param>
|
||||
/// <param name="sector">Sector of read start</param>
|
||||
/// <param name="blockSize">Size in bytes of the long sector</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadLong(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, bool retry, ushort cylinder,
|
||||
byte head, byte sector, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
@@ -202,6 +289,16 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the reading mechanism ready to read the specified block using CHS addressing
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="cylinder">Cylinder to position reading mechanism ready to read</param>
|
||||
/// <param name="head">Head to position reading mechanism ready to read</param>
|
||||
/// <param name="sector">Sector to position reading mechanism ready to read</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool Seek(out AtaErrorRegistersChs statusRegisters, ushort cylinder, byte head, byte sector,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
@@ -227,10 +324,30 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables drive features
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="feature">Feature to enable</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SetFeatures(out AtaErrorRegistersChs statusRegisters, AtaFeatures feature, uint timeout,
|
||||
out double duration) =>
|
||||
SetFeatures(out statusRegisters, feature, 0, 0, 0, 0, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Enables drive features
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="feature">Feature to enable</param>
|
||||
/// <param name="cylinder">Value for the cylinder register</param>
|
||||
/// <param name="head">Value for the head register</param>
|
||||
/// <param name="sector">Value for the sector register</param>
|
||||
/// <param name="sectorCount">Value for the sector count register</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SetFeatures(out AtaErrorRegistersChs statusRegisters, AtaFeatures feature, ushort cylinder,
|
||||
byte head, byte sector, byte sectorCount, uint timeout, out double duration)
|
||||
{
|
||||
@@ -258,6 +375,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prevents ejection of the media inserted in the drive
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool DoorLock(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
@@ -278,6 +402,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows ejection of the media inserted in the drive
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool DoorUnlock(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
@@ -298,6 +429,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ejects the media inserted in the drive
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool MediaEject(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
|
||||
@@ -37,6 +37,15 @@ namespace Aaru.Devices
|
||||
{
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Requests to translate an LBA to a card physical address
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="lba">LBA to start reading from</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
@@ -64,6 +73,17 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests to translate a CHS to a card physical address
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="cylinder">Cylinder</param>
|
||||
/// <param name="head">Head</param>
|
||||
/// <param name="sector">Sector</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder,
|
||||
byte head, byte sector, uint timeout, out double duration)
|
||||
{
|
||||
@@ -89,6 +109,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests an extended error code
|
||||
/// </summary>
|
||||
/// <param name="errorCode">Error code</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLba28 statusRegisters,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
|
||||
@@ -37,14 +37,36 @@ namespace Aaru.Devices
|
||||
{
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Enables media card pass through
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Status registers.</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool EnableMediaCardPassThrough(out AtaErrorRegistersChs statusRegisters, uint timeout,
|
||||
out double duration) =>
|
||||
CheckMediaCardType(1, out statusRegisters, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Disables media card pass through
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Status registers.</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool DisableMediaCardPassThrough(out AtaErrorRegistersChs statusRegisters, uint timeout,
|
||||
out double duration) =>
|
||||
CheckMediaCardType(0, out statusRegisters, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Checks media card pass through
|
||||
/// </summary>
|
||||
/// <param name="feature">Feature</param>
|
||||
/// <param name="statusRegisters">Status registers.</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool CheckMediaCardType(byte feature, out AtaErrorRegistersChs statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
|
||||
@@ -37,6 +37,13 @@ namespace Aaru.Devices
|
||||
{
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Disables S.M.A.R.T.
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SmartDisable(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
@@ -60,6 +67,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables auto-saving of S.M.A.R.T. attributes
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SmartEnableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -85,6 +99,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables auto-saving of S.M.A.R.T. attributes
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SmartDisableAttributeAutosave(out AtaErrorRegistersLba28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -109,6 +130,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables S.M.A.R.T.
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SmartEnable(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
@@ -132,6 +160,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests drive to execute offline immediate S.M.A.R.T. test
|
||||
/// </summary>
|
||||
/// <param name="subcommand">Subcommand</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SmartExecuteOffLineImmediate(out AtaErrorRegistersLba28 statusRegisters, byte subcommand,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
@@ -157,6 +193,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads S.M.A.R.T. data
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer containing data</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SmartReadData(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -181,6 +225,15 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads S.M.A.R.T. log
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer containing log</param>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="logAddress">Log address</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SmartReadLog(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, byte logAddress,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
@@ -206,6 +259,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves S.M.A.R.T. status
|
||||
/// </summary>
|
||||
/// <param name="statusRegisters">Returned status registers</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SmartReturnStatus(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
|
||||
@@ -242,19 +242,59 @@ namespace Aaru.Devices
|
||||
timeout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encapsulates a single MMC command to send in a queue
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||
public class MmcSingleCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Command argument
|
||||
/// </summary>
|
||||
public uint argument;
|
||||
/// <summary>
|
||||
/// How many blocks to transfer
|
||||
/// </summary>
|
||||
public uint blocks;
|
||||
/// <summary>
|
||||
/// Size of block in bytes
|
||||
/// </summary>
|
||||
public uint blockSize;
|
||||
/// <summary>
|
||||
/// Buffer for MMC/SD command response
|
||||
/// </summary>
|
||||
public byte[] buffer;
|
||||
/// <summary>
|
||||
/// MMC/SD opcode
|
||||
/// </summary>
|
||||
public MmcCommands command;
|
||||
/// <summary>
|
||||
/// Flags indicating kind and place of response
|
||||
/// </summary>
|
||||
public MmcFlags flags;
|
||||
/// <summary>
|
||||
/// <c>True</c> if command should be preceded with CMD55
|
||||
/// </summary>
|
||||
public bool isApplication;
|
||||
/// <summary>
|
||||
/// Response registers
|
||||
/// </summary>
|
||||
public uint[] response;
|
||||
/// <summary>
|
||||
/// <c>True</c> if data is sent from host to card
|
||||
/// </summary>
|
||||
public bool write;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Concatenates a queue of commands to be send to a remote SecureDigital or MultiMediaCard attached to an SDHCI controller
|
||||
/// </summary>
|
||||
/// <param name="commands">List of commands</param>
|
||||
/// <param name="duration">Duration to execute all commands, in milliseconds</param>
|
||||
/// <param name="sense">Set to <c>true</c> if any of the commands returned an error status, <c>false</c> otherwise</param>
|
||||
/// <param name="timeout">Maximum allowed time to execute a single command</param>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
public int SendMultipleMmcCommands(MmcSingleCommand[] commands, out double duration, out bool sense,
|
||||
uint timeout = 15)
|
||||
{
|
||||
@@ -293,6 +333,10 @@ namespace Aaru.Devices
|
||||
return error;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes then immediately reopens a device
|
||||
/// </summary>
|
||||
/// <returns>Returned error number if any</returns>
|
||||
public bool ReOpen()
|
||||
{
|
||||
if(!(_remote is null))
|
||||
@@ -308,6 +352,14 @@ namespace Aaru.Devices
|
||||
return Error;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads data using operating system buffers.
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="offset">Offset in remote device to start reading, in bytes</param>
|
||||
/// <param name="length">Number of bytes to read</param>
|
||||
/// <param name="duration">Total time in milliseconds the reading took</param>
|
||||
/// <returns><c>true</c> if there was an error, <c>false</c> otherwise</returns>
|
||||
public bool BufferedOsRead(out byte[] buffer, long offset, uint length, out double duration)
|
||||
{
|
||||
if(!(_remote is null))
|
||||
|
||||
@@ -59,6 +59,9 @@ using VendorString = Aaru.Decoders.SecureDigital.VendorString;
|
||||
|
||||
namespace Aaru.Devices
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements a device or media containing drive
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "UnusedMember.Global"),
|
||||
SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||
public sealed partial class Device
|
||||
|
||||
@@ -45,6 +45,9 @@ namespace Aaru.Devices
|
||||
/// </summary>
|
||||
~Device() => Close();
|
||||
|
||||
/// <summary>
|
||||
/// Closes a device
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
if(_remote != null)
|
||||
|
||||
@@ -38,35 +38,75 @@ using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
|
||||
|
||||
namespace Aaru.Devices
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains device information
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct DeviceInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Device path
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
|
||||
public string Path;
|
||||
|
||||
/// <summary>
|
||||
/// Device vendor or manufacturer
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string Vendor;
|
||||
|
||||
/// <summary>
|
||||
/// Device model or product name
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string Model;
|
||||
|
||||
/// <summary>
|
||||
/// Device serial number
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string Serial;
|
||||
|
||||
/// <summary>
|
||||
/// Bus the device is attached to
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string Bus;
|
||||
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> if Aaru can send commands to the device in the current machine or remote, <c>false</c> otherwise
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool Supported;
|
||||
|
||||
/// <summary>
|
||||
/// Padding
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public readonly byte[] Padding;
|
||||
}
|
||||
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Lists devices attached to current machine
|
||||
/// </summary>
|
||||
/// <returns>List of devices</returns>
|
||||
public static DeviceInfo[] ListDevices() => ListDevices(out _, out _, out _, out _, out _, out _);
|
||||
|
||||
/// <summary>
|
||||
/// Lists devices attached to current machine or specified remote
|
||||
/// </summary>
|
||||
/// <param name="isRemote">Is remote</param>
|
||||
/// <param name="serverApplication">Remote application</param>
|
||||
/// <param name="serverVersion">Remote application version</param>
|
||||
/// <param name="serverOperatingSystem">Remote operating system name</param>
|
||||
/// <param name="serverOperatingSystemVersion">Remote operating system version</param>
|
||||
/// <param name="serverArchitecture">Remote architecture</param>
|
||||
/// <param name="aaruRemote">Remote URI</param>
|
||||
/// <returns>List of devices</returns>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
public static DeviceInfo[] ListDevices(out bool isRemote, out string serverApplication,
|
||||
out string serverVersion, out string serverOperatingSystem,
|
||||
out string serverOperatingSystemVersion, out string serverArchitecture,
|
||||
|
||||
@@ -37,6 +37,14 @@ namespace Aaru.Devices
|
||||
{
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Reads the CSD register from a SecureDigital or MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadCsd(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[16];
|
||||
@@ -52,6 +60,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the CID register from a SecureDigital or MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadCid(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[16];
|
||||
@@ -67,6 +83,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the OCR register from a MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadOcr(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[4];
|
||||
@@ -82,6 +106,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the extended CSD from a MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadExtendedCsd(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
@@ -97,6 +129,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the block length for transfers from a SecureDigital or MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="length">Block length in bytes</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool SetBlockLength(uint length, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
@@ -112,6 +152,18 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads blocks from a SecureDigital or MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="lba">LBA to start reading from</param>
|
||||
/// <param name="blockSize">Block size in bytes</param>
|
||||
/// <param name="transferLength">Number of bytes to transfer</param>
|
||||
/// <param name="byteAddressed">Card is byte-addressed</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool Read(out byte[] buffer, out uint[] response, uint lba, uint blockSize, ushort transferLength,
|
||||
bool byteAddressed, uint timeout, out double duration)
|
||||
{
|
||||
@@ -134,6 +186,17 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a single block from a SecureDigital or MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="lba">LBA to start reading from</param>
|
||||
/// <param name="blockSize">Block size in bytes</param>
|
||||
/// <param name="byteAddressed">Card is byte-addressed</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadSingleBlock(out byte[] buffer, out uint[] response, uint lba, uint blockSize,
|
||||
bool byteAddressed, uint timeout, out double duration)
|
||||
{
|
||||
@@ -159,6 +222,18 @@ namespace Aaru.Devices
|
||||
|
||||
static bool _readMultipleBlockCannotSetBlockCount;
|
||||
|
||||
/// <summary>
|
||||
/// Reads multiple blocks from a SecureDigital or MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="lba">LBA to start reading from</param>
|
||||
/// <param name="blockSize">Block size in bytes</param>
|
||||
/// <param name="transferLength">Number of bytes to transfer</param>
|
||||
/// <param name="byteAddressed">Card is byte-addressed</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadMultipleBlock(out byte[] buffer, out uint[] response, uint lba, uint blockSize,
|
||||
ushort transferLength, bool byteAddressed, uint timeout, out double duration)
|
||||
{
|
||||
@@ -190,6 +265,18 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads blocks using a single block read from a SecureDigital or MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="lba">LBA to start reading from</param>
|
||||
/// <param name="blockSize">Block size in bytes</param>
|
||||
/// <param name="transferLength">Number of bytes to transfer</param>
|
||||
/// <param name="byteAddressed">Card is byte-addressed</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadMultipleUsingSingle(out byte[] buffer, out uint[] response, uint lba, uint blockSize,
|
||||
ushort transferLength, bool byteAddressed, uint timeout,
|
||||
out double duration)
|
||||
@@ -229,6 +316,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads status register from a MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadStatus(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[4];
|
||||
@@ -244,6 +339,18 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads blocks with block count from a SecureDigital or MultiMediaCard device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="lba">LBA to start reading from</param>
|
||||
/// <param name="blockSize">Block size in bytes</param>
|
||||
/// <param name="transferLength">Number of bytes to transfer</param>
|
||||
/// <param name="byteAddressed">Card is byte-addressed</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadWithBlockCount(out byte[] buffer, out uint[] response, uint lba, uint blockSize,
|
||||
ushort transferLength, bool byteAddressed, uint timeout, out double duration)
|
||||
{
|
||||
|
||||
@@ -36,6 +36,14 @@ namespace Aaru.Devices
|
||||
{
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Reads the status register from a SecureDigital device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadSdStatus(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[64];
|
||||
@@ -51,6 +59,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the OCR register from a SecureDigital device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadSdocr(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[4];
|
||||
@@ -66,6 +82,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the SCR register from a SecureDigital device
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="response">Response</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool ReadScr(out byte[] buffer, out uint[] response, uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[8];
|
||||
|
||||
@@ -39,6 +39,17 @@ namespace Aaru.Devices
|
||||
{
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the data for the integrated display
|
||||
/// </summary>
|
||||
/// <param name="senseBuffer">Returned SENSE buffer</param>
|
||||
/// <param name="flash">If the display should start flashing</param>
|
||||
/// <param name="mode">Display mode</param>
|
||||
/// <param name="firstHalf">String to be shown in the first line of the display</param>
|
||||
/// <param name="secondHalf">String to be shown in the second line of the display</param>
|
||||
/// <param name="timeout">Timeout to wait for command execution</param>
|
||||
/// <param name="duration">Time the device took to execute the command in milliseconds</param>
|
||||
/// <returns><c>true</c> if the device set an error condition, <c>false</c> otherwise</returns>
|
||||
public bool FujitsuDisplay(out byte[] senseBuffer, bool flash, FujitsuDisplayModes mode, string firstHalf,
|
||||
string secondHalf, uint timeout, out double duration)
|
||||
{
|
||||
|
||||
@@ -527,12 +527,29 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>Prevents ejection of the media inserted in the drive</summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool PreventMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration) =>
|
||||
PreventAllowMediumRemoval(out senseBuffer, false, true, timeout, out duration);
|
||||
|
||||
/// <summary>Allows ejection of the media inserted in the drive</summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool AllowMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration) =>
|
||||
PreventAllowMediumRemoval(out senseBuffer, false, false, timeout, out duration);
|
||||
|
||||
/// <summary>Prevents or allows ejection of the media inserted in the drive</summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="persistent">Persistent.</param>
|
||||
/// <param name="prevent">Prevent.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool PreventAllowMediumRemoval(out byte[] senseBuffer, bool persistent, bool prevent, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -560,18 +577,49 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>Loads the media tray</summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool LoadTray(out byte[] senseBuffer, uint timeout, out double duration) =>
|
||||
StartStopUnit(out senseBuffer, false, 0, 0, false, true, true, timeout, out duration);
|
||||
|
||||
/// <summary>Ejects the media or its tray</summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool EjectTray(out byte[] senseBuffer, uint timeout, out double duration) =>
|
||||
StartStopUnit(out senseBuffer, false, 0, 0, false, true, false, timeout, out duration);
|
||||
|
||||
/// <summary>Starts the drive's reading mechanism</summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool StartUnit(out byte[] senseBuffer, uint timeout, out double duration) =>
|
||||
StartStopUnit(out senseBuffer, false, 0, 0, false, false, true, timeout, out duration);
|
||||
|
||||
/// <summary>Stops the drive's reading mechanism</summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool StopUnit(out byte[] senseBuffer, uint timeout, out double duration) =>
|
||||
StartStopUnit(out senseBuffer, false, 0, 0, false, false, false, timeout, out duration);
|
||||
|
||||
/// <summary>Starts or stops the drive's reading mechanism or tray</summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="immediate">Return from execution immediately</param>
|
||||
/// <param name="formatLayer">Choose density layer for hybrid discs</param>
|
||||
/// <param name="powerConditions">Power condition</param>
|
||||
/// <param name="changeFormatLayer">Change format layer</param>
|
||||
/// <param name="loadEject">Loads or ejects the media</param>
|
||||
/// <param name="start">Starts the mechanism</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool StartStopUnit(out byte[] senseBuffer, bool immediate, byte formatLayer, byte powerConditions,
|
||||
bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration)
|
||||
{
|
||||
@@ -613,6 +661,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>Reads the MCN from a disc</summary>
|
||||
/// <param name="mcn">Decoded MCN.</param>
|
||||
/// <param name="buffer">Buffer containing raw drive response.</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool ReadMcn(out string mcn, out byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -645,6 +700,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>Reads the ISRC from a track</summary>
|
||||
/// <param name="trackNumber">Track number.</param>
|
||||
/// <param name="isrc">Decoded ISRC.</param>
|
||||
/// <param name="buffer">Buffer containing raw drive response.</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool ReadIsrc(byte trackNumber, out string isrc, out byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -678,6 +741,14 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>Sets the reading speed</summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="rotationalControl">Rotational control.</param>
|
||||
/// <param name="readSpeed">Read speed.</param>
|
||||
/// <param name="writeSpeed">Write speed.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool SetCdSpeed(out byte[] senseBuffer, RotationalControl rotationalControl, ushort readSpeed,
|
||||
ushort writeSpeed, uint timeout, out double duration)
|
||||
{
|
||||
|
||||
@@ -31,11 +31,18 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using Aaru.Console;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace Aaru.Devices
|
||||
{
|
||||
public sealed partial class Device
|
||||
{
|
||||
/// <summary>Reads the data TOC from an MD-DATA</summary>
|
||||
/// <param name="buffer">Buffer where the response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool MiniDiscReadDataTOC(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
ushort transferLength = 2336;
|
||||
@@ -59,6 +66,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>Reads the user TOC from an MD-DATA</summary>
|
||||
/// <param name="buffer">Buffer where the response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="sector">TOC sector to read</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool MiniDiscReadUserTOC(out byte[] buffer, out byte[] senseBuffer, uint sector, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
@@ -87,6 +101,12 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>Sends a D5h command to a MD-DATA drive (harmless)</summary>
|
||||
/// <param name="buffer">Buffer where the response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool MiniDiscD5(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
ushort transferLength = 4;
|
||||
@@ -110,7 +130,13 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
public bool MiniDiscStopPlaying(out byte[] buffer, out byte[] senseBuffer, uint sector, uint timeout,
|
||||
/// <summary>Stops playing MiniDisc audio from an MD-DATA drive</summary>
|
||||
/// <param name="buffer">Buffer where the response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool MiniDiscStopPlaying(out byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[64];
|
||||
@@ -130,6 +156,12 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>Gets current position while playing MiniDisc audio from an MD-DATA drive</summary>
|
||||
/// <param name="buffer">Buffer where the response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool MiniDiscReadPosition(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
ushort transferLength = 4;
|
||||
@@ -153,6 +185,12 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>Gets MiniDisc type from an MD-DATA drive</summary>
|
||||
/// <param name="buffer">Buffer where the response will be stored</param>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
|
||||
public bool MiniDiscGetType(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
ushort transferLength = 8;
|
||||
|
||||
@@ -777,9 +777,24 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests the device fixed sense
|
||||
/// </summary>
|
||||
/// <param name="buffer">Sense buffer</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed.</returns>
|
||||
public bool RequestSense(out byte[] buffer, uint timeout, out double duration) =>
|
||||
RequestSense(false, out buffer, timeout, out duration);
|
||||
|
||||
/// <summary>
|
||||
/// Requests the device sense
|
||||
/// </summary>
|
||||
/// <param name="descriptor">Request a descriptor sense</param>
|
||||
/// <param name="buffer">Sense buffer</param>
|
||||
/// <param name="timeout">Timeout in seconds.</param>
|
||||
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
|
||||
/// <returns><c>true</c> if the command failed.</returns>
|
||||
public bool RequestSense(bool descriptor, out byte[] buffer, uint timeout, out double duration)
|
||||
{
|
||||
byte[] cdb = new byte[6];
|
||||
|
||||
@@ -952,6 +952,15 @@ namespace Aaru.Devices
|
||||
return sense;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes a space mark in the media
|
||||
/// </summary>
|
||||
/// <param name="senseBuffer">Sense buffer.</param>
|
||||
/// <param name="code">Space type code.</param>
|
||||
/// <param name="count">How many marks to write</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
/// <returns><c>true</c>, if select was tracked, <c>false</c> otherwise.</returns>
|
||||
public bool Space(out byte[] senseBuffer, SscSpaceCodes code, int count, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[64];
|
||||
|
||||
@@ -166,6 +166,9 @@ namespace Aaru.Devices
|
||||
bool? _isRemoteAdmin;
|
||||
readonly string _devicePath;
|
||||
|
||||
/// <summary>
|
||||
/// Returns if remote is running under administrative (aka root) privileges
|
||||
/// </summary>
|
||||
public bool IsRemoteAdmin
|
||||
{
|
||||
get
|
||||
@@ -176,12 +179,33 @@ namespace Aaru.Devices
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current device is remote
|
||||
/// </summary>
|
||||
public bool IsRemote => _remote != null;
|
||||
/// <summary>
|
||||
/// Remote application
|
||||
/// </summary>
|
||||
public string RemoteApplication => _remote?.ServerApplication;
|
||||
/// <summary>
|
||||
/// Remote application server
|
||||
/// </summary>
|
||||
public string RemoteVersion => _remote?.ServerVersion;
|
||||
/// <summary>
|
||||
/// Remote operating system name
|
||||
/// </summary>
|
||||
public string RemoteOperatingSystem => _remote?.ServerOperatingSystem;
|
||||
/// <summary>
|
||||
/// Remote operating system version
|
||||
/// </summary>
|
||||
public string RemoteOperatingSystemVersion => _remote?.ServerOperatingSystemVersion;
|
||||
/// <summary>
|
||||
/// Remote architecture
|
||||
/// </summary>
|
||||
public string RemoteArchitecture => _remote?.ServerArchitecture;
|
||||
/// <summary>
|
||||
/// Remote protocol version
|
||||
/// </summary>
|
||||
public int RemoteProtocolVersion => _remote?.ServerProtocolVersion ?? 0;
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
#pragma warning disable 1591
|
||||
|
||||
// ReSharper disable UnusedType.Global
|
||||
|
||||
|
||||
@@ -32,11 +32,26 @@
|
||||
|
||||
namespace Aaru.Devices.Remote
|
||||
{
|
||||
/// <summary>
|
||||
/// AaruRemote protocol constants
|
||||
/// </summary>
|
||||
public class Consts
|
||||
{
|
||||
/// <summary>
|
||||
/// Primary unique packet identifier
|
||||
/// </summary>
|
||||
public const uint REMOTE_ID = 0x52434944; // "DICR"
|
||||
/// <summary>
|
||||
/// Secondary unique packet identifier
|
||||
/// </summary>
|
||||
public const uint PACKET_ID = 0x544B4350; // "PCKT"
|
||||
/// <summary>
|
||||
/// Default packet version
|
||||
/// </summary>
|
||||
public const int PACKET_VERSION = 1;
|
||||
/// <summary>
|
||||
/// Maximum supported protocol version
|
||||
/// </summary>
|
||||
public const int MAX_PROTOCOL = 2;
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,12 @@
|
||||
|
||||
namespace Aaru.Devices.Remote
|
||||
{
|
||||
/// <summary>
|
||||
/// Packet type enumeration
|
||||
/// </summary>
|
||||
public enum AaruPacketType : sbyte
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
Nop = -1, Hello = 1, CommandListDevices = 2,
|
||||
ResponseListDevices = 3, CommandOpen = 4, CommandScsi = 5,
|
||||
ResponseScsi = 6, CommandAtaChs = 7, ResponseAtaChs = 8,
|
||||
@@ -45,12 +49,45 @@ namespace Aaru.Devices.Remote
|
||||
ResponseGetPcmciaData = 24, CommandCloseDevice = 25, CommandAmIRoot = 26,
|
||||
ResponseAmIRoot = 27, MultiCommandSdhci = 28, ResponseMultiSdhci = 29,
|
||||
CommandReOpenDevice = 30, CommandOsRead = 31, ResponseOsRead = 32
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reasons for non-data request or response
|
||||
/// </summary>
|
||||
public enum AaruNopReason : byte
|
||||
{
|
||||
OutOfOrder = 0, NotImplemented = 1, NotRecognized = 2,
|
||||
ErrorListDevices = 3, OpenOk = 4, OpenError = 5,
|
||||
ReOpenOk = 6, CloseError = 7
|
||||
/// <summary>
|
||||
/// Request or response has arrived unexpectedly
|
||||
/// </summary>
|
||||
OutOfOrder = 0,
|
||||
/// <summary>
|
||||
/// Packet or version of packet is not implemented
|
||||
/// </summary>
|
||||
NotImplemented = 1,
|
||||
/// <summary>
|
||||
/// Unknown or non-recognized packet
|
||||
/// </summary>
|
||||
NotRecognized = 2,
|
||||
/// <summary>
|
||||
/// Error trying to get list of devices
|
||||
/// </summary>
|
||||
ErrorListDevices = 3,
|
||||
/// <summary>
|
||||
/// Device opened correctly
|
||||
/// </summary>
|
||||
OpenOk = 4,
|
||||
/// <summary>
|
||||
/// An error occurred opening the device
|
||||
/// </summary>
|
||||
OpenError = 5,
|
||||
/// <summary>
|
||||
/// Device re-opened correctly
|
||||
/// </summary>
|
||||
ReOpenOk = 6,
|
||||
/// <summary>
|
||||
/// An error occurred closing the device
|
||||
/// </summary>
|
||||
CloseError = 7
|
||||
}
|
||||
}
|
||||
@@ -43,14 +43,26 @@ using Aaru.Console;
|
||||
using Aaru.Decoders.ATA;
|
||||
using Marshal = Aaru.Helpers.Marshal;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
// ReSharper disable MemberCanBeInternal
|
||||
|
||||
namespace Aaru.Devices.Remote
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Handles communication with a remote device that's connected using the AaruRemote protocol
|
||||
/// </summary>
|
||||
public class Remote : IDisposable
|
||||
{
|
||||
readonly string _host;
|
||||
readonly Socket _socket;
|
||||
|
||||
/// <summary>
|
||||
/// Connects using TCP/IP to the specified remote
|
||||
/// </summary>
|
||||
/// <param name="uri">URI of the remote</param>
|
||||
/// <exception cref="ArgumentException">Unsupported or invalid remote protocol.</exception>
|
||||
/// <exception cref="SocketException">Host not found.</exception>
|
||||
/// <exception cref="IOException">Network error.</exception>
|
||||
public Remote(Uri uri)
|
||||
{
|
||||
if(uri.Scheme != "aaru" &&
|
||||
@@ -185,13 +197,34 @@ namespace Aaru.Devices.Remote
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remote server application
|
||||
/// </summary>
|
||||
public string ServerApplication { get; }
|
||||
/// <summary>
|
||||
/// Remote server application version
|
||||
/// </summary>
|
||||
public string ServerVersion { get; }
|
||||
/// <summary>
|
||||
/// Remote server operating system
|
||||
/// </summary>
|
||||
public string ServerOperatingSystem { get; }
|
||||
/// <summary>
|
||||
/// Remote server operating system version
|
||||
/// </summary>
|
||||
public string ServerOperatingSystemVersion { get; }
|
||||
/// <summary>
|
||||
/// Remote server architecture
|
||||
/// </summary>
|
||||
public string ServerArchitecture { get; }
|
||||
/// <summary>
|
||||
/// Remote server protocol version
|
||||
/// </summary>
|
||||
public int ServerProtocolVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Is remote running with administrative (aka root) privileges?
|
||||
/// </summary>
|
||||
public bool IsRoot
|
||||
{
|
||||
get
|
||||
@@ -264,8 +297,12 @@ namespace Aaru.Devices.Remote
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose() => Disconnect();
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects from remote
|
||||
/// </summary>
|
||||
public void Disconnect()
|
||||
{
|
||||
try
|
||||
@@ -279,6 +316,10 @@ namespace Aaru.Devices.Remote
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists devices attached to remote
|
||||
/// </summary>
|
||||
/// <returns>List of devices</returns>
|
||||
public DeviceInfo[] ListDevices()
|
||||
{
|
||||
var cmdPkt = new AaruPacketCommandListDevices
|
||||
@@ -387,6 +428,13 @@ namespace Aaru.Devices.Remote
|
||||
return devices.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the specified device path on the remote
|
||||
/// </summary>
|
||||
/// <param name="devicePath">Device path</param>
|
||||
/// <param name="lastError">Returned error</param>
|
||||
/// <returns><c>true</c> if opened correctly, <c>false</c>otherwise</returns>
|
||||
/// <exception cref="NotImplementedException">Support for the specified device has not yet been implemented in the remote application.</exception>
|
||||
public bool Open(string devicePath, out int lastError)
|
||||
{
|
||||
lastError = 0;
|
||||
@@ -474,6 +522,18 @@ namespace Aaru.Devices.Remote
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Sends a SCSI command to the remote device</summary>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
/// <param name="cdb">SCSI CDB</param>
|
||||
/// <param name="buffer">Buffer for SCSI command response</param>
|
||||
/// <param name="senseBuffer">Buffer with the SCSI sense</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="direction">SCSI command transfer direction</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense">
|
||||
/// <c>True</c> if SCSI command returned non-OK status and <paramref name="senseBuffer" /> contains
|
||||
/// SCSI sense
|
||||
/// </param>
|
||||
public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout,
|
||||
ScsiDirection direction, out double duration, out bool sense)
|
||||
{
|
||||
@@ -572,6 +632,20 @@ namespace Aaru.Devices.Remote
|
||||
return (int)res.error_no;
|
||||
}
|
||||
|
||||
/// <summary>Sends an ATA/ATAPI command to the remote device using CHS addressing</summary>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
/// <param name="registers">ATA registers.</param>
|
||||
/// <param name="errorRegisters">Status/error registers.</param>
|
||||
/// <param name="protocol">ATA Protocol.</param>
|
||||
/// <param name="transferRegister">Indicates which register indicates the transfer length</param>
|
||||
/// <param name="buffer">Buffer for ATA/ATAPI command response</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="transferBlocks">
|
||||
/// If set to <c>true</c>, transfer is indicated in blocks, otherwise, it is indicated in
|
||||
/// bytes.
|
||||
/// </param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if ATA/ATAPI command returned non-OK status</param>
|
||||
public int SendAtaCommand(AtaRegistersChs registers, out AtaErrorRegistersChs errorRegisters,
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||
@@ -667,6 +741,20 @@ namespace Aaru.Devices.Remote
|
||||
return (int)res.error_no;
|
||||
}
|
||||
|
||||
/// <summary>Sends an ATA/ATAPI command to the remote device using 28-bit LBA addressing</summary>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
/// <param name="registers">ATA registers.</param>
|
||||
/// <param name="errorRegisters">Status/error registers.</param>
|
||||
/// <param name="protocol">ATA Protocol.</param>
|
||||
/// <param name="transferRegister">Indicates which register indicates the transfer length</param>
|
||||
/// <param name="buffer">Buffer for ATA/ATAPI command response</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="transferBlocks">
|
||||
/// If set to <c>true</c>, transfer is indicated in blocks, otherwise, it is indicated in
|
||||
/// bytes.
|
||||
/// </param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if ATA/ATAPI command returned non-OK status</param>
|
||||
public int SendAtaCommand(AtaRegistersLba28 registers, out AtaErrorRegistersLba28 errorRegisters,
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||
@@ -763,6 +851,20 @@ namespace Aaru.Devices.Remote
|
||||
return (int)res.error_no;
|
||||
}
|
||||
|
||||
/// <summary>Sends an ATA/ATAPI command to the remote device using 48-bit LBA addressing</summary>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
/// <param name="registers">ATA registers.</param>
|
||||
/// <param name="errorRegisters">Status/error registers.</param>
|
||||
/// <param name="protocol">ATA Protocol.</param>
|
||||
/// <param name="transferRegister">Indicates which register indicates the transfer length</param>
|
||||
/// <param name="buffer">Buffer for ATA/ATAPI command response</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="transferBlocks">
|
||||
/// If set to <c>true</c>, transfer is indicated in blocks, otherwise, it is indicated in
|
||||
/// bytes.
|
||||
/// </param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if ATA/ATAPI command returned non-OK status</param>
|
||||
public int SendAtaCommand(AtaRegistersLba48 registers, out AtaErrorRegistersLba48 errorRegisters,
|
||||
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
|
||||
uint timeout, bool transferBlocks, out double duration, out bool sense)
|
||||
@@ -859,6 +961,20 @@ namespace Aaru.Devices.Remote
|
||||
return (int)res.error_no;
|
||||
}
|
||||
|
||||
/// <summary>Sends a MMC/SD command to the remote device</summary>
|
||||
/// <returns>The result of the command.</returns>
|
||||
/// <param name="command">MMC/SD opcode</param>
|
||||
/// <param name="buffer">Buffer for MMC/SD command response</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if MMC/SD returned non-OK status</param>
|
||||
/// <param name="write"><c>True</c> if data is sent from host to card</param>
|
||||
/// <param name="isApplication"><c>True</c> if command should be preceded with CMD55</param>
|
||||
/// <param name="flags">Flags indicating kind and place of response</param>
|
||||
/// <param name="blocks">How many blocks to transfer</param>
|
||||
/// <param name="argument">Command argument</param>
|
||||
/// <param name="response">Response registers</param>
|
||||
/// <param name="blockSize">Size of block in bytes</param>
|
||||
public int SendMmcCommand(MmcCommands command, bool write, bool isApplication, MmcFlags flags, uint argument,
|
||||
uint blockSize, uint blocks, ref byte[] buffer, out uint[] response,
|
||||
out double duration, out bool sense, uint timeout = 0)
|
||||
@@ -964,6 +1080,10 @@ namespace Aaru.Devices.Remote
|
||||
return (int)res.res.error_no;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="DeviceType"/> for the remote device
|
||||
/// </summary>
|
||||
/// <returns><see cref="DeviceType"/></returns>
|
||||
public DeviceType GetDeviceType()
|
||||
{
|
||||
var cmdPkt = new AaruPacketCmdGetDeviceType
|
||||
@@ -1033,6 +1153,14 @@ namespace Aaru.Devices.Remote
|
||||
return res.device_type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the SDHCI registers from the remote device
|
||||
/// </summary>
|
||||
/// <param name="csd">CSD register</param>
|
||||
/// <param name="cid">CID register</param>
|
||||
/// <param name="ocr">OCR register</param>
|
||||
/// <param name="scr">SCR register</param>
|
||||
/// <returns><c>true</c> if the device is attached to an SDHCI controller, <c>false</c> otherwise</returns>
|
||||
public bool GetSdhciRegisters(out byte[] csd, out byte[] cid, out byte[] ocr, out byte[] scr)
|
||||
{
|
||||
csd = null;
|
||||
@@ -1148,6 +1276,16 @@ namespace Aaru.Devices.Remote
|
||||
return res.isSdhci;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the USB data from the remote device
|
||||
/// </summary>
|
||||
/// <param name="descriptors">USB descriptors</param>
|
||||
/// <param name="idVendor">USB vendor ID</param>
|
||||
/// <param name="idProduct">USB product ID</param>
|
||||
/// <param name="manufacturer">USB manufacturer string</param>
|
||||
/// <param name="product">USB product string</param>
|
||||
/// <param name="serial">USB serial number string</param>
|
||||
/// <returns><c>true</c> if the device is attached via USB, <c>false</c> otherwise</returns>
|
||||
public bool GetUsbData(out byte[] descriptors, out ushort idVendor, out ushort idProduct,
|
||||
out string manufacturer, out string product, out string serial)
|
||||
{
|
||||
@@ -1235,6 +1373,15 @@ namespace Aaru.Devices.Remote
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the FireWire data from the remote device
|
||||
/// </summary>
|
||||
/// <param name="idVendor">FireWire vendor ID</param>
|
||||
/// <param name="idProduct">FireWire product ID</param>
|
||||
/// <param name="vendor">FireWire vendor string</param>
|
||||
/// <param name="model">FireWire model string</param>
|
||||
/// <param name="guid">FireWire GUID</param>
|
||||
/// <returns><c>true</c> if the device is attached via FireWire, <c>false</c> otherwise</returns>
|
||||
public bool GetFireWireData(out uint idVendor, out uint idProduct, out ulong guid, out string vendor,
|
||||
out string model)
|
||||
{
|
||||
@@ -1321,6 +1468,11 @@ namespace Aaru.Devices.Remote
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PCMCIA/CardBus data from the remote device
|
||||
/// </summary>
|
||||
/// <param name="cis">Card Information Structure</param>
|
||||
/// <returns><c>true</c> if the device is attached via PCMCIA or CardBus, <c>false</c> otherwise</returns>
|
||||
public bool GetPcmciaData(out byte[] cis)
|
||||
{
|
||||
cis = null;
|
||||
@@ -1397,6 +1549,14 @@ namespace Aaru.Devices.Remote
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Receives data from a socket into a buffer
|
||||
/// </summary>
|
||||
/// <param name="socket">Socket</param>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="size">Expected total size in bytes</param>
|
||||
/// <param name="socketFlags">Socket flags</param>
|
||||
/// <returns>Retrieved number of bytes</returns>
|
||||
static int Receive(Socket socket, byte[] buffer, int size, SocketFlags socketFlags)
|
||||
{
|
||||
int offset = 0;
|
||||
@@ -1415,6 +1575,9 @@ namespace Aaru.Devices.Remote
|
||||
return offset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the remote device, without closing the network connection
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
var cmdPkt = new AaruPacketCmdClose
|
||||
@@ -1441,6 +1604,14 @@ namespace Aaru.Devices.Remote
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Concatenates a queue of commands to be send to a remote SecureDigital or MultiMediaCard attached to an SDHCI controller
|
||||
/// </summary>
|
||||
/// <param name="commands">List of commands</param>
|
||||
/// <param name="duration">Duration to execute all commands, in milliseconds</param>
|
||||
/// <param name="sense">Set to <c>true</c> if any of the commands returned an error status, <c>false</c> otherwise</param>
|
||||
/// <param name="timeout">Maximum allowed time to execute a single command</param>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
public int SendMultipleMmcCommands(Device.MmcSingleCommand[] commands, out double duration, out bool sense,
|
||||
uint timeout = 0)
|
||||
{
|
||||
@@ -1599,6 +1770,14 @@ namespace Aaru.Devices.Remote
|
||||
return error;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Concatenates a queue of commands to be send to a remote SecureDigital or MultiMediaCard attached to an SDHCI controller, using protocol version 1 without specific support for such a queueing
|
||||
/// </summary>
|
||||
/// <param name="commands">List of commands</param>
|
||||
/// <param name="duration">Duration to execute all commands, in milliseconds</param>
|
||||
/// <param name="sense">Set to <c>true</c> if any of the commands returned an error status, <c>false</c> otherwise</param>
|
||||
/// <param name="timeout">Maximum allowed time to execute a single command</param>
|
||||
/// <returns>0 if no error occurred, otherwise, errno</returns>
|
||||
int SendMultipleMmcCommandsV1(Device.MmcSingleCommand[] commands, out double duration, out bool sense,
|
||||
uint timeout)
|
||||
{
|
||||
@@ -1621,6 +1800,10 @@ namespace Aaru.Devices.Remote
|
||||
return error;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes then immediately reopens a remote device
|
||||
/// </summary>
|
||||
/// <returns>Returned error number if any</returns>
|
||||
public bool ReOpen()
|
||||
{
|
||||
if(ServerProtocolVersion < 2)
|
||||
@@ -1713,6 +1896,14 @@ namespace Aaru.Devices.Remote
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads data using operating system buffers.
|
||||
/// </summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
/// <param name="offset">Offset in remote device to start reading, in bytes</param>
|
||||
/// <param name="length">Number of bytes to read</param>
|
||||
/// <param name="duration">Total time in milliseconds the reading took</param>
|
||||
/// <returns><c>true</c> if there was an error, <c>false</c> otherwise</returns>
|
||||
public bool BufferedOsRead(out byte[] buffer, long offset, uint length, out double duration)
|
||||
{
|
||||
duration = 0;
|
||||
|
||||
@@ -33,385 +33,839 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.Decoders.ATA;
|
||||
// ReSharper disable MemberCanBeInternal
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable FieldCanBeMadeReadOnly.Global
|
||||
// ReSharper disable IdentifierTypo
|
||||
|
||||
namespace Aaru.Devices.Remote
|
||||
{
|
||||
/// <summary>
|
||||
/// Header for any Aaru remote packet
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique Aaru packet identifier (primary)
|
||||
/// </summary>
|
||||
public uint remote_id;
|
||||
/// <summary>
|
||||
/// Unique Aaru packet identifier (secondary)
|
||||
/// </summary>
|
||||
public uint packet_id;
|
||||
|
||||
/// <summary>
|
||||
/// Packet length
|
||||
/// </summary>
|
||||
public uint len;
|
||||
/// <summary>
|
||||
/// Packet version
|
||||
/// </summary>
|
||||
public byte version;
|
||||
/// <summary>
|
||||
/// Unique Aaru packet type identifier
|
||||
/// </summary>
|
||||
public AaruPacketType packetType;
|
||||
|
||||
/// <summary>
|
||||
/// Spare for expansion (or alignment)
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public readonly byte[] spare;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hello packet, identifies a remote initiator with a responder
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketHello
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
|
||||
/// <summary>
|
||||
/// Application name
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||
public string application;
|
||||
|
||||
/// <summary>
|
||||
/// Application version
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
|
||||
public string version;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum supported protocol version
|
||||
/// </summary>
|
||||
public byte maxProtocol;
|
||||
|
||||
/// <summary>
|
||||
/// Spare for expansion (or alignment)
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public readonly byte[] spare;
|
||||
|
||||
/// <summary>
|
||||
/// Operating system name
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string sysname;
|
||||
|
||||
/// <summary>
|
||||
/// Operating system version / release
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string release;
|
||||
|
||||
/// <summary>
|
||||
/// Operating system machine / architecture
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string machine;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request a list of device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCommandListDevices
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the requested list of devices
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public readonly struct AaruPacketResponseListDevices
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public readonly AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// How many device descriptors follows this structure in the packet
|
||||
/// </summary>
|
||||
public readonly ushort devices;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a request or returns a response that requires no intervention or further processing
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketNop
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Reason code
|
||||
/// </summary>
|
||||
public AaruNopReason reasonCode;
|
||||
|
||||
/// <summary>
|
||||
/// Spare for expansion (or alignment)
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public readonly byte[] spare;
|
||||
|
||||
/// <summary>
|
||||
/// Reason name
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string reason;
|
||||
|
||||
/// <summary>
|
||||
/// Operating system error number
|
||||
/// </summary>
|
||||
public int errno;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests to open a device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCommandOpenDevice
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
|
||||
/// <summary>
|
||||
/// Device path
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
|
||||
public string device_path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests remote to send a command to a SCSI device. This header is followed by the CDB and after it comes the buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdScsi
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Length in bytes of the CDB that follows this structure
|
||||
/// </summary>
|
||||
public uint cdb_len;
|
||||
/// <summary>
|
||||
/// Length in bytes of the buffer that follows the CDB
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
/// <summary>
|
||||
/// Direction of SCSI data transfer
|
||||
/// </summary>
|
||||
public int direction;
|
||||
/// <summary>
|
||||
/// Timeout waiting for device to respond to command
|
||||
/// </summary>
|
||||
public uint timeout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the response from a command sent to a SCSI device. This structure is followed by the buffer containing the REQUEST SENSE response and this is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResScsi
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Size the REQUEST SENSE buffer that follows this structure
|
||||
/// </summary>
|
||||
public uint sense_len;
|
||||
/// <summary>
|
||||
/// Length in bytes of the data buffer that follows the sense buffer
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
/// <summary>
|
||||
/// Time in milliseconds it took for the device to execute the command
|
||||
/// </summary>
|
||||
public uint duration;
|
||||
/// <summary>
|
||||
/// Set to anything different of zero if there was a SENSE returned
|
||||
/// </summary>
|
||||
public uint sense;
|
||||
/// <summary>
|
||||
/// Set to the remote operating system error number
|
||||
/// </summary>
|
||||
public uint error_no;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests remote to send a command to an ATA device using the CHS command set. This header is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdAtaChs
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Length in bytes of the data buffer
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
/// <summary>
|
||||
/// Registers to set in the ATA device
|
||||
/// </summary>
|
||||
public AtaRegistersChs registers;
|
||||
/// <summary>
|
||||
/// ATA protocol code
|
||||
/// </summary>
|
||||
public byte protocol;
|
||||
/// <summary>
|
||||
/// ATA transfer register indicator
|
||||
/// </summary>
|
||||
public byte transferRegister;
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> to transfer blocks, <c>false</c> to transfer bytes
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool transferBlocks;
|
||||
/// <summary>
|
||||
/// Spare for expansion (or alignment)
|
||||
/// </summary>
|
||||
public byte spare;
|
||||
/// <summary>
|
||||
/// Timeout waiting for device to respond to command
|
||||
/// </summary>
|
||||
public uint timeout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the response from a command sent to an ATA device using the CHS command set. This structure is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResAtaChs
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Length in bytes of the data buffer
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
/// <summary>
|
||||
/// Registers as set back by the ATA device
|
||||
/// </summary>
|
||||
public AtaErrorRegistersChs registers;
|
||||
/// <summary>
|
||||
/// Time in milliseconds it took for the device to execute the command
|
||||
/// </summary>
|
||||
public uint duration;
|
||||
/// <summary>
|
||||
/// Set to anything different of zero if the device set an error condition
|
||||
/// </summary>
|
||||
public uint sense;
|
||||
/// <summary>
|
||||
/// Set to the remote operating system error number
|
||||
/// </summary>
|
||||
public uint error_no;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests remote to send a command to an ATA device using the 28-bit command set. This header is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdAtaLba28
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Length in bytes of the data buffer
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
/// <summary>
|
||||
/// Registers to set in the ATA device
|
||||
/// </summary>
|
||||
public AtaRegistersLba28 registers;
|
||||
/// <summary>
|
||||
/// ATA protocol code
|
||||
/// </summary>
|
||||
public byte protocol;
|
||||
/// <summary>
|
||||
/// ATA transfer register indicator
|
||||
/// </summary>
|
||||
public byte transferRegister;
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> to transfer blocks, <c>false</c> to transfer bytes
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool transferBlocks;
|
||||
/// <summary>
|
||||
/// Spare for expansion (or alignment)
|
||||
/// </summary>
|
||||
public byte spare;
|
||||
/// <summary>
|
||||
/// Timeout waiting for device to respond to command
|
||||
/// </summary>
|
||||
public uint timeout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the response from a command sent to an ATA device using the 28-bit LBA command set. This structure is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResAtaLba28
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Length in bytes of the data buffer
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
/// <summary>
|
||||
/// Registers as set back by the ATA device
|
||||
/// </summary>
|
||||
public AtaErrorRegistersLba28 registers;
|
||||
/// <summary>
|
||||
/// Time in milliseconds it took for the device to execute the command
|
||||
/// </summary>
|
||||
public uint duration;
|
||||
/// <summary>
|
||||
/// Set to anything different of zero if the device set an error condition
|
||||
/// </summary>
|
||||
public uint sense;
|
||||
/// <summary>
|
||||
/// Set to the remote operating system error number
|
||||
/// </summary>
|
||||
public uint error_no;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests remote to send a command to an ATA device using the 48-bit command set. This header is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdAtaLba48
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Length in bytes of the data buffer
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
/// <summary>
|
||||
/// Registers to set in the ATA device
|
||||
/// </summary>
|
||||
public AtaRegistersLba48 registers;
|
||||
/// <summary>
|
||||
/// ATA protocol code
|
||||
/// </summary>
|
||||
public byte protocol;
|
||||
/// <summary>
|
||||
/// ATA transfer register indicator
|
||||
/// </summary>
|
||||
public byte transferRegister;
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> to transfer blocks, <c>false</c> to transfer bytes
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool transferBlocks;
|
||||
/// <summary>
|
||||
/// Spare for expansion (or alignment)
|
||||
/// </summary>
|
||||
public byte spare;
|
||||
/// <summary>
|
||||
/// Timeout waiting for device to respond to command
|
||||
/// </summary>
|
||||
public uint timeout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the response from a command sent to an ATA device using the 48-bit LBA command set. This structure is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResAtaLba48
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Length in bytes of the data buffer
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
/// <summary>
|
||||
/// Registers as set back by the ATA device
|
||||
/// </summary>
|
||||
public AtaErrorRegistersLba48 registers;
|
||||
/// <summary>
|
||||
/// Time in milliseconds it took for the device to execute the command
|
||||
/// </summary>
|
||||
public uint duration;
|
||||
/// <summary>
|
||||
/// Set to anything different of zero if the device set an error condition
|
||||
/// </summary>
|
||||
public uint sense;
|
||||
/// <summary>
|
||||
/// Set to the remote operating system error number
|
||||
/// </summary>
|
||||
public uint error_no;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SecureDigital or MultiMediaCard command description
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruCmdSdhci
|
||||
{
|
||||
/// <summary>
|
||||
/// Command
|
||||
/// </summary>
|
||||
public MmcCommands command;
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> if the command writes to the device, <c>false</c> otherwise
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool write;
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> if it is an application command, <c>false</c> otherwise
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool application;
|
||||
/// <summary>
|
||||
/// Flags
|
||||
/// </summary>
|
||||
public MmcFlags flags;
|
||||
/// <summary>
|
||||
/// Argument
|
||||
/// </summary>
|
||||
public uint argument;
|
||||
/// <summary>
|
||||
/// Block size
|
||||
/// </summary>
|
||||
public uint block_size;
|
||||
/// <summary>
|
||||
/// Number of blocks to transfer
|
||||
/// </summary>
|
||||
public uint blocks;
|
||||
/// <summary>
|
||||
/// Length in bytes of the data buffer
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
/// <summary>
|
||||
/// Timeout waiting for device to respond to command
|
||||
/// </summary>
|
||||
public uint timeout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests remote to send a command to a SecureDigital or MultiMediaCard device attached using a SDHCI controller. This structure is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdSdhci
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// SecureDigital or MultiMediaCard command description
|
||||
/// </summary>
|
||||
public AaruCmdSdhci command;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the response from a command sent to a SecureDigital or MultiMediaCard device attached to a SDHCI controller. This structure is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruResSdhci
|
||||
{
|
||||
/// <summary>
|
||||
/// Length in bytes of the data buffer
|
||||
/// </summary>
|
||||
public uint buf_len;
|
||||
|
||||
/// <summary>
|
||||
/// Response registers
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
public uint[] response;
|
||||
|
||||
/// <summary>
|
||||
/// Time in milliseconds it took for the device to execute the command
|
||||
/// </summary>
|
||||
public uint duration;
|
||||
/// <summary>
|
||||
/// Set to anything different of zero if the device set an error condition
|
||||
/// </summary>
|
||||
public uint sense;
|
||||
/// <summary>
|
||||
/// Set to the remote operating system error number
|
||||
/// </summary>
|
||||
public uint error_no;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the response from a command sent to a SecureDigital or MultiMediaCard device attached to a SDHCI controller. This structure is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResSdhci
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Response
|
||||
/// </summary>
|
||||
public AaruResSdhci res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests the Aaru device type for the opened device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdGetDeviceType
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Aaru device type for the opened device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResGetDeviceType
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Aaru's device type
|
||||
/// </summary>
|
||||
public DeviceType device_type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests the registers of a SecureDigital or MultiMediaCard attached to an SDHCI controller
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdGetSdhciRegisters
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the registers of a SecureDigital or MultiMediaCard attached to an SDHCI controller
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResGetSdhciRegisters
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// <c>true</c> if the device is attached to an SDHCI controller and the rest of the fields on this packet are valid, <c>false</c> otherwise
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool isSdhci;
|
||||
|
||||
/// <summary>
|
||||
/// CSD registers
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] csd;
|
||||
|
||||
/// <summary>
|
||||
/// CID registers
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] cid;
|
||||
|
||||
/// <summary>
|
||||
/// OCR registers
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
public byte[] ocr;
|
||||
|
||||
/// <summary>
|
||||
/// SCR registers
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public byte[] scr;
|
||||
|
||||
/// <summary>
|
||||
/// Length of the CSD registers
|
||||
/// </summary>
|
||||
public uint csd_len;
|
||||
/// <summary>
|
||||
/// Length of the CID registers
|
||||
/// </summary>
|
||||
public uint cid_len;
|
||||
/// <summary>
|
||||
/// Length of the OCR registers
|
||||
/// </summary>
|
||||
public uint ocr_len;
|
||||
/// <summary>
|
||||
/// Length of the SCR registers
|
||||
/// </summary>
|
||||
public uint scr_len;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests information about the USB connection of the opened device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdGetUsbData
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns information about the USB connection of the opened device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResGetUsbData
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// <c>true</c> if the device is attached using USB and the rest of the fields on this packet are valid, <c>false</c> otherwise
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool isUsb;
|
||||
/// <summary>
|
||||
/// Length of the descriptors
|
||||
/// </summary>
|
||||
public ushort descLen;
|
||||
|
||||
/// <summary>
|
||||
/// Raw USB descriptors
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65536)]
|
||||
public byte[] descriptors;
|
||||
|
||||
/// <summary>
|
||||
/// USB vendor ID
|
||||
/// </summary>
|
||||
public ushort idVendor;
|
||||
/// <summary>
|
||||
/// USB product ID
|
||||
/// </summary>
|
||||
public ushort idProduct;
|
||||
|
||||
/// <summary>
|
||||
/// USB manufacturer string
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string manufacturer;
|
||||
|
||||
/// <summary>
|
||||
/// USB product string
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string product;
|
||||
|
||||
/// <summary>
|
||||
/// USB serial number string
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string serial;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests information about the FireWire connection of the opened device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdGetFireWireData
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns information about the FireWire connection of the opened device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResGetFireWireData
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// <c>true</c> if the device is attached using FireWire and the rest of the fields on this packet are valid, <c>false</c> otherwise
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool isFireWire;
|
||||
/// <summary>
|
||||
/// FireWire model ID
|
||||
/// </summary>
|
||||
public uint idModel;
|
||||
/// <summary>
|
||||
/// FireWire vendor ID
|
||||
/// </summary>
|
||||
public uint idVendor;
|
||||
/// <summary>
|
||||
/// FireWire's device GUID
|
||||
/// </summary>
|
||||
public ulong guid;
|
||||
|
||||
/// <summary>
|
||||
/// FireWire vendor string
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string vendor;
|
||||
|
||||
/// <summary>
|
||||
/// FireWire model string
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string model;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests information about the PCMCIA or CardBus connection of the opened device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdGetPcmciaData
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns information about the PCMCIA or CardBus connection of the opened device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResGetPcmciaData
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// <c>true</c> if the device is a PCMCIA or CardBus device and the rest of the fields on this packet are valid, <c>false</c> otherwise
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool isPcmcia;
|
||||
/// <summary>
|
||||
/// CIS buffer length
|
||||
/// </summary>
|
||||
public ushort cis_len;
|
||||
|
||||
/// <summary>
|
||||
/// CIS buffer
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65536)]
|
||||
public byte[] cis;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests to close the currently opened device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdClose
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests to know if the remote is running with administrative (aka root) privileges
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdAmIRoot
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns if the remote is running with administrative (aka root) privileges
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResAmIRoot
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Set to any value different of 0 to indicate the remote is running with administrative (aka root) privileges
|
||||
/// </summary>
|
||||
public uint am_i_root;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initiates a multiple command block with the SDHCI controller the SecureDigital or MultiMediaCard is attached
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketMultiCmdSdhci
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// How many commands to queue
|
||||
/// </summary>
|
||||
public ulong cmd_count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes and then re-opens the same device
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdReOpen
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads data using operating system buffers
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketCmdOsRead
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Device offset where to read
|
||||
/// </summary>
|
||||
public ulong offset;
|
||||
/// <summary>
|
||||
/// Number of bytes to read
|
||||
/// </summary>
|
||||
public uint length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns data read using operating system buffers. This structure is followed by the data buffer.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct AaruPacketResOsRead
|
||||
{
|
||||
/// <summary>Packet header</summary>
|
||||
public AaruPacketHeader hdr;
|
||||
/// <summary>
|
||||
/// Set to the remote operating system error number
|
||||
/// </summary>
|
||||
public int errno;
|
||||
/// <summary>
|
||||
/// Time in milliseconds it took for the device to execute the command
|
||||
/// </summary>
|
||||
public uint duration;
|
||||
}
|
||||
}
|
||||
2
Aaru.Dto
2
Aaru.Dto
Submodule Aaru.Dto updated: 3b6c6aca70...033842d8a1
@@ -44,18 +44,27 @@ namespace Aaru.Filesystems
|
||||
{
|
||||
// Information has been extracted looking at available disk images
|
||||
// This may be missing fields, or not, I don't know russian so any help is appreciated
|
||||
/// <summary>
|
||||
/// Implements detection of the AO-DOS filesystem
|
||||
/// </summary>
|
||||
public sealed class AODOS : IFilesystem
|
||||
{
|
||||
readonly byte[] _identifier =
|
||||
{
|
||||
0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20
|
||||
};
|
||||
/// <inheritdoc />
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => "Alexander Osipov DOS file system";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new Guid("668E5039-9DDD-442A-BE1B-A315D6E38E26");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
// Does AO-DOS support hard disks?
|
||||
@@ -77,6 +86,7 @@ namespace Aaru.Filesystems
|
||||
return bb.identifier.SequenceEqual(_identifier);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
{
|
||||
|
||||
@@ -41,18 +41,27 @@ using Marshal = Aaru.Helpers.Marshal;
|
||||
|
||||
namespace Aaru.Filesystems
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements detection of the Apple File System (APFS)
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public sealed class APFS : IFilesystem
|
||||
{
|
||||
const uint APFS_CONTAINER_MAGIC = 0x4253584E; // "NXSB"
|
||||
const uint APFS_VOLUME_MAGIC = 0x42535041; // "APSB"
|
||||
|
||||
/// <inheritdoc />
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => "Apple File System";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new Guid("A4060F9D-2909-42E2-9D95-DB31FA7EA797");
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
if(partition.Start >= partition.End)
|
||||
@@ -73,6 +82,7 @@ namespace Aaru.Filesystems
|
||||
return nxSb.magic == APFS_CONTAINER_MAGIC;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,9 @@ using Marshal = Aaru.Helpers.Marshal;
|
||||
|
||||
namespace Aaru.Filesystems
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements detection of Acorn's Advanced Data Filing System (ADFS)
|
||||
/// </summary>
|
||||
public sealed class AcornADFS : IFilesystem
|
||||
{
|
||||
/// <summary>Location for boot block, in bytes</summary>
|
||||
@@ -63,13 +66,19 @@ namespace Aaru.Filesystems
|
||||
/// <summary>Old directory format magic number, "Hugo"</summary>
|
||||
const uint OLD_DIR_MAGIC = 0x6F677548;
|
||||
|
||||
/// <inheritdoc />
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => "Acorn Advanced Disc Filing System";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new Guid("BAFC1E50-9C64-4CD3-8400-80628CC27AFA");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
// TODO: BBC Master hard disks are untested...
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
if(partition.Start >= partition.End)
|
||||
@@ -261,6 +270,7 @@ namespace Aaru.Filesystems
|
||||
// TODO: Find root directory on volumes with DiscRecord
|
||||
// TODO: Support big directories (ADFS-G?)
|
||||
// TODO: Find the real freemap on volumes with DiscRecord, as DiscRecord's discid may be empty but this one isn't
|
||||
/// <inheritdoc />
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
{
|
||||
|
||||
@@ -44,6 +44,9 @@ using Marshal = Aaru.Helpers.Marshal;
|
||||
|
||||
namespace Aaru.Filesystems
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements detection of Amiga Fast File System (AFFS)
|
||||
/// </summary>
|
||||
public sealed class AmigaDOSPlugin : IFilesystem
|
||||
{
|
||||
const uint FFS_MASK = 0x444F5300;
|
||||
@@ -52,12 +55,18 @@ namespace Aaru.Filesystems
|
||||
const uint TYPE_HEADER = 2;
|
||||
const uint SUBTYPE_ROOT = 1;
|
||||
|
||||
/// <inheritdoc />
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => "Amiga DOS filesystem";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new Guid("3c882400-208c-427d-a086-9119852a1bc7");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
if(partition.Start + 4 >= partition.End)
|
||||
@@ -164,6 +173,7 @@ namespace Aaru.Filesystems
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
{
|
||||
|
||||
@@ -38,6 +38,9 @@ using Schemas;
|
||||
|
||||
namespace Aaru.Filesystems
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the Apple DOS 3 filesystem
|
||||
/// </summary>
|
||||
public sealed partial class AppleDOS : IReadOnlyFilesystem
|
||||
{
|
||||
bool _debug;
|
||||
@@ -51,16 +54,23 @@ namespace Aaru.Filesystems
|
||||
uint _usedSectors;
|
||||
Vtoc _vtoc;
|
||||
|
||||
/// <inheritdoc />
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => "Apple DOS File System";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n");
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
new (string name, Type type, string description)[]
|
||||
{};
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new Dictionary<string, string>
|
||||
|
||||
@@ -42,9 +42,6 @@ namespace Aaru.Filesystems
|
||||
public sealed partial class AppleDOS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>Solves a symbolic link.</summary>
|
||||
/// <param name="path">Link path.</param>
|
||||
/// <param name="dest">Link destination.</param>
|
||||
public Errno ReadLink(string path, out string dest)
|
||||
{
|
||||
dest = null;
|
||||
@@ -53,9 +50,6 @@ namespace Aaru.Filesystems
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Lists contents from a directory.</summary>
|
||||
/// <param name="path">Directory path.</param>
|
||||
/// <param name="contents">Directory contents.</param>
|
||||
public Errno ReadDir(string path, out List<string> contents)
|
||||
{
|
||||
contents = null;
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace Aaru.Filesystems
|
||||
{
|
||||
public sealed partial class AppleDOS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Errno GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
@@ -76,6 +77,7 @@ namespace Aaru.Filesystems
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Errno Read(string path, long offset, long size, ref byte[] buf)
|
||||
{
|
||||
if(!_mounted)
|
||||
@@ -131,6 +133,7 @@ namespace Aaru.Filesystems
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Errno Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
stat = null;
|
||||
@@ -185,6 +188,7 @@ namespace Aaru.Filesystems
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Errno MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace Aaru.Filesystems
|
||||
{
|
||||
public sealed partial class AppleDOS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
if(imagePlugin.Info.Sectors != 455 &&
|
||||
@@ -61,6 +62,7 @@ namespace Aaru.Filesystems
|
||||
_vtoc.sectorsPerTrack == spt && _vtoc.bytesPerSector == 256;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace Aaru.Filesystems
|
||||
public sealed partial class AppleDOS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>Mounts an Apple DOS filesystem</summary>
|
||||
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||
Dictionary<string, string> options, string @namespace)
|
||||
{
|
||||
@@ -128,7 +127,6 @@ namespace Aaru.Filesystems
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Unmounts this DOS filesystem</summary>
|
||||
public Errno Unmount()
|
||||
{
|
||||
_mounted = false;
|
||||
@@ -141,8 +139,6 @@ namespace Aaru.Filesystems
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Gets information about the mounted volume.</summary>
|
||||
/// <param name="stat">Information about the mounted volume.</param>
|
||||
public Errno StatFs(out FileSystemInfo stat)
|
||||
{
|
||||
stat = new FileSystemInfo
|
||||
|
||||
@@ -39,10 +39,6 @@ namespace Aaru.Filesystems
|
||||
public sealed partial class AppleDOS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>Lists all extended attributes, alternate data streams and forks of the given file.</summary>
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">Path.</param>
|
||||
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param>
|
||||
public Errno ListXAttr(string path, out List<string> xattrs)
|
||||
{
|
||||
xattrs = null;
|
||||
@@ -83,11 +79,6 @@ namespace Aaru.Filesystems
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Reads an extended attribute, alternate data stream or fork from the given file.</summary>
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">File path.</param>
|
||||
/// <param name="xattr">Extended attribute, alternate data stream or fork name.</param>
|
||||
/// <param name="buf">Buffer.</param>
|
||||
public Errno GetXattr(string path, string xattr, ref byte[] buf)
|
||||
{
|
||||
if(!_mounted)
|
||||
|
||||
@@ -40,12 +40,20 @@ namespace Aaru.Filesystems
|
||||
{
|
||||
// Information from Inside Macintosh
|
||||
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
||||
/// <summary>
|
||||
/// Implements detection of the Apple Hierarchical File System (HFS)
|
||||
/// </summary>
|
||||
public sealed partial class AppleHFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => "Apple Hierarchical File System";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new Guid("36405F8D-0D26-6ECC-0BBB-1D5225FF404F");
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@ namespace Aaru.Filesystems
|
||||
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
||||
public sealed partial class AppleHFS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
if(2 + partition.Start >= partition.End)
|
||||
@@ -96,6 +97,7 @@ namespace Aaru.Filesystems
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
{
|
||||
|
||||
@@ -42,14 +42,23 @@ using Marshal = Aaru.Helpers.Marshal;
|
||||
namespace Aaru.Filesystems
|
||||
{
|
||||
// Information from Apple TechNote 1150: https://developer.apple.com/legacy/library/technotes/tn/tn1150.html
|
||||
/// <summary>
|
||||
/// Implements detection of Apple Hierarchical File System Plus (HFS+)
|
||||
/// </summary>
|
||||
public sealed class AppleHFSPlus : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => "Apple HFS+ filesystem";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new Guid("36405F8D-0D26-6EBE-436F-62F0586B4F08");
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
if(2 + partition.Start >= partition.End)
|
||||
@@ -96,6 +105,7 @@ namespace Aaru.Filesystems
|
||||
return drSigWord == AppleCommon.HFSP_MAGIC || drSigWord == AppleCommon.HFSX_MAGIC;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,9 @@ using Schemas;
|
||||
namespace Aaru.Filesystems
|
||||
{
|
||||
// Information from Inside Macintosh Volume II
|
||||
/// <summary>
|
||||
/// Implements the Apple Macintosh File System
|
||||
/// </summary>
|
||||
public sealed partial class AppleMFS : IReadOnlyFilesystem
|
||||
{
|
||||
bool _mounted;
|
||||
@@ -60,17 +63,24 @@ namespace Aaru.Filesystems
|
||||
byte[] _directoryTags;
|
||||
byte[] _bitmapTags;
|
||||
|
||||
/// <inheritdoc />
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => "Apple Macintosh File System";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
// TODO: Implement Finder namespace (requires decoding Desktop database)
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
new (string name, Type type, string description)[]
|
||||
{};
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new Dictionary<string, string>
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace Aaru.Filesystems
|
||||
// Information from Inside Macintosh Volume II
|
||||
public sealed partial class AppleMFS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Errno ReadDir(string path, out List<string> contents)
|
||||
{
|
||||
contents = null;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user