diff options
author | Dave Chapman <dave@dchapman.com> | 2007-09-15 22:47:42 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2007-09-15 22:47:42 +0000 |
commit | 7e0ed6b79f2f5dbbb5843ed836ea07ba675e731d (patch) | |
tree | 95d7540bbf87c6a094e9866e7a9c5aa9a63fde0c /rbutil/e200rpatcher | |
parent | e461f2ec1864e51799f6d363aedaa4634f28cfd9 (diff) |
Add a call to usb_set_configuration() (apparently required for both Windows and Linux, but Linux didn't seem to mind) and also add some more error checking/reporting.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14721 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/e200rpatcher')
-rw-r--r-- | rbutil/e200rpatcher/e200rpatcher.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/rbutil/e200rpatcher/e200rpatcher.c b/rbutil/e200rpatcher/e200rpatcher.c index eff6dc136b..8d0c674a5e 100644 --- a/rbutil/e200rpatcher/e200rpatcher.c +++ b/rbutil/e200rpatcher/e200rpatcher.c @@ -106,6 +106,7 @@ void do_patching(void) struct usb_device *tmp_dev; struct usb_device *dev = NULL; usb_dev_handle *dh; + int err; fprintf(stderr,"[INFO] Searching for E200R\n"); @@ -148,13 +149,21 @@ found: return; } - /* "must be called" written in the libusb documentation */ - if (usb_claim_interface(dh, dev->config->interface->altsetting->bInterfaceNumber)) { - fprintf(stderr, "[ERR] Device is busy. (I was unable to claim its interface.)\n"); + err = usb_set_configuration(dh, 1); + + if (err < 0) { + fprintf(stderr, "[ERR] usb_set_configuration failed (%d)\n", err); usb_close(dh); return; } + /* "must be called" written in the libusb documentation */ + err = usb_claim_interface(dh, dev->config->interface->altsetting->bInterfaceNumber); + if (err < 0) { + fprintf(stderr, "[ERR] Unable to claim interface (%d)\n", err); + usb_close(dh); + return; + } fprintf(stderr,"[INFO] Found E200R, uploading patching application.\n"); |