Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How to pass through USB devices not present at startup #828

Closed
dsseng opened this issue Oct 31, 2023 · 2 comments
Closed

How to pass through USB devices not present at startup #828

dsseng opened this issue Oct 31, 2023 · 2 comments
Labels
question Further information is requested

Comments

@dsseng
Copy link

dsseng commented Oct 31, 2023

Expected behaviour

I can list USB device IDs to be passed through automatically, even if devices are not present when the VM starts.

Actual behaviour

Only devices present at launch will be available. However, if I replug those, they reconnect to the VM.

Steps to reproduce the behaviour

Add usb_devices=("2500:0021", "0bda:0169") or equivalent to the config, have none or only one of the devices plugged in when launching the VM.

Quickemu output

Quickemu 4.8 using /usr/bin/qemu-system-x86_64 v7.2.6
 - Host:     "Fedora release 38 (Thirty Eight)" running Linux 6.5 (arcturus)
 - CPU:       AMD Ryzen 5 4500U with Radeon Graphics
 - CPU VM:   1 Socket(s), 4 Core(s), 1 Thread(s), 4G RAM
 - EFI:      WARNING! /usr/share/OVMF/OVMF_CODE.fd is a symlink.
             Resolving to... /usr/share/edk2/ovmf/OVMF_CODE.fd
 - BOOT:     EFI (Linux), OVMF (/usr/share/edk2/ovmf/OVMF_CODE.fd), SecureBoot (off).
 - Disk:     tw2/disk.qcow2 (16G)
 - Display:  SDL, virtio-vga-gl, GL (on), VirGL (on)
 - Sound:    intel-hda
 - ssh:      On host:  ssh user@localhost -p 22220
 - WebDAV:   On guest: dav://localhost:9843/
 - 9P:       On guest: sudo mount -t 9p -o trans=virtio,version=9p2000.L,msize=104857600 Public-sh7dm ~/Public
 - USB:      Host pass-through requested:
             o Ettus Research LLC USRP B200-mini on bus 003 device 011 is accessible.
             ! USB device 0bda:0169 not found. Check your configuration
 - TPM:      tw2/tw2.swtpm-sock (569124)
 - Network:  Bridged (virbr0)
 - Monitor:  On host:  nc -U "tw2/tw2-monitor.socket"
             or     :  socat -,echo=0,icanon=0 unix-connect:tw2/tw2-monitor.socket
 - Serial:   On host:  nc -U "tw2/tw2-serial.socket"
             or     :  socat -,echo=0,icanon=0 unix-connect:tw2/tw2-serial.socket
 - Process:  Starting tw2.conf as tw2 (569127)
                                                                                                                                                                    

Linux Distribution & Kernel

LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 38 (Thirty Eight)
Release:        38
Codename:       ThirtyEight
Linux arcturus 6.5.0-257.vanilla.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Aug 28 05:29:59 UTC 2023 x86_64 GNU/Linux

Notes

As seen on https://github.com/quickemu-project/quickemu/blob/master/quickemu#L167 it bails out when no device is found. QEMU however is able to bind devices by their USB IDs, so this can be used.

@dsseng
Copy link
Author

dsseng commented Oct 31, 2023

Another benefit would be better support for devices like B200-mini, which re-appear on bus after firmware loading. As I currently have whole setup, including firmware, inside the VM, I have to boot it twice after the device has been plugged, because after firmware upload it reappears with same ID but on USB3 bus.

This device boots without FPGA firmware and establishes an HS link. Software uploads FPGA image which makes controller setup SuperSpeed link, which moves the device to a different bus. Quite annoying to handle. Haven't yet tried with plain QEMU.

@quickemu-project quickemu-project deleted a comment from github-actions bot Apr 16, 2024
@flexiondotorg flexiondotorg added the question Further information is requested label Apr 20, 2024
@flexiondotorg flexiondotorg changed the title Allow passing through USB devices not present at startup feat: allow passing through USB devices not present at startup Apr 20, 2024
@flexiondotorg
Copy link
Member

This is already possible.

Start your virtual machine using --display spice and this will enable clipboard sharing and advanced USB redirection. See the section in the Wiki about USB Redirection

You might also be interested in the SPICE viewer feature to automatically redirect newly connected USB devices, available via:

  • Options -> Auto redirect newly connected USB devices

@flexiondotorg flexiondotorg changed the title feat: allow passing through USB devices not present at startup How to pass through USB devices not present at startup May 12, 2024
@quickemu-project quickemu-project locked and limited conversation to collaborators May 12, 2024
@flexiondotorg flexiondotorg converted this issue into discussion #1206 May 12, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants