diff options
Diffstat (limited to 'include/libirecovery.h')
| -rw-r--r-- | include/libirecovery.h | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/include/libirecovery.h b/include/libirecovery.h index e3360f0..822d0e1 100644 --- a/include/libirecovery.h +++ b/include/libirecovery.h | |||
| @@ -18,48 +18,57 @@ | |||
| 18 | 18 | ||
| 19 | #include <libusb-1.0/libusb.h> | 19 | #include <libusb-1.0/libusb.h> |
| 20 | 20 | ||
| 21 | #define IRECV_SUCCESS 0 | 21 | typedef enum { |
| 22 | #define IRECV_ERROR_NO_DEVICE -1 | 22 | IRECV_SUCCESS = 0, |
| 23 | #define IRECV_ERROR_OUT_OF_MEMORY -2 | 23 | IRECV_ERROR_NO_DEVICE = -1, |
| 24 | #define IRECV_ERROR_UNABLE_TO_CONNECT -3 | 24 | IRECV_ERROR_OUT_OF_MEMORY = -2, |
| 25 | #define IRECV_ERROR_INVALID_INPUT -4 | 25 | IRECV_ERROR_UNABLE_TO_CONNECT = -3, |
| 26 | #define IRECV_ERROR_UNKNOWN -5 | 26 | IRECV_ERROR_INVALID_INPUT = -4, |
| 27 | #define IRECV_ERROR_FILE_NOT_FOUND -6 | 27 | IRECV_ERROR_UNKNOWN = -5, |
| 28 | #define IRECV_ERROR_USB_UPLOAD -7 | 28 | IRECV_ERROR_FILE_NOT_FOUND = -6, |
| 29 | #define IRECV_ERROR_USB_STATUS -8 | 29 | IRECV_ERROR_USB_UPLOAD = -7, |
| 30 | IRECV_ERROR_USB_STATUS = -8, | ||
| 31 | IRECV_ERROR_USB_INTERFACE = -9, | ||
| 32 | IRECV_ERROR_USB_CONFIGURATION = -10 | ||
| 33 | } irecv_error_t; | ||
| 30 | 34 | ||
| 31 | enum { | 35 | typedef enum { |
| 32 | kAppleId = 0x05AC, | 36 | kAppleId = 0x05AC, |
| 33 | kKernelMode = 0x1294, | 37 | kKernelMode = 0x1294, |
| 34 | kRecoveryMode = 0x1281, | 38 | kRecoveryMode = 0x1281, |
| 35 | kDfuMode = 0x1227 | 39 | kDfuMode = 0x1227 |
| 36 | }; | 40 | } irecv_mode_t; |
| 37 | 41 | ||
| 38 | struct irecv_device; | 42 | struct irecv_device; |
| 39 | typedef struct irecv_device irecv_device_t; | 43 | typedef struct irecv_device irecv_device_t; |
| 40 | 44 | ||
| 41 | typedef int(*irecv_send_callback)(irecv_device_t* device, unsigned char* data, unsigned int size); | 45 | typedef int(*irecv_send_callback)(irecv_device_t* device, unsigned char* data, int size); |
| 42 | typedef int(*irecv_receive_callback)(irecv_device_t* device, unsigned char* data, unsigned int size); | 46 | typedef int(*irecv_receive_callback)(irecv_device_t* device, unsigned char* data, int size); |
| 43 | 47 | ||
| 44 | struct irecv_device { | 48 | struct irecv_device { |
| 45 | unsigned int mode; | 49 | int debug; |
| 46 | unsigned int debug; | 50 | int config; |
| 47 | struct libusb_context* context; | 51 | int interface; |
| 48 | struct libusb_device_handle* handle; | 52 | int alt_interface; |
| 49 | irecv_receive_callback receive_callback; | 53 | irecv_mode_t mode; |
| 54 | libusb_context* context; | ||
| 55 | libusb_device_handle* handle; | ||
| 50 | irecv_send_callback send_callback; | 56 | irecv_send_callback send_callback; |
| 57 | irecv_receive_callback receive_callback; | ||
| 51 | }; | 58 | }; |
| 52 | 59 | ||
| 53 | irecv_device_t* irecv_init(); | 60 | irecv_device_t* irecv_init(); |
| 54 | int irecv_open(irecv_device_t* device); | 61 | irecv_error_t irecv_open(irecv_device_t* device); |
| 55 | int irecv_exit(irecv_device_t* device); | 62 | irecv_error_t irecv_exit(irecv_device_t* device); |
| 56 | int irecv_reset(irecv_device_t* device); | 63 | irecv_error_t irecv_reset(irecv_device_t* device); |
| 57 | int irecv_close(irecv_device_t* device); | 64 | irecv_error_t irecv_close(irecv_device_t* device); |
| 58 | void irecv_update(irecv_device_t* device); | 65 | irecv_error_t irecv_update(irecv_device_t* device); |
| 59 | void irecv_set_debug(irecv_device_t* device, int level); | 66 | irecv_error_t irecv_set_debug(irecv_device_t* device, int level); |
| 60 | int irecv_send_file(irecv_device_t* device, const char* filename); | 67 | irecv_error_t irecv_send_file(irecv_device_t* device, const char* filename); |
| 61 | int irecv_send_command(irecv_device_t* device, unsigned char* command); | 68 | irecv_error_t irecv_send_command(irecv_device_t* device, unsigned char* command); |
| 62 | int irecv_send_buffer(irecv_device_t* device, unsigned char* buffer, int length); | 69 | irecv_error_t irecv_set_configuration(irecv_device_t* device, int configuration); |
| 63 | int irecv_set_sender(irecv_device_t* device, irecv_send_callback callback); | 70 | irecv_error_t irecv_set_sender(irecv_device_t* device, irecv_send_callback callback); |
| 64 | int irecv_set_receiver(irecv_device_t* device, irecv_receive_callback callback); | 71 | irecv_error_t irecv_set_receiver(irecv_device_t* device, irecv_receive_callback callback); |
| 72 | irecv_error_t irecv_set_interface(irecv_device_t* device, int interface, int alt_interface); | ||
| 73 | irecv_error_t irecv_send_buffer(irecv_device_t* device, unsigned char* buffer, unsigned int length); | ||
| 65 | 74 | ||
