diff options
author | Martin Aumueller | 2008-08-04 13:08:44 +0200 |
---|---|---|
committer | Matt Colyer | 2008-08-04 23:02:47 -0700 |
commit | fe2cb86652d8f2038df64f2cb5985dd1088db051 (patch) | |
tree | 167bdf9a6292da0b35358d73915910d8ecd638b2 /src | |
parent | 279222bdb5b8a0ae430a2f553659407f9c8c2236 (diff) | |
download | libplist-fe2cb86652d8f2038df64f2cb5985dd1088db051.tar.gz libplist-fe2cb86652d8f2038df64f2cb5985dd1088db051.tar.bz2 |
Print strerror of negated return values after failed usb_bulk_write/read.
Signed-off-by: Matt Colyer <matt@colyer.name>
Diffstat (limited to 'src')
-rw-r--r-- | src/iphone.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/iphone.c b/src/iphone.c index 6833e4c..5aefbf6 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -87,14 +87,15 @@ iPhone *get_iPhone() { if (bytes < 20 && debug) { printf("get_iPhone(): libusb did NOT send enough!\n"); if (bytes < 0) { - printf("get_iPhone(): libusb gave me the error: %s\n", usb_strerror()); + printf("get_iPhone(): libusb gave me the error %d: %s (%s)\n", + bytes, usb_strerror(), strerror(-bytes)); } } bytes = usb_bulk_read(phone->device, BULKIN, (char*)version, sizeof(*version), 800); if (bytes < 20) { free_iPhone(phone); if (debug) printf("get_iPhone(): Invalid version message -- header too short.\n"); - if (debug && bytes < 0) printf("get_iPhone(): libusb error message: %s\n", usb_strerror()); + if (debug && bytes < 0) printf("get_iPhone(): libusb error message %d: %s (%s)\n", usb_strerror(), strerror(-bytes)); return NULL; } else { if (ntohl(version->major) == 1 && ntohl(version->minor) == 0) { @@ -149,7 +150,7 @@ int send_to_phone(iPhone *phone, char *data, int datalen) { if (debug) printf("noooo...?\n"); if (bytes < datalen) { if(debug && bytes < 0) - printf("send_to_iphone(): libusb gave me the error: %s\n", usb_strerror()); + printf("send_to_iphone(): libusb gave me the error %d: %s\n", bytes, usb_strerror(), strerror(-bytes)); return -1; } else { return bytes; @@ -173,7 +174,7 @@ int recv_from_phone(iPhone *phone, char *data, int datalen) { 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()); + if(debug) printf("recv_from_iphone(): libusb gave me the error %d: %s (%s)\n", bytes, usb_strerror(), strerror(-bytes)); return -1; } return bytes; |