usb: bugfixes, doc update
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJZFaiNAAoJEEy22O7T6HE4CxUP/3EdVQfz9z/wipB1Jkd4BI4h joWw5mY2EVx8oTtVfmCbPogBzKkcBXYhnYciJWoDmdMB3DsPsOnWLu407M8P9Nq9 dVCey7Qhv3acC8ZP3L/GlUs+RQ/lNEq+TPvnM4/1IhatKOf13XYxTMamzMCdg4XM wroH240EER2b7qMN9im1G0ETAzfHfdMPpVF2taPa3kxCNHKwcJQGMVoPnGIO0Cxp mXuNqNkVkd1+UYurJ1PI8/mr/nkUcaLamfmf4H3hZL/mvls+YBK4CH+QVQVF/X6L YGRlDM3QNCuNX4SJIYwvYI4pEAM6S4+RHKdkoKNRP3svFryBlJCuMDPyTYQVMrYT jACZWxto7LC9uOzlNZoCs9zIpbqSVIcyFT3o5lNKRvIWg6dR2M6ehCRXZox5w1Jd 8GEmdPN4y1yrKKKhEHzUfQQQngXQQ+9iHJSE+oGvtVOUenYTzzIbT4s0wWvBs7gL d4mEcAvlaUe1wpPm4SwoHtr2XqSC9LV6o/czLh5iRnSkzPirt96owTCLZMbi5C53 k3mmtpSKk9BnuWOWkKvKAToLjhO847D6NXvCn5XeUddxr0aGSAXjzuqj+Nd1ZYSC UwhXXPCoLnZ8c4rw8BRY+PpZd1NR0BlmuqRTIrb5hXNBM7o9rN+KLkZgqtDK2qaD wLQvGszzgbWaTTE7p0mZ =grov -----END PGP SIGNATURE----- Merge remote-tracking branch 'kraxel/tags/pull-usb-20170512-1' into staging usb: bugfixes, doc update # gpg: Signature made Fri 12 May 2017 01:20:29 PM BST # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * kraxel/tags/pull-usb-20170512-1: hw/usb/dev-serial: Do not try to set vendorid or productid properties xhci: relax link check usb-hub: clear PORT_STAT_SUSPEND on wakeup xhci: fix logging usb-redir: fix stack overflow in usbredir_log_data qemu-doc: Update to use the new way of attaching USB devices Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
commit
8a813c9868
@ -182,15 +182,13 @@ The appropriate DEVNAME depends on the machine type. For type "pc":
|
|||||||
|
|
||||||
This lets you control I/O ports and IRQs.
|
This lets you control I/O ports and IRQs.
|
||||||
|
|
||||||
* -usbdevice serial:vendorid=VID,productid=PRID becomes
|
* -usbdevice serial::chardev becomes -device usb-serial,chardev=dev.
|
||||||
-device usb-serial,vendorid=VID,productid=PRID
|
|
||||||
|
|
||||||
* -usbdevice braille doesn't support LEGACY-CHARDEV syntax. It always
|
* -usbdevice braille doesn't support LEGACY-CHARDEV syntax. It always
|
||||||
uses "braille". With -device, this useful default is gone, so you
|
uses "braille". With -device, this useful default is gone, so you
|
||||||
have to use something like
|
have to use something like
|
||||||
|
|
||||||
-device usb-braille,chardev=braille,vendorid=VID,productid=PRID
|
-device usb-braille,chardev=braille -chardev braille,id=braille
|
||||||
-chardev braille,id=braille
|
|
||||||
|
|
||||||
* -virtioconsole becomes
|
* -virtioconsole becomes
|
||||||
-device virtio-serial-pci,class=C,vectors=V,ioeventfd=IOEVENTFD,max_ports=N
|
-device virtio-serial-pci,class=C,vectors=V,ioeventfd=IOEVENTFD,max_ports=N
|
||||||
|
@ -208,6 +208,7 @@ static void usb_hub_wakeup(USBPort *port1)
|
|||||||
USBHubPort *port = &s->ports[port1->index];
|
USBHubPort *port = &s->ports[port1->index];
|
||||||
|
|
||||||
if (port->wPortStatus & PORT_STAT_SUSPEND) {
|
if (port->wPortStatus & PORT_STAT_SUSPEND) {
|
||||||
|
port->wPortStatus &= ~PORT_STAT_SUSPEND;
|
||||||
port->wPortChange |= PORT_STAT_C_SUSPEND;
|
port->wPortChange |= PORT_STAT_C_SUSPEND;
|
||||||
usb_wakeup(s->intr, 0);
|
usb_wakeup(s->intr, 0);
|
||||||
}
|
}
|
||||||
|
@ -513,27 +513,18 @@ static USBDevice *usb_serial_init(USBBus *bus, const char *filename)
|
|||||||
{
|
{
|
||||||
USBDevice *dev;
|
USBDevice *dev;
|
||||||
Chardev *cdrv;
|
Chardev *cdrv;
|
||||||
uint32_t vendorid = 0, productid = 0;
|
|
||||||
char label[32];
|
char label[32];
|
||||||
static int index;
|
static int index;
|
||||||
|
|
||||||
while (*filename && *filename != ':') {
|
while (*filename && *filename != ':') {
|
||||||
const char *p;
|
const char *p;
|
||||||
char *e;
|
|
||||||
if (strstart(filename, "vendorid=", &p)) {
|
if (strstart(filename, "vendorid=", &p)) {
|
||||||
vendorid = strtol(p, &e, 16);
|
error_report("vendorid is not supported anymore");
|
||||||
if (e == p || (*e && *e != ',' && *e != ':')) {
|
return NULL;
|
||||||
error_report("bogus vendor ID %s", p);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
filename = e;
|
|
||||||
} else if (strstart(filename, "productid=", &p)) {
|
} else if (strstart(filename, "productid=", &p)) {
|
||||||
productid = strtol(p, &e, 16);
|
error_report("productid is not supported anymore");
|
||||||
if (e == p || (*e && *e != ',' && *e != ':')) {
|
return NULL;
|
||||||
error_report("bogus product ID %s", p);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
filename = e;
|
|
||||||
} else {
|
} else {
|
||||||
error_report("unrecognized serial USB option %s", filename);
|
error_report("unrecognized serial USB option %s", filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -554,10 +545,7 @@ static USBDevice *usb_serial_init(USBBus *bus, const char *filename)
|
|||||||
|
|
||||||
dev = usb_create(bus, "usb-serial");
|
dev = usb_create(bus, "usb-serial");
|
||||||
qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
|
qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
|
||||||
if (vendorid)
|
|
||||||
qdev_prop_set_uint16(&dev->qdev, "vendorid", vendorid);
|
|
||||||
if (productid)
|
|
||||||
qdev_prop_set_uint16(&dev->qdev, "productid", productid);
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
/* Very pessimistic, let's hope it's enough for all cases */
|
/* Very pessimistic, let's hope it's enough for all cases */
|
||||||
#define EV_QUEUE (((3 * 24) + 16) * MAXSLOTS)
|
#define EV_QUEUE (((3 * 24) + 16) * MAXSLOTS)
|
||||||
|
|
||||||
#define TRB_LINK_LIMIT 4
|
#define TRB_LINK_LIMIT 32
|
||||||
#define COMMAND_LIMIT 256
|
#define COMMAND_LIMIT 256
|
||||||
#define TRANSFER_LIMIT 256
|
#define TRANSFER_LIMIT 256
|
||||||
|
|
||||||
@ -1790,9 +1790,6 @@ static void xhci_stall_ep(XHCITransfer *xfer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer,
|
|
||||||
XHCIEPContext *epctx);
|
|
||||||
|
|
||||||
static int xhci_setup_packet(XHCITransfer *xfer)
|
static int xhci_setup_packet(XHCITransfer *xfer)
|
||||||
{
|
{
|
||||||
USBEndpoint *ep;
|
USBEndpoint *ep;
|
||||||
@ -1806,7 +1803,7 @@ static int xhci_setup_packet(XHCITransfer *xfer)
|
|||||||
ep = xhci_epid_to_usbep(xfer->epctx);
|
ep = xhci_epid_to_usbep(xfer->epctx);
|
||||||
if (!ep) {
|
if (!ep) {
|
||||||
DPRINTF("xhci: slot %d has no device\n",
|
DPRINTF("xhci: slot %d has no device\n",
|
||||||
xfer->slotid);
|
xfer->epctx->slotid);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1980,7 +1977,7 @@ static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx
|
|||||||
{
|
{
|
||||||
uint64_t mfindex;
|
uint64_t mfindex;
|
||||||
|
|
||||||
DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->slotid, xfer->epid);
|
DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", epctx->slotid, epctx->epid);
|
||||||
|
|
||||||
xfer->in_xfer = epctx->type>>2;
|
xfer->in_xfer = epctx->type>>2;
|
||||||
|
|
||||||
|
@ -229,21 +229,10 @@ static void usbredir_log(void *priv, int level, const char *msg)
|
|||||||
static void usbredir_log_data(USBRedirDevice *dev, const char *desc,
|
static void usbredir_log_data(USBRedirDevice *dev, const char *desc,
|
||||||
const uint8_t *data, int len)
|
const uint8_t *data, int len)
|
||||||
{
|
{
|
||||||
int i, j, n;
|
|
||||||
|
|
||||||
if (dev->debug < usbredirparser_debug_data) {
|
if (dev->debug < usbredirparser_debug_data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
qemu_hexdump((char *)data, stderr, desc, len);
|
||||||
for (i = 0; i < len; i += j) {
|
|
||||||
char buf[128];
|
|
||||||
|
|
||||||
n = sprintf(buf, "%s", desc);
|
|
||||||
for (j = 0; j < 8 && i + j < len; j++) {
|
|
||||||
n += sprintf(buf + n, " %02X", data[i + j]);
|
|
||||||
}
|
|
||||||
error_report("%s", buf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -182,7 +182,7 @@ Gravis Ultrasound GF1 sound card
|
|||||||
@item
|
@item
|
||||||
CS4231A compatible sound card
|
CS4231A compatible sound card
|
||||||
@item
|
@item
|
||||||
PCI UHCI USB controller and a virtual USB hub.
|
PCI UHCI, OHCI, EHCI or XHCI USB controller and a virtual USB-1.1 hub.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
SMP is supported with up to 255 CPUs.
|
SMP is supported with up to 255 CPUs.
|
||||||
@ -1357,10 +1357,10 @@ monitor (@pxref{pcsys_keys}).
|
|||||||
@node pcsys_usb
|
@node pcsys_usb
|
||||||
@section USB emulation
|
@section USB emulation
|
||||||
|
|
||||||
QEMU emulates a PCI UHCI USB controller. You can virtually plug
|
QEMU can emulate a PCI UHCI, OHCI, EHCI or XHCI USB controller. You can
|
||||||
virtual USB devices or real host USB devices (experimental, works only
|
plug virtual USB devices or real host USB devices (only works with certain
|
||||||
on Linux hosts). QEMU will automatically create and connect virtual USB hubs
|
host operating systems). QEMU will automatically create and connect virtual
|
||||||
as necessary to connect multiple USB devices.
|
USB hubs as necessary to connect multiple USB devices.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* usb_devices::
|
* usb_devices::
|
||||||
@ -1369,53 +1369,64 @@ as necessary to connect multiple USB devices.
|
|||||||
@node usb_devices
|
@node usb_devices
|
||||||
@subsection Connecting USB devices
|
@subsection Connecting USB devices
|
||||||
|
|
||||||
USB devices can be connected with the @option{-usbdevice} commandline option
|
USB devices can be connected with the @option{-device usb-...} command line
|
||||||
or the @code{usb_add} monitor command. Available devices are:
|
option or the @code{device_add} monitor command. Available devices are:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item mouse
|
@item usb-mouse
|
||||||
Virtual Mouse. This will override the PS/2 mouse emulation when activated.
|
Virtual Mouse. This will override the PS/2 mouse emulation when activated.
|
||||||
@item tablet
|
@item usb-tablet
|
||||||
Pointer device that uses absolute coordinates (like a touchscreen).
|
Pointer device that uses absolute coordinates (like a touchscreen).
|
||||||
This means QEMU is able to report the mouse position without having
|
This means QEMU is able to report the mouse position without having
|
||||||
to grab the mouse. Also overrides the PS/2 mouse emulation when activated.
|
to grab the mouse. Also overrides the PS/2 mouse emulation when activated.
|
||||||
@item disk:@var{file}
|
@item usb-storage,drive=@var{drive_id}
|
||||||
Mass storage device based on @var{file} (@pxref{disk_images})
|
Mass storage device backed by @var{drive_id} (@pxref{disk_images})
|
||||||
@item host:@var{bus.addr}
|
@item usb-uas
|
||||||
Pass through the host device identified by @var{bus.addr}
|
USB attached SCSI device, see
|
||||||
(Linux only)
|
@url{http://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/usb-storage.txt,usb-storage.txt}
|
||||||
@item host:@var{vendor_id:product_id}
|
for details
|
||||||
Pass through the host device identified by @var{vendor_id:product_id}
|
@item usb-bot
|
||||||
(Linux only)
|
Bulk-only transport storage device, see
|
||||||
@item wacom-tablet
|
@url{http://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/usb-storage.txt,usb-storage.txt}
|
||||||
|
for details here, too
|
||||||
|
@item usb-mtp,x-root=@var{dir}
|
||||||
|
Media transfer protocol device, using @var{dir} as root of the file tree
|
||||||
|
that is presented to the guest.
|
||||||
|
@item usb-host,hostbus=@var{bus},hostaddr=@var{addr}
|
||||||
|
Pass through the host device identified by @var{bus} and @var{addr}
|
||||||
|
@item usb-host,vendorid=@var{vendor},productid=@var{product}
|
||||||
|
Pass through the host device identified by @var{vendor} and @var{product} ID
|
||||||
|
@item usb-wacom-tablet
|
||||||
Virtual Wacom PenPartner tablet. This device is similar to the @code{tablet}
|
Virtual Wacom PenPartner tablet. This device is similar to the @code{tablet}
|
||||||
above but it can be used with the tslib library because in addition to touch
|
above but it can be used with the tslib library because in addition to touch
|
||||||
coordinates it reports touch pressure.
|
coordinates it reports touch pressure.
|
||||||
@item keyboard
|
@item usb-kbd
|
||||||
Standard USB keyboard. Will override the PS/2 keyboard (if present).
|
Standard USB keyboard. Will override the PS/2 keyboard (if present).
|
||||||
@item serial:[vendorid=@var{vendor_id}][,product_id=@var{product_id}]:@var{dev}
|
@item usb-serial,chardev=@var{id}
|
||||||
Serial converter. This emulates an FTDI FT232BM chip connected to host character
|
Serial converter. This emulates an FTDI FT232BM chip connected to host character
|
||||||
device @var{dev}. The available character devices are the same as for the
|
device @var{id}.
|
||||||
@code{-serial} option. The @code{vendorid} and @code{productid} options can be
|
@item usb-braille,chardev=@var{id}
|
||||||
used to override the default 0403:6001. For instance,
|
|
||||||
@example
|
|
||||||
usb_add serial:productid=FA00:tcp:192.168.0.2:4444
|
|
||||||
@end example
|
|
||||||
will connect to tcp port 4444 of ip 192.168.0.2, and plug that to the virtual
|
|
||||||
serial converter, faking a Matrix Orbital LCD Display (USB ID 0403:FA00).
|
|
||||||
@item braille
|
|
||||||
Braille device. This will use BrlAPI to display the braille output on a real
|
Braille device. This will use BrlAPI to display the braille output on a real
|
||||||
or fake device.
|
or fake device referenced by @var{id}.
|
||||||
@item net:@var{options}
|
@item usb-net[,netdev=@var{id}]
|
||||||
Network adapter that supports CDC ethernet and RNDIS protocols. @var{options}
|
Network adapter that supports CDC ethernet and RNDIS protocols. @var{id}
|
||||||
specifies NIC options as with @code{-net nic,}@var{options} (see description).
|
specifies a netdev defined with @code{-netdev @dots{},id=@var{id}}.
|
||||||
For instance, user-mode networking can be used with
|
For instance, user-mode networking can be used with
|
||||||
@example
|
@example
|
||||||
qemu-system-i386 [...OPTIONS...] -net user,vlan=0 -usbdevice net:vlan=0
|
qemu-system-i386 [...] -netdev user,id=net0 -device usb-net,netdev=net0
|
||||||
@end example
|
@end example
|
||||||
Currently this cannot be used in machines that support PCI NICs.
|
@item usb-ccid
|
||||||
@item bt[:@var{hci-type}]
|
Smartcard reader device
|
||||||
Bluetooth dongle whose type is specified in the same format as with
|
@item usb-audio
|
||||||
|
USB audio device
|
||||||
|
@item usb-bt-dongle
|
||||||
|
Bluetooth dongle for the transport layer of HCI. It is connected to HCI
|
||||||
|
scatternet 0 by default (corresponds to @code{-bt hci,vlan=0}).
|
||||||
|
Note that the syntax for the @code{-device usb-bt-dongle} option is not as
|
||||||
|
useful yet as it was with the legacy @code{-usbdevice} option. So to
|
||||||
|
configure an USB bluetooth device, you might need to use
|
||||||
|
"@code{-usbdevice bt}[:@var{hci-type}]" instead. This configures a
|
||||||
|
bluetooth dongle whose type is specified in the same format as with
|
||||||
the @option{-bt hci} option, @pxref{bt-hcis,,allowed HCI types}. If
|
the @option{-bt hci} option, @pxref{bt-hcis,,allowed HCI types}. If
|
||||||
no type is given, the HCI logic corresponds to @code{-bt hci,vlan=0}.
|
no type is given, the HCI logic corresponds to @code{-bt hci,vlan=0}.
|
||||||
This USB device implements the USB Transport Layer of HCI. Example
|
This USB device implements the USB Transport Layer of HCI. Example
|
||||||
@ -1460,11 +1471,11 @@ hubs, it won't work).
|
|||||||
|
|
||||||
@item Add the device in QEMU by using:
|
@item Add the device in QEMU by using:
|
||||||
@example
|
@example
|
||||||
usb_add host:1234:5678
|
device_add usb-host,vendorid=0x1234,productid=0x5678
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
Normally the guest OS should report that a new USB device is
|
Normally the guest OS should report that a new USB device is plugged.
|
||||||
plugged. You can use the option @option{-usbdevice} to do the same.
|
You can use the option @option{-device usb-host,...} to do the same.
|
||||||
|
|
||||||
@item Now you can try to use the host USB device in QEMU.
|
@item Now you can try to use the host USB device in QEMU.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user