summaryrefslogtreecommitdiff
path: root/hw/usb/desc.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb/desc.c')
-rw-r--r--hw/usb/desc.c6
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);