summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Joshua Hill2010-05-16 14:15:26 -0400
committerGravatar Joshua Hill2010-05-16 14:15:26 -0400
commit3491ef9c41f1cd867028881a8beebf1ad55373c7 (patch)
treea8a0621e59f897544b1218eaf0ca513e1775a5cb /include
parente7cc5716d941ee2c1ec554926e76448092d9e0c5 (diff)
downloadlibirecovery-3491ef9c41f1cd867028881a8beebf1ad55373c7.tar.gz
libirecovery-3491ef9c41f1cd867028881a8beebf1ad55373c7.tar.bz2
Added irecv_set_configuration() and irecv_set_interface() functions and implemented bulk read
Diffstat (limited to 'include')
-rw-r--r--include/libirecovery.h67
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 @@
#include <libusb-1.0/libusb.h>
-#define IRECV_SUCCESS 0
-#define IRECV_ERROR_NO_DEVICE -1
-#define IRECV_ERROR_OUT_OF_MEMORY -2
-#define IRECV_ERROR_UNABLE_TO_CONNECT -3
-#define IRECV_ERROR_INVALID_INPUT -4
-#define IRECV_ERROR_UNKNOWN -5
-#define IRECV_ERROR_FILE_NOT_FOUND -6
-#define IRECV_ERROR_USB_UPLOAD -7
-#define IRECV_ERROR_USB_STATUS -8
+typedef enum {
+ IRECV_SUCCESS = 0,
+ IRECV_ERROR_NO_DEVICE = -1,
+ IRECV_ERROR_OUT_OF_MEMORY = -2,
+ IRECV_ERROR_UNABLE_TO_CONNECT = -3,
+ IRECV_ERROR_INVALID_INPUT = -4,
+ IRECV_ERROR_UNKNOWN = -5,
+ IRECV_ERROR_FILE_NOT_FOUND = -6,
+ IRECV_ERROR_USB_UPLOAD = -7,
+ IRECV_ERROR_USB_STATUS = -8,
+ IRECV_ERROR_USB_INTERFACE = -9,
+ IRECV_ERROR_USB_CONFIGURATION = -10
+} irecv_error_t;
-enum {
+typedef enum {
kAppleId = 0x05AC,
kKernelMode = 0x1294,
kRecoveryMode = 0x1281,
kDfuMode = 0x1227
-};
+} irecv_mode_t;
struct irecv_device;
typedef struct irecv_device irecv_device_t;
-typedef int(*irecv_send_callback)(irecv_device_t* device, unsigned char* data, unsigned int size);
-typedef int(*irecv_receive_callback)(irecv_device_t* device, unsigned char* data, unsigned int size);
+typedef int(*irecv_send_callback)(irecv_device_t* device, unsigned char* data, int size);
+typedef int(*irecv_receive_callback)(irecv_device_t* device, unsigned char* data, int size);
struct irecv_device {
- unsigned int mode;
- unsigned int debug;
- struct libusb_context* context;
- struct libusb_device_handle* handle;
- irecv_receive_callback receive_callback;
+ int debug;
+ int config;
+ int interface;
+ int alt_interface;
+ irecv_mode_t mode;
+ libusb_context* context;
+ libusb_device_handle* handle;
irecv_send_callback send_callback;
+ irecv_receive_callback receive_callback;
};
irecv_device_t* irecv_init();
-int irecv_open(irecv_device_t* device);
-int irecv_exit(irecv_device_t* device);
-int irecv_reset(irecv_device_t* device);
-int irecv_close(irecv_device_t* device);
-void irecv_update(irecv_device_t* device);
-void irecv_set_debug(irecv_device_t* device, int level);
-int irecv_send_file(irecv_device_t* device, const char* filename);
-int irecv_send_command(irecv_device_t* device, unsigned char* command);
-int irecv_send_buffer(irecv_device_t* device, unsigned char* buffer, int length);
-int irecv_set_sender(irecv_device_t* device, irecv_send_callback callback);
-int irecv_set_receiver(irecv_device_t* device, irecv_receive_callback callback);
+irecv_error_t irecv_open(irecv_device_t* device);
+irecv_error_t irecv_exit(irecv_device_t* device);
+irecv_error_t irecv_reset(irecv_device_t* device);
+irecv_error_t irecv_close(irecv_device_t* device);
+irecv_error_t irecv_update(irecv_device_t* device);
+irecv_error_t irecv_set_debug(irecv_device_t* device, int level);
+irecv_error_t irecv_send_file(irecv_device_t* device, const char* filename);
+irecv_error_t irecv_send_command(irecv_device_t* device, unsigned char* command);
+irecv_error_t irecv_set_configuration(irecv_device_t* device, int configuration);
+irecv_error_t irecv_set_sender(irecv_device_t* device, irecv_send_callback callback);
+irecv_error_t irecv_set_receiver(irecv_device_t* device, irecv_receive_callback callback);
+irecv_error_t irecv_set_interface(irecv_device_t* device, int interface, int alt_interface);
+irecv_error_t irecv_send_buffer(irecv_device_t* device, unsigned char* buffer, unsigned int length);