Commit b389dbfb587e61ccc1c68e51f84f8fe050e7203e

Authored by bellard
1 parent a594cfbf

USB help


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1604 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 108 additions and 0 deletions
qemu-doc.texi
@@ -100,6 +100,8 @@ Creative SoundBlaster 16 sound card @@ -100,6 +100,8 @@ Creative SoundBlaster 16 sound card
100 ENSONIQ AudioPCI ES1370 sound card 100 ENSONIQ AudioPCI ES1370 sound card
101 @item 101 @item
102 Adlib(OPL2) - Yamaha YM3812 compatible chip 102 Adlib(OPL2) - Yamaha YM3812 compatible chip
  103 +@item
  104 +PCI UHCI USB controller and a virtual USB hub.
103 @end itemize 105 @end itemize
104 106
105 Note that adlib is only available when QEMU was configured with 107 Note that adlib is only available when QEMU was configured with
@@ -227,6 +229,17 @@ slows down the IDE transfers). @@ -227,6 +229,17 @@ slows down the IDE transfers).
227 229
228 @end table 230 @end table
229 231
  232 +USB options:
  233 +@table @option
  234 +
  235 +@item -usb
  236 +Enable the USB driver (will be the default soon)
  237 +
  238 +@item -usbdevice devname
  239 +Add the USB device @var{devname}. See the monitor command
  240 +@code{usb_add} to have more information.
  241 +@end table
  242 +
230 Network options: 243 Network options:
231 244
232 @table @option 245 @table @option
@@ -495,6 +508,12 @@ show the block devices @@ -495,6 +508,12 @@ show the block devices
495 show the cpu registers 508 show the cpu registers
496 @item info history 509 @item info history
497 show the command line history 510 show the command line history
  511 +@item info pci
  512 +show emulated PCI device
  513 +@item info usb
  514 +show USB devices plugged on the virtual USB hub
  515 +@item info usbhost
  516 +show all USB host devices
498 @end table 517 @end table
499 518
500 @item q or quit 519 @item q or quit
@@ -606,6 +625,19 @@ intercepts at low level, such as @code{ctrl-alt-f1} in X Window. @@ -606,6 +625,19 @@ intercepts at low level, such as @code{ctrl-alt-f1} in X Window.
606 625
607 Reset the system. 626 Reset the system.
608 627
  628 +@item usb_add devname
  629 +
  630 +Plug the USB device devname to the QEMU virtual USB hub. @var{devname}
  631 +is either a virtual device name (for example @code{mouse}) or a host
  632 +USB device identifier. Host USB device identifiers have the following
  633 +syntax: @code{host:bus.addr} or @code{host:vendor_id:product_id}.
  634 +
  635 +@item usb_del devname
  636 +
  637 +Remove the USB device @var{devname} from the QEMU virtual USB
  638 +hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor
  639 +command @code{info usb} to see the devices you can remove.
  640 +
609 @end table 641 @end table
610 642
611 @subsection Integer expressions 643 @subsection Integer expressions
@@ -849,6 +881,80 @@ Lawton for the plex86 Project (@url{www.plex86.org}). @@ -849,6 +881,80 @@ Lawton for the plex86 Project (@url{www.plex86.org}).
849 881
850 @end enumerate 882 @end enumerate
851 883
  884 +@section USB emulation
  885 +
  886 +QEMU emulates a PCI UHCI USB controller and a 8 port USB hub connected
  887 +to it. You can virtually plug to the hub virtual USB devices or real
  888 +host USB devices (experimental, works only on Linux hosts).
  889 +
  890 +@subsection Using virtual USB devices
  891 +
  892 +A virtual USB mouse device is available for testing in QEMU.
  893 +
  894 +You can try it with the following monitor commands:
  895 +
  896 +@example
  897 +# add the mouse device
  898 +(qemu) usb_add mouse
  899 +
  900 +# show the virtual USB devices plugged on the QEMU Virtual USB hub
  901 +(qemu) info usb
  902 + Device 0.3, speed 12 Mb/s
  903 +
  904 +# after some time you can try to remove the mouse
  905 +(qemu) usb_del 0.3
  906 +@end example
  907 +
  908 +The option @option{-usbdevice} is similar to the monitor command
  909 +@code{usb_add}.
  910 +
  911 +@subsection Using host USB devices on a Linux host
  912 +
  913 +WARNING: this is an experimental feature. QEMU will slow down when
  914 +using it. USB devices requiring real time streaming (i.e. USB Video
  915 +Cameras) are not supported yet.
  916 +
  917 +@enumerate
  918 +@item If you use an early Linux 2.4 kernel, verify that no Linux driver
  919 +is actually using the USB device. A simple way to do that is simply to
  920 +disable the corresponding kernel module by renaming it from @file{mydriver.o}
  921 +to @file{mydriver.o.disabled}.
  922 +
  923 +@item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:
  924 +@example
  925 +ls /proc/bus/usb
  926 +001 devices drivers
  927 +@end example
  928 +
  929 +@item 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:
  930 +@example
  931 +chown -R myuid /proc/bus/usb
  932 +@end example
  933 +
  934 +@item Launch QEMU and do in the monitor:
  935 +@example
  936 +info usbhost
  937 + Device 1.2, speed 480 Mb/s
  938 + Class 00: USB device 1234:5678, USB DISK
  939 +@end example
  940 +You should see the list of the devices you can use (Never try to use
  941 +hubs, it won't work).
  942 +
  943 +@item Add the device in QEMU by using:
  944 +@example
  945 +usb_add host:1234:5678
  946 +@end example
  947 +
  948 +Normally the guest OS should report that a new USB device is
  949 +plugged. You can use the option @option{-usbdevice} to do the same.
  950 +
  951 +@item Now you can try to use the host USB device in QEMU.
  952 +
  953 +@end enumerate
  954 +
  955 +When relaunching QEMU, you may have to unplug and plug again the USB
  956 +device to make it work again (this is a bug).
  957 +
852 @node gdb_usage 958 @node gdb_usage
853 @section GDB usage 959 @section GDB usage
854 960
@@ -2966,6 +2966,8 @@ void help(void) @@ -2966,6 +2966,8 @@ void help(void)
2966 #ifdef TARGET_I386 2966 #ifdef TARGET_I386
2967 "-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n" 2967 "-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n"
2968 #endif 2968 #endif
  2969 + "-usb enable the USB driver (will be the default soon)\n"
  2970 + "-usbdevice name add the host or guest USB device 'name'\n"
2969 #if defined(TARGET_PPC) || defined(TARGET_SPARC) 2971 #if defined(TARGET_PPC) || defined(TARGET_SPARC)
2970 "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n" 2972 "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n"
2971 #endif 2973 #endif