summaryrefslogtreecommitdiff
path: root/hw/usb/dev-hid.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-06-12 13:01:49 +0200
committerGerd Hoffmann <kraxel@redhat.com>2013-06-24 08:41:07 +0200
commit71938a09d2b9fd4007515fec6c395916cb08f868 (patch)
tree94eb7456d3f842d2dd7ee3edf191249b149b0bce /hw/usb/dev-hid.c
parent628e54857a82a3cb65ef96c12640c30d6307a064 (diff)
downloadqemu-71938a09d2b9fd4007515fec6c395916cb08f868.tar.gz
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/dev-hid.c')
-rw-r--r--hw/usb/dev-hid.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index b48899d500..31f3cdef42 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -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);