2019-10-12 13:06:21 +01:00
|
|
|
/*
|
|
|
|
|
* This file is part of the DiscImageChef Remote Server.
|
|
|
|
|
* Copyright (c) 2019 Natalia Portillo.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-10-19 18:30:45 +01:00
|
|
|
#ifndef DICREMOTE__DICMOTE_H_
|
|
|
|
|
#define DICREMOTE__DICMOTE_H_
|
2019-10-12 13:06:21 +01:00
|
|
|
|
2019-10-17 22:11:57 +01:00
|
|
|
#include <stddef.h>
|
2019-10-12 18:40:49 +01:00
|
|
|
#include <stdint.h>
|
2019-10-17 22:11:57 +01:00
|
|
|
|
2019-10-12 18:40:49 +01:00
|
|
|
#define DICMOTE_NAME "DiscImageChef Remote Server"
|
2019-10-12 13:06:21 +01:00
|
|
|
#define DICMOTE_VERSION "0.99"
|
2019-10-12 17:02:02 +01:00
|
|
|
#define DICMOTE_PORT 6666
|
2019-10-12 22:09:27 +01:00
|
|
|
#define DICMOTE_PACKET_ID 0x6873678065677584 // "DICPACKT"
|
2019-10-12 18:40:49 +01:00
|
|
|
#define DICMOTE_PACKET_VERSION 1
|
2019-10-13 20:52:27 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_NOP -1
|
2019-10-12 18:40:49 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_HELLO 1
|
2019-10-12 22:34:32 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_LIST_DEVICES 2
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_LIST_DEVICES 3
|
2019-10-13 21:59:28 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_OPEN_DEVICE 4
|
2019-10-14 00:42:26 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_SCSI 5
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_SCSI 6
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_ATA_CHS 7
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_ATA_CHS 8
|
2019-10-19 18:30:45 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_ATA_LBA_28 9
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_ATA_LBA_28 10
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_ATA_LBA_48 11
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_ATA_LBA_48 12
|
2019-10-14 00:42:26 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_SDHCI 13
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_SDHCI 14
|
2019-10-14 01:02:31 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_GET_DEVTYPE 15
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_GET_DEVTYPE 16
|
2019-10-14 01:11:26 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_GET_SDHCI_REGISTERS 17
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_GET_SDHCI_REGISTERS 18
|
2019-10-14 01:26:27 +01:00
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_GET_USB_DATA 19
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_GET_USB_DATA 20
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_GET_FIREWIRE_DATA 21
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_GET_FIREWIRE_DATA 22
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_COMMAND_GET_PCMCIA_DATA 23
|
|
|
|
|
#define DICMOTE_PACKET_TYPE_RESPONSE_GET_PCMCIA_DATA 24
|
2019-10-12 18:40:49 +01:00
|
|
|
#define DICMOTE_PROTOCOL_MAX 1
|
2019-10-13 20:52:27 +01:00
|
|
|
#define DICMOTE_PACKET_NOP_REASON_OOO 0
|
|
|
|
|
#define DICMOTE_PACKET_NOP_REASON_NOT_IMPLEMENTED 1
|
|
|
|
|
#define DICMOTE_PACKET_NOP_REASON_NOT_RECOGNIZED 2
|
|
|
|
|
#define DICMOTE_PACKET_NOP_REASON_ERROR_LIST_DEVICES 3
|
2019-10-13 22:29:43 +01:00
|
|
|
#define DICMOTE_PACKET_NOP_REASON_OPEN_OK 4
|
|
|
|
|
#define DICMOTE_PACKET_NOP_REASON_OPEN_ERROR 5
|
2019-10-14 01:02:31 +01:00
|
|
|
#define DICMOTE_DEVICE_TYPE_UNKNOWN -1
|
|
|
|
|
#define DICMOTE_DEVICE_TYPE_ATA 1
|
|
|
|
|
#define DICMOTE_DEVICE_TYPE_ATAPI 2
|
|
|
|
|
#define DICMOTE_DEVICE_TYPE_SCSI 3
|
|
|
|
|
#define DICMOTE_DEVICE_TYPE_SECURE_DIGITAL 4
|
|
|
|
|
#define DICMOTE_DEVICE_TYPE_MMC 5
|
|
|
|
|
#define DICMOTE_DEVICE_TYPE_NVME 6
|
2019-10-16 21:53:06 +01:00
|
|
|
#define DICMOTE_SCSI_DIRECTION_UNSPECIFIED -1
|
|
|
|
|
#define DICMOTE_SCSI_DIRECTION_NONE 0
|
|
|
|
|
#define DICMOTE_SCSI_DIRECTION_OUT 1
|
|
|
|
|
#define DICMOTE_SCSI_DIRECTION_IN 2
|
|
|
|
|
#define DICMOTE_SCSI_DIRECTION_INOUT 3
|
2019-10-19 02:42:47 +01:00
|
|
|
#define DICMOTE_ATA_PROTOCOL_HARD_RESET 0
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_SOFT_RESET 1
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_NO_DATA 3
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_PIO_IN 4
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_PIO_OUT 5
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_DMA 6
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_DMA_QUEUED 7
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_DEVICE_DIAGNOSTIC 8
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_DEVICE_RESET 9
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_UDMA_IN 10
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_UDMA_OUT 11
|
|
|
|
|
#define DICMOTE_ATA_PROTOCOL_FPDMA 12
|
2019-10-19 03:11:13 +01:00
|
|
|
#define DICMOTE_ATA_PROTOCOL_RETURN_RESPONSE 15
|
2019-10-19 02:42:47 +01:00
|
|
|
#define DICMOTE_ATA_TRANSFER_REGISTER_NONE 0
|
|
|
|
|
#define DICMOTE_ATA_TRANSFER_REGISTER_FEATURE 1
|
|
|
|
|
#define DICMOTE_ATA_TRANSFER_REGISTER_SECTOR_COUNT 2
|
|
|
|
|
#define DICMOTE_ATA_TRANSFER_REGISTER_SPTSIU 3
|
2019-10-12 13:06:21 +01:00
|
|
|
|
2019-10-12 18:40:49 +01:00
|
|
|
#pragma pack(push, 1)
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2019-10-12 22:09:27 +01:00
|
|
|
uint64_t id;
|
2019-10-12 18:40:49 +01:00
|
|
|
uint32_t len;
|
|
|
|
|
uint8_t version;
|
2019-10-13 20:52:27 +01:00
|
|
|
int8_t packet_type;
|
2019-10-12 18:40:49 +01:00
|
|
|
char spare[2];
|
|
|
|
|
} DicPacketHeader;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
char application[128];
|
|
|
|
|
char version[64];
|
|
|
|
|
uint8_t max_protocol;
|
|
|
|
|
char spare[3];
|
|
|
|
|
char sysname[256];
|
|
|
|
|
char release[256];
|
|
|
|
|
char machine[256];
|
|
|
|
|
} DicPacketHello;
|
|
|
|
|
|
2019-10-12 22:34:32 +01:00
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
} DicPacketCmdListDevs;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint16_t devices;
|
|
|
|
|
} DicPacketResListDevs;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
char path[1024];
|
2019-10-12 23:23:15 +01:00
|
|
|
char vendor[256];
|
|
|
|
|
char model[256];
|
|
|
|
|
char serial[256];
|
|
|
|
|
char bus[256];
|
2019-10-12 22:34:32 +01:00
|
|
|
uint8_t supported;
|
2019-10-12 23:46:01 +01:00
|
|
|
char padding[3];
|
2019-10-12 22:34:32 +01:00
|
|
|
} DeviceInfo;
|
|
|
|
|
|
|
|
|
|
typedef struct DeviceInfoList
|
|
|
|
|
{
|
|
|
|
|
struct DeviceInfoList* next;
|
|
|
|
|
DeviceInfo this;
|
|
|
|
|
} DeviceInfoList;
|
2019-10-13 20:52:27 +01:00
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint8_t reason_code;
|
|
|
|
|
char spare[3];
|
|
|
|
|
char reason[256];
|
2019-10-19 18:30:45 +01:00
|
|
|
int32_t error_no;
|
2019-10-13 20:52:27 +01:00
|
|
|
} DicPacketNop;
|
|
|
|
|
|
2019-10-13 21:59:28 +01:00
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
char device_path[1024];
|
|
|
|
|
} DicPacketCmdOpen;
|
|
|
|
|
|
2019-10-14 00:42:26 +01:00
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint32_t cdb_len;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
int32_t direction;
|
|
|
|
|
uint32_t timeout;
|
|
|
|
|
} DicPacketCmdScsi;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint32_t sense_len;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
uint32_t duration;
|
|
|
|
|
uint32_t sense;
|
2019-10-16 22:56:42 +01:00
|
|
|
uint32_t error_no;
|
2019-10-14 00:42:26 +01:00
|
|
|
} DicPacketResScsi;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t feature;
|
|
|
|
|
uint8_t sector_count;
|
|
|
|
|
uint8_t sector;
|
|
|
|
|
uint8_t cylinder_low;
|
|
|
|
|
uint8_t cylinder_high;
|
|
|
|
|
uint8_t device_head;
|
|
|
|
|
uint8_t command;
|
2019-10-14 00:42:26 +01:00
|
|
|
} AtaRegistersChs;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t status;
|
|
|
|
|
uint8_t error;
|
|
|
|
|
uint8_t sector_count;
|
|
|
|
|
uint8_t sector;
|
|
|
|
|
uint8_t cylinder_low;
|
|
|
|
|
uint8_t cylinder_high;
|
|
|
|
|
uint8_t device_head;
|
2019-10-14 00:42:26 +01:00
|
|
|
} AtaErrorRegistersChs;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
AtaRegistersChs registers;
|
|
|
|
|
uint8_t protocol;
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t transfer_register;
|
|
|
|
|
uint8_t transfer_blocks;
|
2019-10-14 00:42:26 +01:00
|
|
|
uint8_t spare;
|
|
|
|
|
uint32_t timeout;
|
|
|
|
|
} DicPacketCmdAtaChs;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
AtaErrorRegistersChs registers;
|
|
|
|
|
uint32_t duration;
|
|
|
|
|
uint32_t sense;
|
2019-10-16 22:56:42 +01:00
|
|
|
uint32_t error_no;
|
2019-10-14 00:42:26 +01:00
|
|
|
} DicPacketResAtaChs;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t feature;
|
|
|
|
|
uint8_t sector_count;
|
|
|
|
|
uint8_t lba_low;
|
|
|
|
|
uint8_t lba_mid;
|
|
|
|
|
uint8_t lba_high;
|
|
|
|
|
uint8_t device_head;
|
|
|
|
|
uint8_t command;
|
2019-10-14 00:42:26 +01:00
|
|
|
} AtaRegistersLba28;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t status;
|
|
|
|
|
uint8_t error;
|
|
|
|
|
uint8_t sector_count;
|
|
|
|
|
uint8_t lba_low;
|
|
|
|
|
uint8_t lba_mid;
|
|
|
|
|
uint8_t lba_high;
|
|
|
|
|
uint8_t device_head;
|
2019-10-14 00:42:26 +01:00
|
|
|
} AtaErrorRegistersLba28;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
AtaRegistersLba28 registers;
|
|
|
|
|
uint8_t protocol;
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t transfer_register;
|
|
|
|
|
uint8_t transfer_blocks;
|
2019-10-14 00:42:26 +01:00
|
|
|
uint8_t spare;
|
|
|
|
|
uint32_t timeout;
|
|
|
|
|
} DicPacketCmdAtaLba28;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
AtaErrorRegistersLba28 registers;
|
|
|
|
|
uint32_t duration;
|
|
|
|
|
uint32_t sense;
|
2019-10-16 22:56:42 +01:00
|
|
|
uint32_t error_no;
|
2019-10-14 00:42:26 +01:00
|
|
|
} DicPacketResAtaLba28;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2019-10-19 18:30:45 +01:00
|
|
|
uint16_t feature;
|
|
|
|
|
uint16_t sector_count;
|
|
|
|
|
uint16_t lba_low;
|
|
|
|
|
uint16_t lba_mid;
|
|
|
|
|
uint16_t lba_high;
|
|
|
|
|
uint8_t device_head;
|
|
|
|
|
uint8_t command;
|
2019-10-14 00:42:26 +01:00
|
|
|
} AtaRegistersLba48;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t status;
|
|
|
|
|
uint8_t error;
|
|
|
|
|
uint16_t sector_count;
|
|
|
|
|
uint16_t lba_low;
|
|
|
|
|
uint16_t lba_mid;
|
|
|
|
|
uint16_t lba_high;
|
|
|
|
|
uint8_t device_head;
|
2019-10-14 00:42:26 +01:00
|
|
|
} AtaErrorRegistersLba48;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
AtaRegistersLba48 registers;
|
|
|
|
|
uint8_t protocol;
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t transfer_register;
|
|
|
|
|
uint8_t transfer_blocks;
|
2019-10-14 00:42:26 +01:00
|
|
|
uint8_t spare;
|
|
|
|
|
uint32_t timeout;
|
|
|
|
|
} DicPacketCmdAtaLba48;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
AtaErrorRegistersLba48 registers;
|
|
|
|
|
uint32_t duration;
|
|
|
|
|
uint32_t sense;
|
2019-10-16 22:56:42 +01:00
|
|
|
uint32_t error_no;
|
2019-10-14 00:42:26 +01:00
|
|
|
} DicPacketResAtaLba48;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint8_t command;
|
|
|
|
|
uint8_t write;
|
|
|
|
|
uint8_t application;
|
|
|
|
|
uint32_t flags;
|
|
|
|
|
uint32_t argument;
|
|
|
|
|
uint32_t block_size;
|
|
|
|
|
uint32_t blocks;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
uint32_t timeout;
|
|
|
|
|
} DicPacketCmdSdhci;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
uint32_t response[4];
|
|
|
|
|
uint32_t duration;
|
|
|
|
|
uint32_t sense;
|
2019-10-16 22:56:42 +01:00
|
|
|
uint32_t error_no;
|
2019-10-14 00:42:26 +01:00
|
|
|
} DicPacketResSdhci;
|
2019-10-14 01:02:31 +01:00
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
} DicPacketCmdGetDeviceType;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
int32_t device_type;
|
|
|
|
|
} DicPacketResGetDeviceType;
|
|
|
|
|
|
2019-10-14 01:11:26 +01:00
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
} DicPacketCmdGetSdhciRegisters;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t is_sdhci;
|
2019-10-14 01:11:26 +01:00
|
|
|
char csd[16];
|
|
|
|
|
char cid[16];
|
|
|
|
|
char ocr[4];
|
|
|
|
|
char scr[8];
|
2019-10-18 00:25:45 +01:00
|
|
|
uint32_t csd_len;
|
|
|
|
|
uint32_t cid_len;
|
|
|
|
|
uint32_t ocr_len;
|
|
|
|
|
uint32_t scr_len;
|
2019-10-14 01:11:26 +01:00
|
|
|
} DicPacketResGetSdhciRegisters;
|
|
|
|
|
|
2019-10-14 01:26:27 +01:00
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
} DicPacketCmdGetUsbData;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t is_usb;
|
|
|
|
|
uint16_t desc_len;
|
2019-10-14 01:26:27 +01:00
|
|
|
char descriptors[65536];
|
2019-10-19 18:30:45 +01:00
|
|
|
uint16_t id_vendor;
|
|
|
|
|
uint16_t id_product;
|
2019-10-14 01:26:27 +01:00
|
|
|
char manufacturer[256];
|
|
|
|
|
char product[256];
|
|
|
|
|
char serial[256];
|
|
|
|
|
} DicPacketResGetUsbData;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
} DicPacketCmdGetFireWireData;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t is_firewire;
|
|
|
|
|
uint32_t id_model;
|
|
|
|
|
uint32_t id_vendor;
|
2019-10-14 01:26:27 +01:00
|
|
|
uint64_t guid;
|
|
|
|
|
char vendor[256];
|
|
|
|
|
char model[256];
|
|
|
|
|
} DicPacketResGetFireWireData;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
|
|
|
|
} DicPacketCmdGetPcmciaData;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
DicPacketHeader hdr;
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t is_pcmcia;
|
2019-10-14 01:26:27 +01:00
|
|
|
uint16_t cis_len;
|
|
|
|
|
char cis[65536];
|
|
|
|
|
} DicPacketResGetPcmciaData;
|
|
|
|
|
|
2019-10-12 18:40:49 +01:00
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
2019-10-12 23:53:29 +01:00
|
|
|
DeviceInfoList* ListDevices();
|
2019-10-13 14:11:54 +01:00
|
|
|
void FreeDeviceInfoList(DeviceInfoList* start);
|
2019-10-13 15:11:45 +01:00
|
|
|
uint16_t DeviceInfoListCount(DeviceInfoList* start);
|
2019-10-19 18:30:45 +01:00
|
|
|
int DeviceOpen(const char* device_path);
|
|
|
|
|
int32_t GetDeviceType(const char* device_path);
|
2019-10-16 21:53:06 +01:00
|
|
|
int32_t SendScsiCommand(int device_fd,
|
|
|
|
|
char* cdb,
|
|
|
|
|
char* buffer,
|
2019-10-19 18:30:45 +01:00
|
|
|
char** sense_buffer,
|
2019-10-16 21:53:06 +01:00
|
|
|
uint32_t timeout,
|
|
|
|
|
int32_t direction,
|
|
|
|
|
uint32_t* duration,
|
|
|
|
|
uint32_t* sense,
|
|
|
|
|
uint32_t cdb_len,
|
|
|
|
|
uint32_t* buf_len,
|
|
|
|
|
uint32_t* sense_len);
|
2019-10-19 18:30:45 +01:00
|
|
|
int Hexchr2Bin(const char hex, char* out);
|
|
|
|
|
size_t Hexs2Bin(const char* hex, unsigned char** out);
|
|
|
|
|
int32_t GetSdhciRegisters(const char* device_path,
|
2019-10-17 23:19:06 +01:00
|
|
|
char** csd,
|
|
|
|
|
char** cid,
|
|
|
|
|
char** ocr,
|
|
|
|
|
char** scr,
|
2019-10-18 00:25:45 +01:00
|
|
|
uint32_t* csd_len,
|
|
|
|
|
uint32_t* cid_len,
|
|
|
|
|
uint32_t* ocr_len,
|
|
|
|
|
uint32_t* scr_len);
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t GetUsbData(const char* device_path,
|
|
|
|
|
uint16_t* desc_len,
|
2019-10-18 01:12:19 +01:00
|
|
|
char* descriptors,
|
2019-10-19 18:30:45 +01:00
|
|
|
uint16_t* id_vendor,
|
|
|
|
|
uint16_t* id_product,
|
2019-10-18 01:12:19 +01:00
|
|
|
char* manufacturer,
|
|
|
|
|
char* product,
|
|
|
|
|
char* serial);
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t GetFireWireData(const char* device_path,
|
|
|
|
|
uint32_t* id_model,
|
|
|
|
|
uint32_t* id_vendor,
|
2019-10-19 00:09:03 +01:00
|
|
|
uint64_t* guid,
|
|
|
|
|
char* vendor,
|
|
|
|
|
char* model);
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t GetPcmciaData(const char* device_path, uint16_t* cis_len, char* cis);
|
2019-10-19 02:42:47 +01:00
|
|
|
int32_t SendAtaChsCommand(int device_fd,
|
|
|
|
|
AtaRegistersChs registers,
|
2019-10-19 18:30:45 +01:00
|
|
|
AtaErrorRegistersChs* error_registers,
|
2019-10-19 02:42:47 +01:00
|
|
|
uint8_t protocol,
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t transfer_register,
|
2019-10-19 02:42:47 +01:00
|
|
|
char* buffer,
|
|
|
|
|
uint32_t timeout,
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t transfer_blocks,
|
2019-10-19 02:42:47 +01:00
|
|
|
uint32_t* duration,
|
2019-10-19 03:11:13 +01:00
|
|
|
uint32_t* sense,
|
|
|
|
|
uint32_t* buf_len);
|
2019-10-19 02:42:47 +01:00
|
|
|
int32_t SendAtaLba28Command(int device_fd,
|
|
|
|
|
AtaRegistersLba28 registers,
|
2019-10-19 18:30:45 +01:00
|
|
|
AtaErrorRegistersLba28* error_registers,
|
2019-10-19 02:42:47 +01:00
|
|
|
uint8_t protocol,
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t transfer_register,
|
2019-10-19 02:42:47 +01:00
|
|
|
char* buffer,
|
|
|
|
|
uint32_t timeout,
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t transfer_blocks,
|
2019-10-19 02:42:47 +01:00
|
|
|
uint32_t* duration,
|
2019-10-19 03:11:13 +01:00
|
|
|
uint32_t* sense,
|
|
|
|
|
uint32_t* buf_len);
|
2019-10-19 02:42:47 +01:00
|
|
|
int32_t SendAtaLba48Command(int device_fd,
|
|
|
|
|
AtaRegistersLba48 registers,
|
2019-10-19 18:30:45 +01:00
|
|
|
AtaErrorRegistersLba48* error_registers,
|
2019-10-19 02:42:47 +01:00
|
|
|
uint8_t protocol,
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t transfer_register,
|
2019-10-19 02:42:47 +01:00
|
|
|
char* buffer,
|
|
|
|
|
uint32_t timeout,
|
2019-10-19 18:30:45 +01:00
|
|
|
uint8_t transfer_blocks,
|
2019-10-19 02:42:47 +01:00
|
|
|
uint32_t* duration,
|
2019-10-19 03:11:13 +01:00
|
|
|
uint32_t* sense,
|
|
|
|
|
uint32_t* buf_len);
|
2019-10-19 17:18:58 +01:00
|
|
|
int32_t SendSdhciCommand(int device_fd,
|
|
|
|
|
uint8_t command,
|
|
|
|
|
uint8_t write,
|
|
|
|
|
uint8_t application,
|
|
|
|
|
uint32_t flags,
|
|
|
|
|
uint32_t argument,
|
|
|
|
|
uint32_t block_size,
|
|
|
|
|
uint32_t blocks,
|
|
|
|
|
char* buffer,
|
|
|
|
|
uint32_t buf_len,
|
|
|
|
|
uint32_t timeout,
|
|
|
|
|
uint32_t* response,
|
|
|
|
|
uint32_t* duration,
|
|
|
|
|
uint32_t* sense);
|
2019-10-20 20:08:06 +01:00
|
|
|
DicPacketHello* GetHello();
|
2019-10-20 20:27:45 +01:00
|
|
|
int PrintNetworkAddresses();
|
2019-10-12 23:53:29 +01:00
|
|
|
|
2019-10-12 18:40:49 +01:00
|
|
|
#endif
|