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 | |
parent | e461f2ec1864e51799f6d363aedaa4634f28cfd9 (diff) | |
download | rockbox-7e0ed6b79f2f5dbbb5843ed836ea07ba675e731d.tar.gz rockbox-7e0ed6b79f2f5dbbb5843ed836ea07ba675e731d.zip |
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
-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) | |||
106 | struct usb_device *tmp_dev; | 106 | struct usb_device *tmp_dev; |
107 | struct usb_device *dev = NULL; | 107 | struct usb_device *dev = NULL; |
108 | usb_dev_handle *dh; | 108 | usb_dev_handle *dh; |
109 | int err; | ||
109 | 110 | ||
110 | fprintf(stderr,"[INFO] Searching for E200R\n"); | 111 | fprintf(stderr,"[INFO] Searching for E200R\n"); |
111 | 112 | ||
@@ -148,13 +149,21 @@ found: | |||
148 | return; | 149 | return; |
149 | } | 150 | } |
150 | 151 | ||
151 | /* "must be called" written in the libusb documentation */ | 152 | err = usb_set_configuration(dh, 1); |
152 | if (usb_claim_interface(dh, dev->config->interface->altsetting->bInterfaceNumber)) { | 153 | |
153 | fprintf(stderr, "[ERR] Device is busy. (I was unable to claim its interface.)\n"); | 154 | if (err < 0) { |
155 | fprintf(stderr, "[ERR] usb_set_configuration failed (%d)\n", err); | ||
154 | usb_close(dh); | 156 | usb_close(dh); |
155 | return; | 157 | return; |
156 | } | 158 | } |
157 | 159 | ||
160 | /* "must be called" written in the libusb documentation */ | ||
161 | err = usb_claim_interface(dh, dev->config->interface->altsetting->bInterfaceNumber); | ||
162 | if (err < 0) { | ||
163 | fprintf(stderr, "[ERR] Unable to claim interface (%d)\n", err); | ||
164 | usb_close(dh); | ||
165 | return; | ||
166 | } | ||
158 | 167 | ||
159 | fprintf(stderr,"[INFO] Found E200R, uploading patching application.\n"); | 168 | fprintf(stderr,"[INFO] Found E200R, uploading patching application.\n"); |
160 | 169 | ||