The officially official Devuan Forum!

You are not logged in.

#1 2025-11-03 02:40:24

zapper
Member
Registered: 2017-05-29
Posts: 1,180  

usb controllers and qemu

Anyone know how to pass a usb controller for say something like mupen64plus, to a virtual machine?

What options exist out of curiosity?

Mostly interested in qemu options for this though.

IE, so that the virtual machine works in qemu.


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD Gnuinos
Peace Be With us All!

Offline

#2 2025-11-03 04:05:50

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,532  

Re: usb controllers and qemu

You might use the following qemu command line arguments for usb passthrough:

-device qemu-xhci,id=usb-bus \
-device usb-host,vendorid=0x0000,productid=0x1111

with of course the right vendor and product ids replacing 0x0000 and 0x1111.

The device must be plugged in when qemu starts. If you want to support removing and reinserting, you'll need to use the first "-device ..." argument only, and then the qemu monitor command line to add the device, with different but near enough similar syntax.

Before then, the user running qemu must have path access to the /dev/bus/usb/*/* devnode for the usb device to access.

To that end you might for example add GROUP="plugdev" appropriately in /lib/udev/rules.d/50-udev-default.rules, and make the user member of the plugdev group, and then the user gains access right whenever the device is blugged in.

It's also possible to refer to the device using the bus and device id.

Offline

#3 2025-11-03 14:00:52

zapper
Member
Registered: 2017-05-29
Posts: 1,180  

Re: usb controllers and qemu

@ralph

I figured you were going to say something about usb, bus, device type commands. I was hoping there was an easier way lol.

Oh well...

I just have to figure out now I guess how to find that info. lsusb gives some of it, but not sure if all will be given.


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD Gnuinos
Peace Be With us All!

Offline

#4 2025-11-15 20:01:53

tux_99
Member
Registered: 2025-06-17
Posts: 82  

Re: usb controllers and qemu

zapper wrote:

I was hoping there was an easier way lol.

The far easier way would be to use VMware workstation for Linux which nowadays is totally free (as in beer), but you have to register an account with broadcom to download it (anyone can do it, it's not restricted to businesses, and since you don't have to show proof of the details you provide you can basically write whatever you want...).

Last edited by tux_99 (2025-11-15 20:04:57)

Offline

#5 Today 04:43:13

zapper
Member
Registered: 2017-05-29
Posts: 1,180  

Re: usb controllers and qemu

To that end you might for example add GROUP="plugdev" appropriately in /lib/udev/rules.d/50-udev-default.rules, and make the user member of the plugdev group, and then the user gains access right whenever the device is blugged in.

It's also possible to refer to the device using the bus and device id.

How can I pass the whole GROUP="plugdev"

to /lib/udev/rules.d/50-udev-default.rules

Where in that rule file would I put it and what do I put before it?

I see stuff like SUBSYSTEM ACTION KERNEL AND LABEL

But I don't know where I would put it.

Also, you are speaking of putting this into the host OS right?

Let me know ralph, as I have tried this but it isn't showing up in my vm.

Its peculiar.

EDIT: Btw, when I boot up my image, all I see is this all I see is two lsusb mentions. and neither are my usb adapter that I am using.

via lsusb in my terminal that is

Last edited by zapper (Today 04:46:35)


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD Gnuinos
Peace Be With us All!

Offline

#6 Today 05:14:11

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,532  

Re: usb controllers and qemu

Yes, you add GROUP="plugdev" with a preceding comma, to the end of line 13, to make it be:

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb", GROUP="plugdev"

With that, on your host, the USB that you plug in will be in group plugdev with rw mode.

It then requires the user that runs qemu to already be in group plugdev when logging in, which is a funny linux thing one can't avoid. I.e., after adding the user to the group, that user need to log out and in again in order to actually be in that group.

By that, the qemu guest should have and be able to access the USB key.

If however the USB key is unplugged, qemu will drop the connecting device setup, so that when the USB key is plugged in again, you need to operate the qemu console to restore the connecting device setup. This is another quirk to deal with. The best is of course to leave the USB key plugged in.

Offline

Board footer