From f1f2d759af6dd899057c5b234ea85f2067553cc0 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Wed, 26 Jun 2024 14:52:30 +0200 Subject: [PATCH] libusb: re-enable timeout setting for control urbs Fix genodelabs/genode#5259 --- repos/libports/src/lib/libusb/genode_usb_raw.cc | 3 ++- repos/os/include/usb_session/device.h | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/repos/libports/src/lib/libusb/genode_usb_raw.cc b/repos/libports/src/lib/libusb/genode_usb_raw.cc index 7b39411842..57845480dd 100644 --- a/repos/libports/src/lib/libusb/genode_usb_raw.cc +++ b/repos/libports/src/lib/libusb/genode_usb_raw.cc @@ -489,7 +489,8 @@ static int genode_submit_transfer(struct usbi_transfer * itransfer) Usb_device::Urb(addr, setup->wLength, itransfer, device()._device, setup->bRequest, setup->bmRequestType, setup->wValue, - setup->wIndex, setup->wLength); + setup->wIndex, setup->wLength, + transfer->timeout); device().handle_events(); return LIBUSB_SUCCESS; } diff --git a/repos/os/include/usb_session/device.h b/repos/os/include/usb_session/device.h index 3d4a3e68aa..6fbb5c5a52 100644 --- a/repos/os/include/usb_session/device.h +++ b/repos/os/include/usb_session/device.h @@ -460,6 +460,7 @@ class Usb::Device Type::access_t _request_type; uint16_t _value; uint16_t _index; + size_t _timeout; Packet_descriptor _create() const override { @@ -468,6 +469,7 @@ class Usb::Device p.request = _request; p.value = _value; p.index = _index; + p.timeout = _timeout; return p; } @@ -475,14 +477,15 @@ class Usb::Device Urb(Device &device, uint8_t request, Type::access_t request_type, - uint16_t value, uint16_t index, size_t size = 0) + uint16_t value, uint16_t index, size_t size = 0, + size_t timeout = 0) : Base(device._urb_handler, Type::D::get(request_type) ? Endpoint::IN : Endpoint::OUT, size), _request(request), _request_type(request_type), - _value(value), _index(index) {} + _value(value), _index(index), _timeout(timeout) {} }; private: