summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libirecovery.h12
-rw-r--r--src/irecovery.c106
-rw-r--r--src/libirecovery.c136
3 files changed, 94 insertions, 160 deletions
diff --git a/include/libirecovery.h b/include/libirecovery.h
index ab43663..a501c0f 100644
--- a/include/libirecovery.h
+++ b/include/libirecovery.h
@@ -43,7 +43,7 @@ typedef enum {
43} irecv_error_t; 43} irecv_error_t;
44 44
45typedef enum { 45typedef enum {
46 IRECV_DATA_RECV = 1, 46 IRECV_RECEIVED = 1,
47 IRECV_PRECOMMAND = 2, 47 IRECV_PRECOMMAND = 2,
48 IRECV_POSTCOMMAND = 3, 48 IRECV_POSTCOMMAND = 3,
49 IRECV_CONNECTED = 4, 49 IRECV_CONNECTED = 4,
@@ -52,16 +52,13 @@ typedef enum {
52} irecv_event_type; 52} irecv_event_type;
53 53
54typedef struct { 54typedef struct {
55 int size;
55 char* data; 56 char* data;
56 irecv_event_type type; 57 irecv_event_type type;
57} irecv_event_t; 58} irecv_event_t;
58 59
59struct irecv_client; 60struct irecv_client;
60typedef struct irecv_client* irecv_client_t; 61typedef struct irecv_client* irecv_client_t;
61
62typedef int(*irecv_send_callback)(irecv_client_t client, unsigned char* data, int size);
63typedef int(*irecv_receive_callback)(irecv_client_t client, unsigned char* data, int size);
64
65typedef int(*irecv_event_cb_t)(irecv_client_t client, const irecv_event_t* event); 62typedef int(*irecv_event_cb_t)(irecv_client_t client, const irecv_event_t* event);
66 63
67struct irecv_client { 64struct irecv_client {
@@ -72,8 +69,7 @@ struct irecv_client {
72 unsigned short mode; 69 unsigned short mode;
73 libusb_context* context; 70 libusb_context* context;
74 libusb_device_handle* handle; 71 libusb_device_handle* handle;
75 irecv_send_callback send_callback; 72 irecv_event_cb_t received_callback;
76 irecv_receive_callback receive_callback;
77 irecv_event_cb_t precommand_callback; 73 irecv_event_cb_t precommand_callback;
78 irecv_event_cb_t postcommand_callback; 74 irecv_event_cb_t postcommand_callback;
79}; 75};
@@ -92,8 +88,6 @@ irecv_error_t irecv_send(irecv_client_t client, unsigned char* command);
92irecv_error_t irecv_send_file(irecv_client_t client, const char* filename); 88irecv_error_t irecv_send_file(irecv_client_t client, const char* filename);
93irecv_error_t irecv_send_command(irecv_client_t client, unsigned char* command); 89irecv_error_t irecv_send_command(irecv_client_t client, unsigned char* command);
94irecv_error_t irecv_set_configuration(irecv_client_t client, int configuration); 90irecv_error_t irecv_set_configuration(irecv_client_t client, int configuration);
95irecv_error_t irecv_set_sender(irecv_client_t client, irecv_send_callback callback);
96irecv_error_t irecv_set_receiver(irecv_client_t client, irecv_receive_callback callback);
97irecv_error_t irecv_set_interface(irecv_client_t client, int interface, int alt_interface); 91irecv_error_t irecv_set_interface(irecv_client_t client, int interface, int alt_interface);
98irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, unsigned int length); 92irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, unsigned int length);
99const char* irecv_strerror(irecv_error_t error); 93const char* irecv_strerror(irecv_error_t error);
diff --git a/src/irecovery.c b/src/irecovery.c
index d53cf9b..a763272 100644
--- a/src/irecovery.c
+++ b/src/irecovery.c
@@ -33,25 +33,28 @@ enum {
33static unsigned int quit = 0; 33static unsigned int quit = 0;
34static unsigned int verbose = 0; 34static unsigned int verbose = 0;
35 35
36int received_cb(irecv_client_t client, const irecv_event_t* event);
36int precommand_cb(irecv_client_t client, const irecv_event_t* event); 37int precommand_cb(irecv_client_t client, const irecv_event_t* event);
37int postcommand_cb(irecv_client_t client, const irecv_event_t* event); 38int postcommand_cb(irecv_client_t client, const irecv_event_t* event);
38 39
39void print_shell_usage() { 40void shell_usage() {
40 printf("Usage:\n"); 41 printf("Usage:\n");
41 printf("\t/upload <file>\tSend file to client.\n"); 42 printf("\t/upload <file>\tSend file to client.\n");
43 printf("\t/exploit [file]\tSend usb exploit with optional payload\n");
42 printf("\t/help\t\tShow this help.\n"); 44 printf("\t/help\t\tShow this help.\n");
43 printf("\t/exit\t\tExit interactive shell.\n"); 45 printf("\t/exit\t\tExit interactive shell.\n");
44} 46}
45 47
46void parse_command(irecv_client_t client, unsigned char* command, unsigned int size) { 48void parse_command(irecv_client_t client, unsigned char* command, unsigned int size) {
47 char* cmd = strtok(strdup(command), " "); 49 char* cmd = strdup(command);
48 debug("Executing %s %s\n", cmd, command); 50 char* action = strtok(cmd, " ");
51 debug("Executing %s\n", action);
49 if (!strcmp(cmd, "/exit")) { 52 if (!strcmp(cmd, "/exit")) {
50 quit = 1; 53 quit = 1;
51 } else 54 } else
52 55
53 if (!strcmp(cmd, "/help")) { 56 if (!strcmp(cmd, "/help")) {
54 print_shell_usage(); 57 shell_usage();
55 } else 58 } else
56 59
57 if (!strcmp(cmd, "/upload")) { 60 if (!strcmp(cmd, "/upload")) {
@@ -60,22 +63,18 @@ void parse_command(irecv_client_t client, unsigned char* command, unsigned int s
60 if (filename != NULL) { 63 if (filename != NULL) {
61 irecv_send_file(client, filename); 64 irecv_send_file(client, filename);
62 } 65 }
63 } 66 } else
64 free(cmd);
65}
66 67
67int recv_callback(irecv_client_t client, unsigned char* data, int size) { 68 if (!strcmp(cmd, "/exploit")) {
68 int i = 0; 69 char* filename = strtok(NULL, " ");
69 for (i = 0; i < size; i++) { 70 debug("Sending %s\n", filename);
70 printf("%c", data[i]); 71 if (filename != NULL) {
72 irecv_send_file(client, filename);
73 }
74 irecv_send_exploit(client);
71 } 75 }
72 return size;
73}
74 76
75int send_callback(irecv_client_t client, unsigned char* command, int size) { 77 free(action);
76
77
78 return size;
79} 78}
80 79
81void load_command_history() { 80void load_command_history() {
@@ -90,7 +89,7 @@ void append_command_to_history(char* cmd) {
90void init_shell(irecv_client_t client) { 89void init_shell(irecv_client_t client) {
91 irecv_error_t error = 0; 90 irecv_error_t error = 0;
92 load_command_history(); 91 load_command_history();
93 irecv_set_receiver(client, &recv_callback); 92 irecv_event_subscribe(client, IRECV_RECEIVED, &received_cb, NULL);
94 irecv_event_subscribe(client, IRECV_PRECOMMAND, &precommand_cb, NULL); 93 irecv_event_subscribe(client, IRECV_PRECOMMAND, &precommand_cb, NULL);
95 irecv_event_subscribe(client, IRECV_POSTCOMMAND, &postcommand_cb, NULL); 94 irecv_event_subscribe(client, IRECV_POSTCOMMAND, &postcommand_cb, NULL);
96 while (!quit) { 95 while (!quit) {
@@ -113,49 +112,64 @@ void init_shell(irecv_client_t client) {
113 } 112 }
114} 113}
115 114
116void print_usage() { 115int received_cb(irecv_client_t client, const irecv_event_t* event) {
117 printf("iRecovery - iDevice Recovery Utility\n"); 116 if (event->type == IRECV_RECEIVED) {
118 printf("Usage: ./irecovery [args]\n"); 117 int i = 0;
119 printf("\t-v\t\tStart irecovery in verbose mode.\n"); 118 int size = event->size;
120 printf("\t-c <cmd>\tSend command to client.\n"); 119 char* data = event->data;
121 printf("\t-f <file>\tSend file to client.\n"); 120 for (i = 0; i < size; i++) {
122 printf("\t-k [exploit]\tSend usb exploit to client.\n"); 121 printf("%c", data[i]);
123 printf("\t-h\t\tShow this help.\n"); 122 }
124 printf("\t-r\t\tReset client.\n"); 123 }
125 printf("\t-s\t\tStart interactive shell.\n"); 124 return 0;
126 exit(1);
127} 125}
128 126
129int precommand_cb(irecv_client_t client, const irecv_event_t* event) { 127int precommand_cb(irecv_client_t client, const irecv_event_t* event) {
130 irecv_error_t error = 0; 128 if (event->type == IRECV_PRECOMMAND) {
131 if (event->data[0] == '/') { 129 irecv_error_t error = 0;
132 parse_command(client, event->data, strlen(event->data)); 130 if (event->data[0] == '/') {
133 return -1; 131 parse_command(client, event->data, event->size);
132 return -1;
133 }
134 } 134 }
135 return 0; 135 return 0;
136} 136}
137 137
138int postcommand_cb(irecv_client_t client, const irecv_event_t* event) { 138int postcommand_cb(irecv_client_t client, const irecv_event_t* event) {
139 irecv_error_t error = 0; 139 unsigned char* value = NULL;
140 if (strstr(event->data, "getenv") != NULL) { 140 if (event->type == IRECV_POSTCOMMAND) {
141 unsigned char* value = NULL; 141 irecv_error_t error = 0;
142 error = irecv_getenv(client, &value); 142 if (strstr(event->data, "getenv") != NULL) {
143 if (error != IRECV_E_SUCCESS) { 143 error = irecv_getenv(client, &value);
144 debug("%s\n", irecv_strerror(error)); 144 if (error != IRECV_E_SUCCESS) {
145 return error; 145 debug("%s\n", irecv_strerror(error));
146 return error;
147 }
148 printf("%s\n", value);
146 } 149 }
147 150
148 printf("%s\n", value); 151 if (!strcmp(event->data, "reboot")) {
149 free(value); 152 quit = 1;
150 } 153 }
151
152 if (!strcmp(event->data, "reboot")) {
153 quit = 1;
154 } 154 }
155 155
156 if (value != NULL) free(value);
156 return 0; 157 return 0;
157} 158}
158 159
160void print_usage() {
161 printf("iRecovery - iDevice Recovery Utility\n");
162 printf("Usage: ./irecovery [args]\n");
163 printf("\t-v\t\tStart irecovery in verbose mode.\n");
164 printf("\t-c <cmd>\tSend command to client.\n");
165 printf("\t-f <file>\tSend file to client.\n");
166 printf("\t-k [payload]\tSend usb exploit to client.\n");
167 printf("\t-h\t\tShow this help.\n");
168 printf("\t-r\t\tReset client.\n");
169 printf("\t-s\t\tStart interactive shell.\n");
170 exit(1);
171}
172
159int main(int argc, char** argv) { 173int main(int argc, char** argv) {
160 int i = 0; 174 int i = 0;
161 int opt = 0; 175 int opt = 0;
diff --git a/src/libirecovery.c b/src/libirecovery.c
index 8f029ed..a641562 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -27,9 +27,6 @@
27#define BUFFER_SIZE 0x1000 27#define BUFFER_SIZE 0x1000
28#define debug(...) if(client->debug) fprintf(stderr, __VA_ARGS__) 28#define debug(...) if(client->debug) fprintf(stderr, __VA_ARGS__)
29 29
30int irecv_default_sender(irecv_client_t client, unsigned char* data, int size);
31int irecv_default_receiver(irecv_client_t client, unsigned char* data, int size);
32
33irecv_error_t irecv_open(irecv_client_t* pclient) { 30irecv_error_t irecv_open(irecv_client_t* pclient) {
34 int i = 0; 31 int i = 0;
35 char serial[256]; 32 char serial[256];
@@ -41,7 +38,6 @@ irecv_error_t irecv_open(irecv_client_t* pclient) {
41 38
42 *pclient = NULL; 39 *pclient = NULL;
43 libusb_init(&usb_context); 40 libusb_init(&usb_context);
44 //libusb_init(NULL);
45 irecv_error_t error = IRECV_E_SUCCESS; 41 irecv_error_t error = IRECV_E_SUCCESS;
46 int usb_device_count = libusb_get_device_list(usb_context, &usb_device_list); 42 int usb_device_count = libusb_get_device_list(usb_context, &usb_device_list);
47 for (i = 0; i < usb_device_count; i++) { 43 for (i = 0; i < usb_device_count; i++) {
@@ -49,10 +45,11 @@ irecv_error_t irecv_open(irecv_client_t* pclient) {
49 libusb_get_device_descriptor(usb_device, &usb_descriptor); 45 libusb_get_device_descriptor(usb_device, &usb_descriptor);
50 if (usb_descriptor.idVendor == APPLE_VENDOR_ID) { 46 if (usb_descriptor.idVendor == APPLE_VENDOR_ID) {
51 /* verify this device is in a mode we understand */ 47 /* verify this device is in a mode we understand */
52 if (usb_descriptor.idProduct == kRecoveryMode1 || usb_descriptor.idProduct 48 if (usb_descriptor.idProduct == kRecoveryMode1 ||
53 == kRecoveryMode2 || usb_descriptor.idProduct == kRecoveryMode3 49 usb_descriptor.idProduct == kRecoveryMode2 ||
54 || usb_descriptor.idProduct == kRecoveryMode4 || usb_descriptor.idProduct 50 usb_descriptor.idProduct == kRecoveryMode3 ||
55 == kDfuMode) { 51 usb_descriptor.idProduct == kRecoveryMode4 ||
52 usb_descriptor.idProduct == kDfuMode) {
56 53
57 libusb_open(usb_device, &usb_handle); 54 libusb_open(usb_device, &usb_handle);
58 if (usb_handle == NULL) { 55 if (usb_handle == NULL) {
@@ -61,8 +58,6 @@ irecv_error_t irecv_open(irecv_client_t* pclient) {
61 libusb_exit(usb_context); 58 libusb_exit(usb_context);
62 return IRECV_E_UNABLE_TO_CONNECT; 59 return IRECV_E_UNABLE_TO_CONNECT;
63 } 60 }
64 libusb_set_debug(usb_context, 3);
65
66 libusb_free_device_list(usb_device_list, 1); 61 libusb_free_device_list(usb_device_list, 1);
67 62
68 irecv_client_t client = (irecv_client_t) malloc(sizeof(struct irecv_client)); 63 irecv_client_t client = (irecv_client_t) malloc(sizeof(struct irecv_client));
@@ -71,6 +66,7 @@ irecv_error_t irecv_open(irecv_client_t* pclient) {
71 libusb_exit(usb_context); 66 libusb_exit(usb_context);
72 return IRECV_E_OUT_OF_MEMORY; 67 return IRECV_E_OUT_OF_MEMORY;
73 } 68 }
69
74 memset(client, '\0', sizeof(struct irecv_client)); 70 memset(client, '\0', sizeof(struct irecv_client));
75 client->interface = 0; 71 client->interface = 0;
76 client->handle = usb_handle; 72 client->handle = usb_handle;
@@ -150,6 +146,10 @@ irecv_error_t irecv_reset(irecv_client_t client) {
150 146
151irecv_error_t irecv_event_subscribe(irecv_client_t client, irecv_event_type type, irecv_event_cb_t callback, void* user_data) { 147irecv_error_t irecv_event_subscribe(irecv_client_t client, irecv_event_type type, irecv_event_cb_t callback, void* user_data) {
152 switch(type) { 148 switch(type) {
149 case IRECV_RECEIVED:
150 client->received_callback = callback;
151 break;
152
153 case IRECV_PRECOMMAND: 153 case IRECV_PRECOMMAND:
154 client->precommand_callback = callback; 154 client->precommand_callback = callback;
155 break; 155 break;
@@ -167,6 +167,10 @@ irecv_error_t irecv_event_subscribe(irecv_client_t client, irecv_event_type type
167 167
168irecv_error_t irecv_event_unsubscribe(irecv_client_t client, irecv_event_type type) { 168irecv_error_t irecv_event_unsubscribe(irecv_client_t client, irecv_event_type type) {
169 switch(type) { 169 switch(type) {
170 case IRECV_RECEIVED:
171 client->received_callback = NULL;
172 break;
173
170 case IRECV_PRECOMMAND: 174 case IRECV_PRECOMMAND:
171 client->precommand_callback = NULL; 175 client->precommand_callback = NULL;
172 break; 176 break;
@@ -185,7 +189,7 @@ irecv_error_t irecv_event_unsubscribe(irecv_client_t client, irecv_event_type ty
185irecv_error_t irecv_close(irecv_client_t client) { 189irecv_error_t irecv_close(irecv_client_t client) {
186 if (client != NULL) { 190 if (client != NULL) {
187 if (client->handle != NULL) { 191 if (client->handle != NULL) {
188 libusb_release_interface(client->handle, 1); 192 libusb_release_interface(client->handle, client->interface);
189 libusb_close(client->handle); 193 libusb_close(client->handle);
190 client->handle = NULL; 194 client->handle = NULL;
191 } 195 }
@@ -212,39 +216,11 @@ irecv_error_t irecv_set_debug(irecv_client_t client, int level) {
212 return IRECV_E_SUCCESS; 216 return IRECV_E_SUCCESS;
213} 217}
214 218
215irecv_error_t irecv_send(irecv_client_t client, unsigned char* command) {
216 if (client == NULL || client->handle == NULL) {
217 return IRECV_E_NO_DEVICE;
218 }
219
220 unsigned int length = strlen(command);
221 if (length >= 0x100) {
222 length = 0xFF;
223 }
224
225 if (client->send_callback != NULL) {
226 // Call our user defined callback first, this must return a number of bytes to send
227 // or zero to abort send.
228 length = client->send_callback(client, command, length);
229 }
230
231 if (length > 0) {
232 irecv_send_command(client, command);
233 }
234
235 return IRECV_E_SUCCESS;
236}
237
238irecv_error_t irecv_send_command(irecv_client_t client, unsigned char* command) { 219irecv_error_t irecv_send_command(irecv_client_t client, unsigned char* command) {
239 if (client == NULL || client->handle == NULL) { 220 if (client == NULL || client->handle == NULL) {
240 return IRECV_E_NO_DEVICE; 221 return IRECV_E_NO_DEVICE;
241 } 222 }
242 /* 223
243 irecv_error_t error = irecv_set_interface(client, 1, 1);
244 if(error != IRECV_E_SUCCESS) {
245 return error;
246 }
247 */
248 unsigned int length = strlen(command); 224 unsigned int length = strlen(command);
249 if (length >= 0x100) { 225 if (length >= 0x100) {
250 length = 0xFF; 226 length = 0xFF;
@@ -252,6 +228,7 @@ irecv_error_t irecv_send_command(irecv_client_t client, unsigned char* command)
252 228
253 irecv_event_t event; 229 irecv_event_t event;
254 if(client->precommand_callback != NULL) { 230 if(client->precommand_callback != NULL) {
231 event.size = length;
255 event.data = command; 232 event.data = command;
256 event.type = IRECV_PRECOMMAND; 233 event.type = IRECV_PRECOMMAND;
257 if(client->precommand_callback(client, &event)) { 234 if(client->precommand_callback(client, &event)) {
@@ -264,6 +241,7 @@ irecv_error_t irecv_send_command(irecv_client_t client, unsigned char* command)
264 } 241 }
265 242
266 if(client->postcommand_callback != NULL) { 243 if(client->postcommand_callback != NULL) {
244 event.size = length;
267 event.data = command; 245 event.data = command;
268 event.type = IRECV_POSTCOMMAND; 246 event.type = IRECV_POSTCOMMAND;
269 if(client->postcommand_callback(client, &event)) { 247 if(client->postcommand_callback(client, &event)) {
@@ -312,12 +290,7 @@ irecv_error_t irecv_get_status(irecv_client_t client, unsigned int* status) {
312 *status = 0; 290 *status = 0;
313 return IRECV_E_NO_DEVICE; 291 return IRECV_E_NO_DEVICE;
314 } 292 }
315 /* 293
316 irecv_error_t error = irecv_set_interface(client, 1, 1);
317 if(error != IRECV_E_SUCCESS) {
318 return error;
319 }
320 */
321 unsigned char buffer[6]; 294 unsigned char buffer[6];
322 memset(buffer, '\0', 6); 295 memset(buffer, '\0', 6);
323 if (libusb_control_transfer(client->handle, 0xA1, 3, 0, 0, buffer, 6, 1000) != 6) { 296 if (libusb_control_transfer(client->handle, 0xA1, 3, 0, 0, buffer, 6, 1000) != 6) {
@@ -335,12 +308,7 @@ irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, un
335 if (client == NULL || client->handle == NULL) { 308 if (client == NULL || client->handle == NULL) {
336 return IRECV_E_NO_DEVICE; 309 return IRECV_E_NO_DEVICE;
337 } 310 }
338 /* 311
339 error = irecv_set_interface(client, 1, 1);
340 if(error != IRECV_E_SUCCESS) {
341 return error;
342 }
343 */
344 int last = length % 0x800; 312 int last = length % 0x800;
345 int packets = length / 0x800; 313 int packets = length / 0x800;
346 if (last != 0) { 314 if (last != 0) {
@@ -387,54 +355,22 @@ irecv_error_t irecv_receive(irecv_client_t client) {
387 if (client == NULL || client->handle == NULL) { 355 if (client == NULL || client->handle == NULL) {
388 return IRECV_E_NO_DEVICE; 356 return IRECV_E_NO_DEVICE;
389 } 357 }
390 /* 358
391 irecv_error_t error = irecv_set_interface(client, 1, 1);
392 if(error != IRECV_E_SUCCESS) {
393 return error;
394 }
395 */
396 int bytes = 0; 359 int bytes = 0;
397 while (libusb_bulk_transfer(client->handle, 0x81, buffer, BUFFER_SIZE, &bytes, 100) == 0) { 360 while (libusb_bulk_transfer(client->handle, 0x81, buffer, BUFFER_SIZE, &bytes, 100) == 0) {
398 if (bytes > 0) { 361 if (bytes > 0) {
399 if (client->receive_callback != NULL) { 362 if (client->received_callback != NULL) {
400 if (client->receive_callback(client, buffer, bytes) != bytes) { 363 irecv_event_t event;
401 return IRECV_E_UNKNOWN_ERROR; 364 event.size = bytes;
365 event.data = buffer;
366 event.type = IRECV_RECEIVED;
367 if (client->received_callback(client, &event) != 0) {
368 return IRECV_E_SUCCESS;
402 } 369 }
403 } 370 }
404 } else 371 } else break;
405 break;
406 }
407
408 return IRECV_E_SUCCESS;
409}
410
411int irecv_default_sender(irecv_client_t client, unsigned char* data, int size) {
412 return size;
413}
414
415int irecv_default_receiver(irecv_client_t client, unsigned char* data, int size) {
416 int i = 0;
417 for (i = 0; i < size; i++) {
418 printf("%c", data[i]);
419 }
420 return size;
421}
422
423irecv_error_t irecv_set_receiver(irecv_client_t client, irecv_receive_callback callback) {
424 if (client == NULL) {
425 return IRECV_E_NO_DEVICE;
426 }
427
428 client->receive_callback = callback;
429 return IRECV_E_SUCCESS;
430}
431
432irecv_error_t irecv_set_sender(irecv_client_t client, irecv_send_callback callback) {
433 if (client == NULL) {
434 return IRECV_E_NO_DEVICE;
435 } 372 }
436 373
437 client->send_callback = callback;
438 return IRECV_E_SUCCESS; 374 return IRECV_E_SUCCESS;
439} 375}
440 376
@@ -442,12 +378,7 @@ irecv_error_t irecv_getenv(irecv_client_t client, unsigned char** var) {
442 if (client == NULL || client->handle == NULL) { 378 if (client == NULL || client->handle == NULL) {
443 return IRECV_E_NO_DEVICE; 379 return IRECV_E_NO_DEVICE;
444 } 380 }
445 /* 381
446 irecv_error_t error = irecv_set_interface(client, 1, 1);
447 if(error != IRECV_E_SUCCESS) {
448 return error;
449 }
450 */
451 unsigned char* value = (unsigned char*) malloc(256); 382 unsigned char* value = (unsigned char*) malloc(256);
452 if (value == NULL) { 383 if (value == NULL) {
453 return IRECV_E_OUT_OF_MEMORY; 384 return IRECV_E_OUT_OF_MEMORY;
@@ -488,12 +419,7 @@ irecv_error_t irecv_send_exploit(irecv_client_t client) {
488 if (client == NULL || client->handle == NULL) { 419 if (client == NULL || client->handle == NULL) {
489 return IRECV_E_NO_DEVICE; 420 return IRECV_E_NO_DEVICE;
490 } 421 }
491 /* 422
492 irecv_error_t error = irecv_set_interface(client, 1, 1);
493 if(error != IRECV_E_SUCCESS) {
494 return error;
495 }
496 */
497 libusb_control_transfer(client->handle, 0x21, 2, 0, 0, NULL, 0, 100); 423 libusb_control_transfer(client->handle, 0x21, 2, 0, 0, NULL, 0, 100);
498 return IRECV_E_SUCCESS; 424 return IRECV_E_SUCCESS;
499} 425}