kjliew / qemu-3dfx

MESA GL/3Dfx Glide pass-through for QEMU
GNU General Public License v2.0
403 stars 55 forks source link

USB passthrough #42

Closed OSH1980 closed 2 years ago

OSH1980 commented 2 years ago

Hm. I know, QEMu is targeted for Linux, but I'm curious. Is any way to passthrough USB devices into guest system on windows 10 host? Especially joystick and pendrive.

kjliew commented 2 years ago

QEMU USB passthrough is based on libusb user-space software stack. The package is available on MSYS2/mingw-w64.

mingw64/mingw-w64-x86_64-libusb 1.0.25-2
    Library that provides generic access to USB devices (mingw-w64)

I do not have definitive answer whether this works on Windows host. Direct hardware access is more streamlined on Linux compared to Windows. My experience in the past with libusb that it only worked reliably on Linux due to lacking of generic USB driver on Windows. Things could have improved nowadays as recent Windows versions all shipped with Microsoft WinUSB (Winusb.sys) generic USB driver.

There is no handy tools as lsusb equivalent on Windows which shows the USB bus/address topology which is required by QEMU. There is WDK sample USBView which may provide the needed USB/bus/address topology but has to make a huge download to get it. It is also required for WDK to match the Windows OS build releases.

In summary, if libusb works on Windows 10/11 today, then QEMU USB passthrough should just work when one is able to obtain the correct USB bus/address topology for the target USB device. One just has to provide the library and reconfigure QEMU to recognize it. QEMU configure scripts end summary will show up as:

 Dependencies
(... abbreviation ...)
  libusb                       : YES 1.0.25
OSH1980 commented 2 years ago

Oh, thanks KJ! I have to check this. I understand, you are not sure this will work or not. :)