diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2013-06-12 13:01:49 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2013-06-24 08:41:07 +0200 |
commit | 71938a09d2b9fd4007515fec6c395916cb08f868 (patch) | |
tree | 94eb7456d3f842d2dd7ee3edf191249b149b0bce /hw/usb/desc.c | |
parent | 628e54857a82a3cb65ef96c12640c30d6307a064 (diff) |
usb: add serial bus property
This patch adds a serial property for all usb devices, which can be
used to set the serial number of a usb device (as listed by lsusb -v)
to a specific value. Applies to emulated devices only.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/desc.c')
-rw-r--r-- | hw/usb/desc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/usb/desc.c b/hw/usb/desc.c index fce303e9c8..bf6c522682 100644 --- a/hw/usb/desc.c +++ b/hw/usb/desc.c @@ -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); |