1
0
Fork 0
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:
Dave Chapman 2007-09-15 22:47:42 +00:00
parent e461f2ec18
commit 7e0ed6b79f

View file

@ -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");