pc/usb: fix ret value of handle_altsetting_request

The logic got accidentally reversed during the transition from the
legacy USB driver.

Since the function drops error details, this patch adds a diagnostic
message with the error code as returned by the Linux driver.
This commit is contained in:
Norman Feske 2022-03-08 12:30:07 +01:00
parent 0325be0827
commit 4056fb9127

View File

@ -220,8 +220,13 @@ static genode_usb_request_ret_t
handle_altsetting_request(unsigned iface, unsigned alt_setting, void * data)
{
struct usb_device * udev = (struct usb_device *) data;
return (usb_set_interface(udev, iface, alt_setting)) ? NO_ERROR
: UNKNOWN_ERROR;
int const ret = usb_set_interface(udev, iface, alt_setting);
if (ret < 0)
printk("Alt setting request (iface=%u alt_setting=%u) failed with %d\n",
iface, alt_setting, ret);
return (ret == 0) ? NO_ERROR : UNKNOWN_ERROR;
}