]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
usb-redir: Fix printing of device version
authorHans de Goede <hdegoede@redhat.com>
Sun, 26 Feb 2012 15:14:43 +0000 (16:14 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 27 Feb 2012 12:37:36 +0000 (13:37 +0100)
The device version is in bcd format, which requires some special handling to
print.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-redir.c

index a59b347f01537cf44323b12b3155e7ed6ee723db..18204beb308536e5f4ee160f956f2e5cdc2b6952 100644 (file)
@@ -1049,8 +1049,10 @@ static void usbredir_device_connect(void *priv,
                                     usb_redir_cap_connect_device_version)) {
         INFO("attaching %s device %04x:%04x version %d.%d class %02x\n",
              speed, device_connect->vendor_id, device_connect->product_id,
-             device_connect->device_version_bcd >> 8,
-             device_connect->device_version_bcd & 0xff,
+             ((device_connect->device_version_bcd & 0xf000) >> 12) * 10 +
+             ((device_connect->device_version_bcd & 0x0f00) >>  8),
+             ((device_connect->device_version_bcd & 0x00f0) >>  4) * 10 +
+             ((device_connect->device_version_bcd & 0x000f) >>  0),
              device_connect->device_class);
     } else {
         INFO("attaching %s device %04x:%04x class %02x\n", speed,