diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/usb-msd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/usb-msd.c b/hw/usb-msd.c index 20ab886747..9aa8888bae 100644 --- a/hw/usb-msd.c +++ b/hw/usb-msd.c @@ -482,6 +482,7 @@ static int usb_msd_initfn(USBDevice *dev) { MSDState *s = DO_UPCAST(MSDState, dev, dev); BlockDriverState *bs = s->conf.bs; + DriveInfo *dinfo; if (!bs) { error_report("usb-msd: drive property not set"); @@ -500,6 +501,11 @@ static int usb_msd_initfn(USBDevice *dev) bdrv_detach(bs, &s->dev.qdev); s->conf.bs = NULL; + dinfo = drive_get_by_blockdev(bs); + if (dinfo && dinfo->serial) { + usb_desc_set_string(dev, STR_SERIALNUMBER, dinfo->serial); + } + s->dev.speed = USB_SPEED_FULL; scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete); s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0); |