Timeout errors when trying to passthrough a USB keyboard

From: Naina Patrascu <patrascu.naina14_at_gmail.com>
Date: Tue, 1 Jun 2021 13:28:04 +0300

We are working on the USB passthrough functionality for bhyve.
We are currently focusing on the passthrough of a USB keyboard, as we ran
into some issues with the USB stick.

The first part of the enumeration process seems to work properly, as we can
see the information about the USB keyboard inside the virtual machine
through the 'usbconfig' command:

(guest) $ usbconfig
(guest) ugen0.2: <Chicony HP Elite USB Keyboard> at usbus0, cfg=0 md=HOST
spd=LOW (1.5Mbps) pwr=ON (100mA)

However, when pressing any key, we do not see any log in the guest or in
the host. The keyboard seems to be turned off (any LED from the keyboard is
turned off during the booting of the guest).
We use libusb_detach_kernel_driver function from libusb library to detach
the device from the host [1].

Here [2] it is a snippet from /var/log/messages file from the guest virtual
machine. We noticed a timeout in the communication (lines 46, 47 in the log
file [2]):
xhci_timeout: xfer=0xfffff800052a4148
usbd_transfer_done: err=USB_ERR_TIMEOUT

Could you help us understand where these timeout errors are coming from?

Do you think it is necessary to implement first the Boot Protocol for the
USB HID [3]?
In this case, can you provide us some documentation that could help us?

Thank you!

[2] https://gist.github.com/nainapatrascu/6903e421d64190f616c7becfe6c84991
[3] https://wiki.osdev.org/USB_Human_Interface_Devices
Received on Tue Jun 01 2021 - 10:28:04 UTC

Original text of this message