0
Fork 0
mirror of https://github.com/Droid-VM/DroidVM.git synced 2026-11-17 06:58:15 +00:00
DroidVM/.github/workflows
HuJK 3f4513bbde usb: pass a host USB device through to a VM, by hand or by rule
A host USB device can be handed to a running VM, by hand or by rule.

The daemon owns it. It watches /dev/bus/usb and the kernel's uevent socket --
the second because binding or unbinding a driver moves no node and nothing else
reports it -- and keeps an inventory of every device including the root hubs,
whose arrival nothing else reports either and whose absence is a bus on which
nothing can ever enumerate. Attaching takes the interfaces off their host
drivers and hands the device to crosvm; releasing gives them back, and a VMM
that died holding one has its claim taken off it and the device restored.

Rules decide it without anyone watching. Four ordered zones -- exact, port,
device, and the catch-all -- each a list tried in order, each rule naming a
target: a VM's xHCI controller, the host, or idle. A fifth zone nobody sees is
"no match means the host". Passes run on a plug, on a driver change, when a VM
reaches RUNNING, when the rules are saved, and at daemon start, and a device
somebody moved by hand is locked against them until it is unplugged.

The gate is drivers_autoprobe. With passthrough on, an arriving device binds no
driver of its own and the daemon stands in for the kernel: it probes the device
so the configuration is chosen, then its interfaces, and only for what the rules
say goes to the host. What a device is doing is read from the drivers bound to
it -- hostuse, vmuse, idle -- and stored nowhere.

The UI is three surfaces: a USB passthrough page of four folding zones with a
card per rule and a master switch over them, a management page that moves one
device now without touching the rules, and an xHCI controller peripheral in the
VM editor whose card binds rules straight to that controller.

Squashed from 39 commits on wip/usb.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RrfBDYZexyRUKdQyJ3jQ6q
History 2026-09-09 06:07:22 +08:00
..
build.yml usb: pass a host USB device through to a VM, by hand or by rule 2026-09-09 06:07:22 +08:00
checks.yml ci: three source checks, and a build that can unit-test a class that logs 2026-09-01 20:28:18 +08:00
dev-release.yml usb: pass a host USB device through to a VM, by hand or by rule 2026-09-09 06:07:22 +08:00
release.yml usb: pass a host USB device through to a VM, by hand or by rule 2026-09-09 06:07:22 +08:00