Skip to content

draft: vm-run: add usb_passthru config#36

Open
aokblast wants to merge 1 commit intofreebsd:masterfrom
aokblast:usb_passthru/add_cfg
Open

draft: vm-run: add usb_passthru config#36
aokblast wants to merge 1 commit intofreebsd:masterfrom
aokblast:usb_passthru/add_cfg

Conversation

@aokblast
Copy link
Copy Markdown

This setting is for adoption for the new single usb device passthru feature in bhyve.

Current, it works by add the following lines in your vm configuration:
xhci_passthru1="vid.pid"
xhci_passthru2="vid.pid"
xhci_passthru3="vid.pid"
Where vid is the vendor id hex value and pid is the product id hex value.

You can at most have 8 devices (plus xhci_mouse).

@aokblast
Copy link
Copy Markdown
Author

Corresponding patch: https://reviews.freebsd.org/D52166

@michael-o
Copy link
Copy Markdown
Member

Why is it limited to eight and how to identify if you have the same device twice, e.g. USB stick?

@aokblast
Copy link
Copy Markdown
Author

aokblast commented Aug 29, 2025

8 is hardcoded from the bhyve. This number is hard-coded to bhyve so that bhyve pre-alloc port resource. Of course, we can increase the number if we want. Not too much overhead on this.
For multiple same devices, It will recognize the first one appears in the usbconfig. Of course we can provide such like hub.port pair to support multiple same device. But the hotplug will be unavailable since they may have different hub.port pair when plug-in again. Also, hub.port pair would be difficult to configure since it change everytime and of course we don't want the config file change everytime.

@michael-o
Copy link
Copy Markdown
Member

Is there a way to detect whether the current system supports this at all like done in #37?

@metalefty
Copy link
Copy Markdown
Member

It’s an ad hoc method, but I think it can be detected using the following command:

ldd /usr/sbin/bhyve| grep -q libusb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants