mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
usb-host: avoid libusb_set_configuration calls
Seems some devices become confused when we call libusb_set_configuration(). So before calling the function check whenever the device has multiple configurations in the first place, and in case it hasn't (which is the case for the majority of devices) simply skip the call as it will have no effect anyway. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20190522094702.17619-4-kraxel@redhat.com
This commit is contained in:
parent
65f14ab98d
commit
bfe4489884
1 changed files with 10 additions and 8 deletions
|
@ -1225,11 +1225,12 @@ static void usb_host_set_address(USBHostDevice *s, int addr)
|
|||
|
||||
static void usb_host_set_config(USBHostDevice *s, int config, USBPacket *p)
|
||||
{
|
||||
int rc;
|
||||
int rc = 0;
|
||||
|
||||
trace_usb_host_set_config(s->bus_num, s->addr, config);
|
||||
|
||||
usb_host_release_interfaces(s);
|
||||
if (s->ddesc.bNumConfigurations != 1) {
|
||||
rc = libusb_set_configuration(s->dh, config);
|
||||
if (rc != 0) {
|
||||
usb_host_libusb_error("libusb_set_configuration", rc);
|
||||
|
@ -1239,6 +1240,7 @@ static void usb_host_set_config(USBHostDevice *s, int config, USBPacket *p)
|
|||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
p->status = usb_host_claim_interfaces(s, config);
|
||||
if (p->status != USB_RET_SUCCESS) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue