Skip to contentSkip to conversation

usb patch queue

GIT PULL In review Gerd Hoffmann 3 participants 10 messages Apr 16, 2013 – Apr 22, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

Here comes the usb patch queue. Big new feature is the libusb-based usb-host driver. There also is a usb-serial fix and a small collection of xhci bugfixes.

please pull,
Gerd

The following changes since commit 24a6e7f4d91e9ed5f8117ecb083431a23f8609a0:

virtio-balloon: fix dynamic properties. (2013-04-15 17:06:58 -0500)

are available in the git repository at:

git://git.kraxel.org/qemu usb.80

for you to fetch changes up to 2b2325ff6491224a42e1fec99b1c39fbc521c95c:

use libusb for usb-host (2013-04-16 12:04:09 +0200)

----------------------------------------------------------------
Gerd Hoffmann (6):
xhci: remove leftover debug printf
xhci: add xhci_cap_write
xhci: fix portsc writes
xhci: use slotid as device address
xhci: fix address device
use libusb for usb-host

Hans de Goede (1):
usb-serial: Remove double call to qemu_chr_add_handlers( NULL )

 configure            |   36 ++
 hw/usb/dev-serial.c  |    9 -
 hw/usb/hcd-xhci.c    |   79 +--
 hw/usb/host-libusb.c | 1449 ++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/usb/host-linux.c  |   14 +-
 trace-events         |    5 +
 6 files changed, 1551 insertions(+), 41 deletions(-)
 create mode 100644 hw/usb/host-libusb.c
#3 lore raw

PATCH 3/7 xhci: add xhci_cap_write

---
 hw/usb/hcd-xhci.c |    7 +++++++
 1 file changed, 7 insertions(+)
hw/usb/hcd-xhci.c +7 -0
index c0dbc54..7f740d9 100644
@@ -3079,8 +3079,15 @@ static void xhci_doorbell_write(void *ptr, hwaddr reg,
     }
 }
 
+static void xhci_cap_write(void *opaque, hwaddr addr, uint64_t val,
+                           unsigned width)
+{
+    /* nothing */
+}
+
 static const MemoryRegionOps xhci_cap_ops = {
     .read = xhci_cap_read,
+    .write = xhci_cap_write,
     .valid.min_access_size = 1,
     .valid.max_access_size = 4,
     .impl.min_access_size = 4,
Signature · 1 line
1.7.9.7
#1 lore raw

PATCH 1/7 usb-serial: Remove double call to qemu_chr_add_handlers( NULL )

In reply to Gerd Hoffmann

From: Hans de Goede <[email protected]>

usb-serial has a qdev chardev property, and hw/qdev-properties-system.c already contains:

static void release_chr(Object *obj, const char *name, void *opaque)

{
    DeviceState *dev = DEVICE(obj);
    Property *prop = opaque;
    CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);
    CharDriverState *chr = *ptr;

    if (chr) {
        qemu_chr_add_handlers(chr, NULL, NULL, NULL, NULL);
        qemu_chr_fe_release(chr);
    }
}

So doing the qemu_chr_add_handlers(s->cs, NULL, NULL, NULL, NULL); from the usb handle_destroy function too will lead to it being done twice.

---
 hw/usb/dev-serial.c |    9 ---------
 1 file changed, 9 deletions(-)
hw/usb/dev-serial.c +0 -9
index dd0a608..2fc8a3b 100644
@@ -410,13 +410,6 @@ static void usb_serial_handle_data(USBDevice *dev, USBPacket *p)
     }
 }
 
-static void usb_serial_handle_destroy(USBDevice *dev)
-{
-    USBSerialState *s = (USBSerialState *)dev;
-
-    qemu_chr_add_handlers(s->cs, NULL, NULL, NULL, NULL);
-}
-
 static int usb_serial_can_read(void *opaque)
 {
     USBSerialState *s = opaque;
@@ -595,7 +588,6 @@ static void usb_serial_class_initfn(ObjectClass *klass, void *data)
     uc->handle_reset   = usb_serial_handle_reset;
     uc->handle_control = usb_serial_handle_control;
     uc->handle_data    = usb_serial_handle_data;
-    uc->handle_destroy = usb_serial_handle_destroy;
     dc->vmsd = &vmstate_usb_serial;
     dc->props = serial_properties;
 }
@@ -623,7 +615,6 @@ static void usb_braille_class_initfn(ObjectClass *klass, void *data)
     uc->handle_reset   = usb_serial_handle_reset;
     uc->handle_control = usb_serial_handle_control;
     uc->handle_data    = usb_serial_handle_data;
-    uc->handle_destroy = usb_serial_handle_destroy;
     dc->vmsd = &vmstate_usb_serial;
     dc->props = braille_properties;
 }
Signature · 1 line
1.7.9.7
#4 lore raw

PATCH 4/7 xhci: fix portsc writes

In reply to Gerd Hoffmann

Check for port reset first and skip everything else then. Add sanity checks for PLS updates.
Add PLC notification when entering PLS_U0 state.

This gets host-initiated port resume going on win8.

---
 hw/usb/hcd-xhci.c |   42 +++++++++++++++++++++++++++++++++++-------
 trace-events      |    1 +
 2 files changed, 36 insertions(+), 7 deletions(-)
hw/usb/hcd-xhci.c +35 -7
index 7f740d9..bb0cf1e 100644
@@ -2592,6 +2592,7 @@ static void xhci_port_notify(XHCIPort *port, uint32_t bits)
     if ((port->portsc & bits) == bits) {
         return;
     }
+    trace_usb_xhci_port_notify(port->portnr, bits);
     port->portsc |= bits;
     if (!xhci_running(port->xhci)) {
         return;
@@ -2798,29 +2799,56 @@ static void xhci_port_write(void *ptr, hwaddr reg,
                             uint64_t val, unsigned size)
 {
     XHCIPort *port = ptr;
-    uint32_t portsc;
+    uint32_t portsc, notify;
 
     trace_usb_xhci_port_write(port->portnr, reg, val);
 
     switch (reg) {
     case 0x00: /* PORTSC */
+        /* write-1-to-start bits */
+        if (val & PORTSC_PR) {
+            xhci_port_reset(port);
+            break;
+        }
+
         portsc = port->portsc;
+        notify = 0;
         /* write-1-to-clear bits*/
         portsc &= ~(val & (PORTSC_CSC|PORTSC_PEC|PORTSC_WRC|PORTSC_OCC|
                            PORTSC_PRC|PORTSC_PLC|PORTSC_CEC));
         if (val & PORTSC_LWS) {
             /* overwrite PLS only when LWS=1 */
-            uint32_t pls = get_field(val, PORTSC_PLS);
-            set_field(&portsc, pls, PORTSC_PLS);
-            trace_usb_xhci_port_link(port->portnr, pls);
+            uint32_t old_pls = get_field(port->portsc, PORTSC_PLS);
+            uint32_t new_pls = get_field(val, PORTSC_PLS);
+            switch (new_pls) {
+            case PLS_U0:
+                if (old_pls != PLS_U0) {
+                    set_field(&portsc, new_pls, PORTSC_PLS);
+                    trace_usb_xhci_port_link(port->portnr, new_pls);
+                    notify = PORTSC_PLC;
+                }
+                break;
+            case PLS_U3:
+                if (old_pls < PLS_U3) {
+                    set_field(&portsc, new_pls, PORTSC_PLS);
+                    trace_usb_xhci_port_link(port->portnr, new_pls);
+                }
+                break;
+            case PLS_RESUME:
+                /* windows does this for some reason, don't spam stderr */
+                break;
+            default:
+                fprintf(stderr, "%s: ignore pls write (old %d, new %d)\n",
+                        __func__, old_pls, new_pls);
+                break;
+            }
         }
         /* read/write bits */
         portsc &= ~(PORTSC_PP|PORTSC_WCE|PORTSC_WDE|PORTSC_WOE);
         portsc |= (val & (PORTSC_PP|PORTSC_WCE|PORTSC_WDE|PORTSC_WOE));
         port->portsc = portsc;
-        /* write-1-to-start bits */
-        if (val & PORTSC_PR) {
-            xhci_port_reset(port);
+        if (notify) {
+            xhci_port_notify(port, notify);
         }
         break;
     case 0x04: /* PORTPMSC */
trace-events +1 -0
index 412f7e4..54b7d90 100644
@@ -362,6 +362,7 @@ usb_xhci_queue_event(uint32_t vector, uint32_t idx, const char *trb, const char
 usb_xhci_fetch_trb(uint64_t addr, const char *name, uint64_t param, uint32_t status, uint32_t control) "addr %016" PRIx64 ", %s, p %016" PRIx64 ", s %08x, c 0x%08x"
 usb_xhci_port_reset(uint32_t port) "port %d"
 usb_xhci_port_link(uint32_t port, uint32_t pls) "port %d, pls %d"
+usb_xhci_port_notify(uint32_t port, uint32_t pls) "port %d, bits %x"
 usb_xhci_slot_enable(uint32_t slotid) "slotid %d"
 usb_xhci_slot_disable(uint32_t slotid) "slotid %d"
 usb_xhci_slot_address(uint32_t slotid) "slotid %d"
Signature · 1 line
1.7.9.7
#5 lore raw

PATCH 5/7 xhci: use slotid as device address

In reply to Gerd Hoffmann

Is good enougth for unique device addresses and avoids the need for any state for device addressing. Makes live migration support easier. Also makes device->slot lookups trivial.

---
 hw/usb/hcd-xhci.c |   25 +++----------------------
 1 file changed, 3 insertions(+), 22 deletions(-)
hw/usb/hcd-xhci.c +3 -22
index bb0cf1e..e489059 100644
@@ -408,7 +408,6 @@ typedef struct XHCISlot {
     bool enabled;
     dma_addr_t ctx;
     USBPort *uport;
-    unsigned int devaddr;
     XHCIEPContext * eps[31];
 } XHCISlot;
 
@@ -452,7 +451,6 @@ struct XHCIState {
     MemoryRegion mem_oper;
     MemoryRegion mem_runtime;
     MemoryRegion mem_doorbell;
-    unsigned int devaddr;
 
     /* properties */
     uint32_t numports_2;
@@ -2141,16 +2139,14 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
         slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT;
     } else {
         USBPacket p;
-        slot->devaddr = xhci->devaddr++;
-        slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slot->devaddr;
-        DPRINTF("xhci: device address is %d\n", slot->devaddr);
+        slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid;
         usb_device_reset(dev);
         usb_packet_setup(&p, USB_TOKEN_OUT,
                          usb_ep_get(dev, USB_TOKEN_OUT, 0), 0,
                          0, false, false);
         usb_device_handle_control(dev, &p,
                                   DeviceOutRequest | USB_REQ_SET_ADDRESS,
-                                  slot->devaddr, 0, 0, NULL);
+                                  slotid, 0, 0, NULL);
         assert(p.status != USB_RET_ASYNC);
     }
 
@@ -2674,7 +2670,6 @@ static void xhci_reset(DeviceState *dev)
     xhci->dcbaap_low = 0;
     xhci->dcbaap_high = 0;
     xhci->config = 0;
-    xhci->devaddr = 2;
 
     for (i = 0; i < xhci->numslots; i++) {
         xhci_disable_slot(xhci, i+1);
@@ -3212,20 +3207,6 @@ static USBPortOps xhci_uport_ops = {
     .child_detach = xhci_child_detach,
 };
 
-static int xhci_find_slotid(XHCIState *xhci, USBDevice *dev)
-{
-    XHCISlot *slot;
-    int slotid;
-
-    for (slotid = 1; slotid <= xhci->numslots; slotid++) {
-        slot = &xhci->slots[slotid-1];
-        if (slot->devaddr == dev->addr) {
-            return slotid;
-        }
-    }
-    return 0;
-}
-
 static int xhci_find_epid(USBEndpoint *ep)
 {
     if (ep->nr == 0) {
@@ -3245,7 +3226,7 @@ static void xhci_wakeup_endpoint(USBBus *bus, USBEndpoint *ep,
     int slotid;
 
     DPRINTF("%s\n", __func__);
-    slotid = xhci_find_slotid(xhci, ep->dev);
+    slotid = ep->dev->addr;
     if (slotid == 0 || !xhci->slots[slotid-1].enabled) {
         DPRINTF("%s: oops, no slot for dev %d\n", __func__, ep->dev->addr);
         return;
Signature · 1 line
1.7.9.7
#6 lore raw

PATCH 6/7 xhci: fix address device

In reply to Gerd Hoffmann

Zero-initialize the set-address dummy USBPacket, also add buffer to avoid sanity checks triggering.

https://bugzilla.redhat.com/show_bug.cgi?id=929019

---
 hw/usb/hcd-xhci.c |    4 ++++
 1 file changed, 4 insertions(+)
hw/usb/hcd-xhci.c +4 -0
index e489059..a26b78e 100644
@@ -2139,8 +2139,12 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
         slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT;
     } else {
         USBPacket p;
+        uint8_t buf[1];
+
         slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid;
         usb_device_reset(dev);
+        memset(&p, 0, sizeof(p));
+        usb_packet_addbuf(&p, buf, sizeof(buf));
         usb_packet_setup(&p, USB_TOKEN_OUT,
                          usb_ep_get(dev, USB_TOKEN_OUT, 0), 0,
                          0, false, false);
Signature · 1 line
1.7.9.7
#2 lore raw

PATCH 2/7 xhci: remove leftover debug printf

In reply to Gerd Hoffmann
---
 hw/usb/hcd-xhci.c |    1 -
 1 file changed, 1 deletion(-)
hw/usb/hcd-xhci.c +0 -1
index efd4b0d..c0dbc54 100644
@@ -2526,7 +2526,6 @@ static void xhci_process_commands(XHCIState *xhci)
             }
             break;
         case CR_SET_TR_DEQUEUE:
-            fprintf(stderr, "%s: CR_SET_TR_DEQUEUE\n", __func__);
             slotid = xhci_get_slot(xhci, &event, &trb);
             if (slotid) {
                 unsigned int epid = (trb.control >> TRB_CR_EPID_SHIFT)
Signature · 1 line
1.7.9.7
#7 lore raw

PATCH 7/7 use libusb for usb-host

In reply to Gerd Hoffmann

Reimplement usb-host on top of libusb.
Reasons to do this:

(1) Largely rewritten from scratch, nice opportunity to kill historical cruft.
(2) Offload usbfs handling to libusb.
(3) Have a single portable code base instead of bsd + linux variants.
(4) Bring usb-host support to any platform supported by libusbx.

For now this goes side-by-side to the existing code. That is only to simplify regression testing though, at the end of the day I want remove the old code and support libusb exclusively. Merge early in 1.5 cycle, remove the old code after 1.5 release or something like this.

Thanks to qdev the old and new code can coexist nicely on linux. Just use "-device usb-host-linux" to use the old linux driver instead of the libusb one (which takes over the "usb-host" name).

The bsd driver isn't qdev'ified so it isn't that easy for bsd. I didn't bother making it runtime switchable, so you have to rebuild qemu with --disable-libusb to get back the old code.

---
 configure            |   36 ++
 hw/usb/host-libusb.c | 1449 ++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/usb/host-linux.c  |   14 +-
 trace-events         |    4 +
 4 files changed, 1501 insertions(+), 2 deletions(-)
 create mode 100644 hw/usb/host-libusb.c
configure +36 -0
index 0788e27..4c4f6f6 100755
@@ -226,6 +226,7 @@ trace_file="trace"
 spice=""
 rbd=""
 smartcard_nss=""
+libusb=""
 usb_redir=""
 glx=""
 zlib="yes"
@@ -890,6 +891,10 @@ for opt do
   ;;
   --enable-smartcard-nss) smartcard_nss="yes"
   ;;
+  --disable-libusb) libusb="no"
+  ;;
+  --enable-libusb) libusb="yes"
+  ;;
   --disable-usb-redir) usb_redir="no"
   ;;
   --enable-usb-redir) usb_redir="yes"
@@ -1175,6 +1180,8 @@ echo "  --disable-libiscsi       disable iscsi support"
 echo "  --enable-libiscsi        enable iscsi support"
 echo "  --disable-smartcard-nss  disable smartcard nss support"
 echo "  --enable-smartcard-nss   enable smartcard nss support"
+echo "  --disable-libusb         disable libusb (for usb passthrough)"
+echo "  --enable-libusb          enable libusb (for usb passthrough)"
 echo "  --disable-usb-redir      disable usb network redirection support"
 echo "  --enable-usb-redir       enable usb network redirection support"
 echo "  --disable-guest-agent    disable building of the QEMU Guest Agent"
@@ -3005,6 +3012,23 @@ EOF
     fi
 fi
 
+# check for libusb
+if test "$libusb" != "no" ; then
+    if $pkg_config libusb-1.0 >/dev/null 2>&1 ; then
+        libusb="yes"
+	usb="libusb"
+        libusb_cflags=$($pkg_config --cflags libusb-1.0 2>/dev/null)
+        libusb_libs=$($pkg_config --libs libusb-1.0 2>/dev/null)
+        QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
+        libs_softmmu="$libs_softmmu $libusb_libs"
+    else
+        if test "$libusb" = "yes"; then
+            feature_not_found "libusb"
+        fi
+        libusb="no"
+    fi
+fi
+
 # check for usbredirparser for usb network redirection support
 if test "$usb_redir" != "no" ; then
     if $pkg_config --atleast-version=0.6 libusbredirparser-0.5 >/dev/null 2>&1 ; then
@@ -3516,6 +3540,7 @@ echo "spice support     $spice ($spice_protocol_version/$spice_server_version)"
 echo "rbd support       $rbd"
 echo "xfsctl support    $xfs"
 echo "nss used          $smartcard_nss"
+echo "libusb            $libusb"
 echo "usb net redir     $usb_redir"
 echo "GLX support       $glx"
 echo "libiscsi support  $libiscsi"
@@ -3823,6 +3848,10 @@ if test "$smartcard_nss" = "yes" ; then
   echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
 fi
 
+if test "$libusb" = "yes" ; then
+  echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
+fi
+
 if test "$usb_redir" = "yes" ; then
   echo "CONFIG_USB_REDIR=y" >> $config_host_mak
 fi
@@ -3907,6 +3936,13 @@ linux)
 bsd)
   echo "HOST_USB=bsd" >> $config_host_mak
 ;;
+libusb)
+  if test "$linux" = "yes"; then
+    echo "HOST_USB=libusb linux legacy" >> $config_host_mak
+  else
+    echo "HOST_USB=libusb legacy" >> $config_host_mak
+  fi
+;;
 *)
   echo "HOST_USB=stub" >> $config_host_mak
 ;;
hw/usb/host-libusb.c new file +1449 -0

1,449 lines not on this page · raw message

hw/usb/host-linux.c +12 -2
index b67aeba..8994668 100644
@@ -45,6 +45,12 @@
 #include "hw/usb/desc.h"
 #include "hw/usb/host.h"
 
+#ifdef CONFIG_USB_LIBUSB
+# define DEVNAME "usb-host-linux"
+#else
+# define DEVNAME "usb-host"
+#endif
+
 /* We redefine it to avoid version problems */
 struct usb_ctrltransfer {
     uint8_t  bRequestType;
@@ -1487,7 +1493,7 @@ static int usb_host_initfn(USBDevice *dev)
 }
 
 static const VMStateDescription vmstate_usb_host = {
-    .name = "usb-host",
+    .name = DEVNAME,
     .version_id = 1,
     .minimum_version_id = 1,
     .post_load = usb_host_post_load,
@@ -1527,7 +1533,7 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo usb_host_dev_info = {
-    .name          = "usb-host",
+    .name          = DEVNAME,
     .parent        = TYPE_USB_DEVICE,
     .instance_size = sizeof(USBHostDevice),
     .class_init    = usb_host_class_initfn,
@@ -1767,6 +1773,8 @@ static void usb_host_auto_check(void *unused)
     qemu_mod_timer(usb_auto_timer, qemu_get_clock_ms(rt_clock) + 2000);
 }
 
+#ifndef CONFIG_USB_LIBUSB
+
 /**********************/
 /* USB host device info */
 
@@ -1898,3 +1906,5 @@ void usb_host_info(Monitor *mon, const QDict *qdict)
                        bus, addr, f->port ? f->port : "*", vid, pid);
     }
 }
+
+#endif
trace-events +4 -0
index 54b7d90..bf6bd85 100644
@@ -425,11 +425,15 @@ usb_host_open_success(int bus, int addr) "dev %d:%d"
 usb_host_open_failure(int bus, int addr) "dev %d:%d"
 usb_host_disconnect(int bus, int addr) "dev %d:%d"
 usb_host_close(int bus, int addr) "dev %d:%d"
+usb_host_attach_kernel(int bus, int addr, int interface) "dev %d:%d, if %d"
+usb_host_detach_kernel(int bus, int addr, int interface) "dev %d:%d, if %d"
 usb_host_set_address(int bus, int addr, int config) "dev %d:%d, address %d"
 usb_host_set_config(int bus, int addr, int config) "dev %d:%d, config %d"
 usb_host_set_interface(int bus, int addr, int interface, int alt) "dev %d:%d, interface %d, alt %d"
 usb_host_claim_interfaces(int bus, int addr, int config, int nif) "dev %d:%d, config %d, nif %d"
+usb_host_claim_interface(int bus, int addr, int config, int interface) "dev %d:%d, config %d, if %d"
 usb_host_release_interfaces(int bus, int addr) "dev %d:%d"
+usb_host_release_interface(int bus, int addr, int interface) "dev %d:%d, if %d"
 usb_host_req_control(int bus, int addr, void *p, int req, int value, int index) "dev %d:%d, packet %p, req 0x%x, value %d, index %d"
 usb_host_req_data(int bus, int addr, void *p, int in, int ep, int size) "dev %d:%d, packet %p, in %d, ep %d, size %d"
 usb_host_req_complete(int bus, int addr, void *p, int status, int length) "dev %d:%d, packet %p, status %d, length %d"
Signature · 1 line
1.7.9.7
#8 lore raw

Re: [Qemu-devel] [PATCH 7/7] use libusb for usb-host

Quoted 14 lines · Gerd Hoffmann

Reimplement usb-host on top of libusb.
Reasons to do this:

(1) Largely rewritten from scratch, nice opportunity to kill historical cruft.
(2) Offload usbfs handling to libusb.
(3) Have a single portable code base instead of bsd + linux variants.
(4) Bring usb-host support to any platform supported by libusbx.

For now this goes side-by-side to the existing code. That is only to simplify regression testing though, at the end of the day I want remove the old code and support libusb exclusively. Merge early in 1.5 cycle, remove the old code after 1.5 release or something like this.

Quoted 7 lines

Thanks to qdev the old and new code can coexist nicely on linux. Just use "-device usb-host-linux" to use the old linux driver instead of the libusb one (which takes over the "usb-host" name).

The bsd driver isn't qdev'ified so it isn't that easy for bsd. I didn't bother making it runtime switchable, so you have to rebuild qemu with --disable-libusb to get back the old code.

Breaks the build for me (Fedora 17's libusb1-devel-1.0.9-0.6.rc1):

CC hw/usb/host-libusb.o
/home/armbru/work/qemu/hw/usb/host-libusb.c:1254:217: error: ‘LIBUSB_LOG_LEVEL_WARNING’ undeclared here (not in a function)

#9 lore raw

Re: [Qemu-devel] [PATCH 7/7] use libusb for usb-host

Am 18.04.2013 15:07, schrieb Markus Armbruster:

Quoted 20 lines
Quoted 18 lines · Gerd Hoffmann

Reimplement usb-host on top of libusb.
Reasons to do this:

(1) Largely rewritten from scratch, nice opportunity to kill historical cruft.
(2) Offload usbfs handling to libusb.
(3) Have a single portable code base instead of bsd + linux variants.
(4) Bring usb-host support to any platform supported by libusbx.

For now this goes side-by-side to the existing code. That is only to simplify regression testing though, at the end of the day I want remove the old code and support libusb exclusively. Merge early in 1.5 cycle, remove the old code after 1.5 release or something like this.

Thanks to qdev the old and new code can coexist nicely on linux. Just use "-device usb-host-linux" to use the old linux driver instead of the libusb one (which takes over the "usb-host" name).

Quoted 8 lines
Quoted 3 lines

The bsd driver isn't qdev'ified so it isn't that easy for bsd. I didn't bother making it runtime switchable, so you have to rebuild qemu with --disable-libusb to get back the old code.

Breaks the build for me (Fedora 17's libusb1-devel-1.0.9-0.6.rc1):

CC hw/usb/host-libusb.o
/home/armbru/work/qemu/hw/usb/host-libusb.c:1254:217: error: ‘LIBUSB_LOG_LEVEL_WARNING’ undeclared here (not in a function)

Same on openSUSE 12.3 (1.0.9-5.1.1) - any fix cooking for this, Gerd?

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg