forked from len0rd/rockbox
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
This commit is contained in:
parent
e461f2ec18
commit
7e0ed6b79f
1 changed files with 12 additions and 3 deletions
|
|
@ -106,6 +106,7 @@ void do_patching(void)
|
||||||
struct usb_device *tmp_dev;
|
struct usb_device *tmp_dev;
|
||||||
struct usb_device *dev = NULL;
|
struct usb_device *dev = NULL;
|
||||||
usb_dev_handle *dh;
|
usb_dev_handle *dh;
|
||||||
|
int err;
|
||||||
|
|
||||||
fprintf(stderr,"[INFO] Searching for E200R\n");
|
fprintf(stderr,"[INFO] Searching for E200R\n");
|
||||||
|
|
||||||
|
|
@ -148,13 +149,21 @@ found:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "must be called" written in the libusb documentation */
|
err = usb_set_configuration(dh, 1);
|
||||||
if (usb_claim_interface(dh, dev->config->interface->altsetting->bInterfaceNumber)) {
|
|
||||||
fprintf(stderr, "[ERR] Device is busy. (I was unable to claim its interface.)\n");
|
if (err < 0) {
|
||||||
|
fprintf(stderr, "[ERR] usb_set_configuration failed (%d)\n", err);
|
||||||
usb_close(dh);
|
usb_close(dh);
|
||||||
return;
|
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");
|
fprintf(stderr,"[INFO] Found E200R, uploading patching application.\n");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue