ATA commands

## ATA commands ATA commands — Helper routines for ATA commands |

## Synopsis

    enum                UDisksAtaCommandProtocol;
                        UDisksAtaCommandInput;
                        UDisksAtaCommandOutput;
    gboolean            udisks_ata_send_command_sync        (gint fd,
                                                             gint timeout_msec,
                                                             UDisksAtaCommandProtocol protocol,
                                                             UDisksAtaCommandInput *input,
                                                             UDisksAtaCommandOutput *output,
                                                             GError **error);

## Description

Helper routines for sending ATA commands to a device.

## Details

### enum UDisksAtaCommandProtocol

    typedef enum {
      UDISKS_ATA_COMMAND_PROTOCOL_NONE,
      UDISKS_ATA_COMMAND_PROTOCOL_DRIVE_TO_HOST,
      UDISKS_ATA_COMMAND_PROTOCOL_HOST_TO_DRIVE
    } UDisksAtaCommandProtocol;

Enumeration used to specify the protocol of an ATA command

`UDISKS_ATA_COMMAND_PROTOCOL_NONE` | Non-data
`UDISKS_ATA_COMMAND_PROTOCOL_DRIVE_TO_HOST` | PIO Data-In
`UDISKS_ATA_COMMAND_PROTOCOL_HOST_TO_DRIVE` | PIO Data-Out

### UDisksAtaCommandInput

    typedef struct {
      guint8  command;
      guint8  feature;
      guint8  count;
      guint8  device;
      guint32 lba;
      gsize   buffer_size;
      guchar *buffer;
    } UDisksAtaCommandInput;

Struct used for input data when sending ATA commands.

guint8 `command`; | Command
guint8 `feature`; | Feature
guint8 `count`; | Count
guint8 `device`; | Device
guint32 `lba`; | LBA
gsize `buffer_size`; | Size of the `buffer` member or 0
guchar *`buffer`; | Data to send to device or `NULL`

### UDisksAtaCommandOutput

    typedef struct {
      guint8  error;
      guint8  count;
      guint8  device;
      guint8  status;
      guint32 lba;
      gsize   buffer_size;
      guchar *buffer;
    } UDisksAtaCommandOutput;

Struct used for output data when sending ATA commands.

guint8 `error`; | Error
guint8 `count`; | Count
guint8 `device`; | Device
guint8 `status`; | Status
guint32 `lba`; | LBA
gsize `buffer_size`; | Size of the `buffer` member or 0
guchar *`buffer`; | Pointer to where to recieve data from the device or `NULL`

### udisks_ata_send_command_sync ()

    gboolean            udisks_ata_send_command_sync        (gint fd,
                                                             gint timeout_msec,
                                                             UDisksAtaCommandProtocol protocol,
                                                             UDisksAtaCommandInput *input,
                                                             UDisksAtaCommandOutput *output,
                                                             GError **error);

Sends a command to an ATA device. Blocks the calling thread while the command is pending.

`fd` : | A file descriptor for a ATA device.
`timeout_msec` : | Timeout in milli-seconds for the command. Use -1 for the default (5 seconds) timeout and `G_MAXINT` for no timeout.
`protocol` : | The direction of the command.
`input` : | The input for the command.
`output` : | The output for the command.
`error` : | Return location for error or `NULL`.
Returns : | `TRUE` if the command succeded, `FALSE` if `error` is set.