peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0121-usb-redir-Fix-printing-of-device-version.patch

Hans de Goede 1b1995
From 6c13e7b9448b10d966bb99c00c5120678ccd2a3f Mon Sep 17 00:00:00 2001
Hans de Goede 1b1995
From: Hans de Goede <hdegoede@redhat.com>
Hans de Goede 1b1995
Date: Sat, 18 Feb 2012 09:12:14 +0100
Hans de Goede 1b1995
Subject: [PATCH 121/140] usb-redir: Fix printing of device version
Hans de Goede 1b1995
Hans de Goede 1b1995
The device version is in bcd format, which requires some special handling to
Hans de Goede 1b1995
print.
Hans de Goede 1b1995
Hans de Goede 1b1995
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede 1b1995
---
Hans de Goede 1b1995
 usb-redir.c |    6 ++++--
Hans de Goede 1b1995
 1 file changed, 4 insertions(+), 2 deletions(-)
Hans de Goede 1b1995
Hans de Goede 1b1995
diff --git a/usb-redir.c b/usb-redir.c
Hans de Goede 1b1995
index 85f40d6..9b804e9 100644
Hans de Goede 1b1995
--- a/usb-redir.c
Hans de Goede 1b1995
+++ b/usb-redir.c
Hans de Goede 1b1995
@@ -1076,8 +1076,10 @@ static void usbredir_device_connect(void *priv,
Hans de Goede 1b1995
                                     usb_redir_cap_connect_device_version)) {
Hans de Goede 1b1995
         INFO("attaching %s device %04x:%04x version %d.%d class %02x\n",
Hans de Goede 1b1995
              speed, device_connect->vendor_id, device_connect->product_id,
Hans de Goede 1b1995
-             device_connect->device_version_bcd >> 8,
Hans de Goede 1b1995
-             device_connect->device_version_bcd & 0xff,
Hans de Goede 1b1995
+             ((device_connect->device_version_bcd & 0xf000) >> 12) * 10 +
Hans de Goede 1b1995
+             ((device_connect->device_version_bcd & 0x0f00) >>  8),
Hans de Goede 1b1995
+             ((device_connect->device_version_bcd & 0x00f0) >>  4) * 10 +
Hans de Goede 1b1995
+             ((device_connect->device_version_bcd & 0x000f) >>  0),
Hans de Goede 1b1995
              device_connect->device_class);
Hans de Goede 1b1995
     } else {
Hans de Goede 1b1995
         INFO("attaching %s device %04x:%04x class %02x\n", speed,
Hans de Goede 1b1995
-- 
Hans de Goede 1b1995
1.7.9.3
Hans de Goede 1b1995