Commit 89f204d2 authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'kraxel/usb.84' into staging

# By Andreas Färber (3) and others
# Via Gerd Hoffmann
* kraxel/usb.84:
  usb: fix serial number for hid devices
  usb: add serial bus property
  usb-host-libusb: set USB_DEV_FLAG_IS_HOST
  usb/host-libusb: Fix building with libusb git master code
  usb/hcd-ehci: Add Faraday FUSBH200 support
  usb/hcd-ehci: Replace PORTSC macros with variables
  usb/hcd-ehci: Add Tegra2 SysBus EHCI device
  usb/hcd-ehci: Split off instance_init from realize
  usb/hcd-ehci-sysbus: Convert to QOM realize
parents 21ca4a5b 93c8e4dc
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -622,6 +622,18 @@ static QEMUMachine pc_machine_v0_13 = {
            .driver   = "virtio-serial-pci",\
            .property = "vectors",\
            .value    = stringify(0),\
        },{\
            .driver   = "usb-mouse",\
            .property = "serial",\
            .value    = "1",\
        },{\
            .driver   = "usb-tablet",\
            .property = "serial",\
            .value    = "1",\
        },{\
            .driver   = "usb-kbd",\
            .property = "serial",\
            .value    = "1",\
        }

static QEMUMachine pc_machine_v0_12 = {
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ static int usb_qdev_exit(DeviceState *qdev);

static Property usb_props[] = {
    DEFINE_PROP_STRING("port", USBDevice, port_path),
    DEFINE_PROP_STRING("serial", USBDevice, serial),
    DEFINE_PROP_BIT("full-path", USBDevice, flags,
                    USB_DEV_FLAG_FULL_PATH, true),
    DEFINE_PROP_END_OF_LIST()
+6 −0
Original line number Diff line number Diff line
@@ -566,6 +566,12 @@ void usb_desc_create_serial(USBDevice *dev)
    char *path;
    int dst;

    if (dev->serial) {
        /* 'serial' usb bus property has priority if present */
        usb_desc_set_string(dev, index, dev->serial);
        return;
    }

    assert(index != 0 && desc->str[index] != NULL);
    dst = snprintf(serial, sizeof(serial), "%s", desc->str[index]);
    path = qdev_get_dev_path(hcd);
+3 −0
Original line number Diff line number Diff line
@@ -560,6 +560,9 @@ static int usb_hid_initfn(USBDevice *dev, int kind)
{
    USBHIDState *us = DO_UPCAST(USBHIDState, dev, dev);

    if (dev->serial) {
        usb_desc_set_string(dev, STR_SERIALNUMBER, dev->serial);
    }
    usb_desc_init(dev);
    us->intr = usb_ep_get(dev, USB_TOKEN_IN, 1);
    hid_init(&us->hid, kind, usb_hid_changed);
+3 −10
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@ typedef struct {
    USBPacket *packet;
    /* usb-storage only */
    BlockConf conf;
    char *serial;
    uint32_t removable;
} MSDState;

@@ -602,7 +601,7 @@ static int usb_msd_initfn_storage(USBDevice *dev)
        return -1;
    }

    blkconf_serial(&s->conf, &s->serial);
    blkconf_serial(&s->conf, &dev->serial);

    /*
     * Hack alert: this pretends to be a block device, but it's really
@@ -616,16 +615,11 @@ static int usb_msd_initfn_storage(USBDevice *dev)
    bdrv_detach_dev(bs, &s->dev.qdev);
    s->conf.bs = NULL;

    if (s->serial) {
        usb_desc_set_string(dev, STR_SERIALNUMBER, s->serial);
    } else {
    usb_desc_create_serial(dev);
    }

    usb_desc_init(dev);
    scsi_bus_new(&s->bus, &s->dev.qdev, &usb_msd_scsi_info_storage, NULL);
    scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, !!s->removable,
                                            s->conf.bootindex, s->serial);
                                            s->conf.bootindex, dev->serial);
    if (!scsi_dev) {
        return -1;
    }
@@ -734,7 +728,6 @@ static const VMStateDescription vmstate_usb_msd = {

static Property msd_properties[] = {
    DEFINE_BLOCK_PROPERTIES(MSDState, conf),
    DEFINE_PROP_STRING("serial", MSDState, serial),
    DEFINE_PROP_BIT("removable", MSDState, removable, 0, false),
    DEFINE_PROP_END_OF_LIST(),
};
Loading