mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 10:46:25 +00:00
qemu-usb: handle Interface_not_found exceptions
Fix genodelabs/genode#4572
This commit is contained in:
parent
560747c22e
commit
48eacb6f79
@ -269,7 +269,8 @@ struct Usb_host_device : List<Usb_host_device>::Element
|
||||
|
||||
for (unsigned i = 0; i < cdescr.num_interfaces; i++) {
|
||||
try { usb_raw.release_interface(i); }
|
||||
catch (Usb::Session::Device_not_found) { return; }
|
||||
catch (Usb::Session::Device_not_found) { return; }
|
||||
catch (Usb::Session::Interface_not_found) { return; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,7 +288,7 @@ struct Usb_host_device : List<Usb_host_device>::Element
|
||||
usb_raw.claim_interface(i);
|
||||
} catch (Usb::Session::Interface_already_claimed) {
|
||||
result = false;
|
||||
}
|
||||
} catch (Usb::Session::Interface_not_found) { }
|
||||
}
|
||||
|
||||
if (!result) error("device already claimed");
|
||||
@ -675,22 +676,24 @@ struct Usb_host_device : List<Usb_host_device>::Element
|
||||
catch (Usb::Session::Device_not_found) { return; }
|
||||
|
||||
for (unsigned i = 0; i < cdescr.num_interfaces; i++) {
|
||||
Usb::Interface_descriptor iface;
|
||||
uint8_t const altsetting = udev->altsetting[i];
|
||||
usb_raw.interface_descriptor(i, altsetting, &iface);
|
||||
for (unsigned k = 0; k < iface.num_endpoints; k++) {
|
||||
Usb::Endpoint_descriptor endp;
|
||||
usb_raw.endpoint_descriptor(i, altsetting, k, &endp);
|
||||
try {
|
||||
Usb::Interface_descriptor iface;
|
||||
uint8_t const altsetting = udev->altsetting[i];
|
||||
usb_raw.interface_descriptor(i, altsetting, &iface);
|
||||
for (unsigned k = 0; k < iface.num_endpoints; k++) {
|
||||
Usb::Endpoint_descriptor endp;
|
||||
usb_raw.endpoint_descriptor(i, altsetting, k, &endp);
|
||||
|
||||
int const pid = (endp.address & USB_DIR_IN) ? USB_TOKEN_IN : USB_TOKEN_OUT;
|
||||
int const ep = (endp.address & 0xf);
|
||||
uint8_t const type = (endp.attributes & 0x3);
|
||||
int const pid = (endp.address & USB_DIR_IN) ? USB_TOKEN_IN : USB_TOKEN_OUT;
|
||||
int const ep = (endp.address & 0xf);
|
||||
uint8_t const type = (endp.attributes & 0x3);
|
||||
|
||||
usb_ep_set_max_packet_size(udev, pid, ep, endp.max_packet_size);
|
||||
usb_ep_set_type(udev, pid, ep, type);
|
||||
usb_ep_set_ifnum(udev, pid, ep, i);
|
||||
usb_ep_set_halted(udev, pid, ep, 0);
|
||||
}
|
||||
usb_ep_set_max_packet_size(udev, pid, ep, endp.max_packet_size);
|
||||
usb_ep_set_type(udev, pid, ep, type);
|
||||
usb_ep_set_ifnum(udev, pid, ep, i);
|
||||
usb_ep_set_halted(udev, pid, ep, 0);
|
||||
}
|
||||
} catch (Usb::Session::Interface_not_found) { }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user