Commit 9698bafc authored by Martin Aumueller's avatar Martin Aumueller Committed by Matt Colyer

Print libusb errors during usb_bulk_read/write.

Signed-off-by: 's avatarMatt Colyer <matt@colyer.name>
parent 4750a54d
...@@ -148,6 +148,8 @@ int send_to_phone(iPhone *phone, char *data, int datalen) { ...@@ -148,6 +148,8 @@ int send_to_phone(iPhone *phone, char *data, int datalen) {
bytes = usb_bulk_write(phone->device, BULKOUT, data, datalen, 800); bytes = usb_bulk_write(phone->device, BULKOUT, data, datalen, 800);
if (debug) printf("noooo...?\n"); if (debug) printf("noooo...?\n");
if (bytes < datalen) { if (bytes < datalen) {
if(debug && bytes < 0)
printf("send_to_iphone(): libusb gave me the error: %s\n", usb_strerror());
return -1; return -1;
} else { } else {
return bytes; return bytes;
...@@ -169,6 +171,11 @@ int recv_from_phone(iPhone *phone, char *data, int datalen) { ...@@ -169,6 +171,11 @@ int recv_from_phone(iPhone *phone, char *data, int datalen) {
if (!phone) return -1; if (!phone) return -1;
int bytes = 0; int bytes = 0;
bytes = usb_bulk_read(phone->device, BULKIN, data, datalen, 3500); bytes = usb_bulk_read(phone->device, BULKIN, data, datalen, 3500);
if(bytes < 0)
{
if(debug) printf("recv_from_iphone(): libusb gave me the error: %s\n", usb_strerror());
return -1;
}
return bytes; return bytes;
} }
...@@ -112,7 +112,12 @@ void mux_close_connection(iPhone *phone, usbmux_tcp_header *connection) { ...@@ -112,7 +112,12 @@ void mux_close_connection(iPhone *phone, usbmux_tcp_header *connection) {
int bytes = 0; int bytes = 0;
bytes = usb_bulk_write(phone->device, BULKOUT, (char*)connection, sizeof(*connection), 800); bytes = usb_bulk_write(phone->device, BULKOUT, (char*)connection, sizeof(*connection), 800);
if(debug && bytes < 0)
printf("mux_close_connection(): when writing, libusb gave me the error: %s\n", usb_strerror());
bytes = usb_bulk_read(phone->device, BULKIN, (char*)connection, sizeof(*connection), 800); bytes = usb_bulk_read(phone->device, BULKIN, (char*)connection, sizeof(*connection), 800);
if(debug && bytes < 0)
printf("get_iPhone(): when reading, libusb gave me the error: %s\n", usb_strerror());
free(connection); free(connection);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment