diff options
-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 | ||