Previous: usb_devices, Up: pcsys_usb


3.9.2 Using host USB devices on a Linux host

WARNING: this is an experimental feature. QEMU will slow down when using it. USB devices requiring real time streaming (i.e. USB Video Cameras) are not supported yet.

  1. If you use an early Linux 2.4 kernel, verify that no Linux driver is actually using the USB device. A simple way to do that is simply to disable the corresponding kernel module by renaming it from mydriver.o to mydriver.o.disabled.
  2. Verify that /proc/bus/usb is working (most Linux distributions should enable it by default). You should see something like that:
         ls /proc/bus/usb
         001  devices  drivers
    
  3. Since only root can access to the USB devices directly, you can either launch QEMU as root or change the permissions of the USB devices you want to use. For testing, the following suffices:
         chown -R myuid /proc/bus/usb
    
  4. Launch QEMU and do in the monitor:
         info usbhost
           Device 1.2, speed 480 Mb/s
             Class 00: USB device 1234:5678, USB DISK
    

    You should see the list of the devices you can use (Never try to use hubs, it won't work).

  5. Add the device in QEMU by using:
         usb_add host:1234:5678
    

    Normally the guest OS should report that a new USB device is plugged. You can use the option -usbdevice to do the same.

  6. Now you can try to use the host USB device in QEMU.

When relaunching QEMU, you may have to unplug and plug again the USB device to make it work again (this is a bug).