-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for USB hot plugging #686
Conversation
This is great. Tested this briefly and worked fine. Let me know what your test results with the other usb devices are! Generally (maybe not as part of this PR) we could use a static configuration file as general policy based on device type and VM, and later add-on user defined passthrough for switcheroo between VMs. |
Thanks. I added touchscreens to the list as well.
Sure. I tried to keep this app simple but in future versions we will need to improve the configuration to implement more complicated rules, add exclusions, support for the cloud hypervisor and so on. I’ve tested this with input devices, audio headsets, removable disks, and ethernet adapters. It seems to work fine but I left network devices disabled by default because attaching them to the net-vm breaks remote nixos-rebuild with target-host. Also hot-plugging of disk devices is disabled until we have a storage vm or something like that. Do you know if there are any other device types that we need to support? |
Perhaps the yubikey and gps devices, so we can get rid of the static external device definition? |
Sure, I'll look into it. |
Recent updates:
|
Signed-off-by: Yuri Nesterov <yuriy.nesterov@unikie.com>
Updated to make hot-plugged devices survive suspend and resume. |
Tested on Lenovo-X1 (lenovo-x1-carbon-gen11-debug on USB SSD) No issues found!
|
Description of changes
This adds a service that runs on the host and listens for device add and remove events using libudev. When a new USB device is attached, it is automatically assigned to the designated virtual machine using the official qemu.qmp library."
Checklist for things done
x86_64
aarch64
riscv64
nix flake check --accept-flake-config
and it passesTesting
Input Devices:
Audio Devices:
aplay -l
and find the headset in the list. It should be listed as either card 0 or card 1.speaker-test -D hw:1,0 -c 2 -t sine
. If the headset appears as card 0, change hw:1,0 to hw:0,0.If a bug is found or if something is not working as expected, please collect the vhotplug service logs from journalctl on the host.