diff --git a/repos/libports/src/lib/qemu-usb/host.cc b/repos/libports/src/lib/qemu-usb/host.cc index 233435aa07..624bf1a8ed 100644 --- a/repos/libports/src/lib/qemu-usb/host.cc +++ b/repos/libports/src/lib/qemu-usb/host.cc @@ -269,7 +269,8 @@ struct Usb_host_device : List::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::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::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) { } } } };