Andrew Eikum : winebus.sys: Report device revision number for hidraw, too.

Alexandre Julliard julliard at winehq.org
Mon Aug 12 18:51:09 CDT 2019


Module: wine
Branch: master
Commit: d5fb7383d0066c2c3f6abfd738619414ad8f1786
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d5fb7383d0066c2c3f6abfd738619414ad8f1786

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Fri Aug  9 13:45:22 2019 -0500

winebus.sys: Report device revision number for hidraw, too.

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winebus.sys/bus_udev.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c
index 08ad876..d9311a9 100644
--- a/dlls/winebus.sys/bus_udev.c
+++ b/dlls/winebus.sys/bus_udev.c
@@ -1124,10 +1124,23 @@ next_line:
     return (found_id && found_serial);
 }
 
+static DWORD a_to_bcd(const char *s)
+{
+    DWORD r = 0;
+    const char *c;
+    int shift = strlen(s) - 1;
+    for (c = s; *c; ++c)
+    {
+        r |= (*c - '0') << (shift * 4);
+        --shift;
+    }
+    return r;
+}
+
 static void try_add_device(struct udev_device *dev)
 {
     DWORD vid = 0, pid = 0, version = 0;
-    struct udev_device *hiddev = NULL;
+    struct udev_device *hiddev = NULL, *walk_device;
     DEVICE_OBJECT *device = NULL;
     const char *subsystem;
     const char *devnode;
@@ -1150,6 +1163,7 @@ static void try_add_device(struct udev_device *dev)
     hiddev = udev_device_get_parent_with_subsystem_devtype(dev, "hid", NULL);
     if (hiddev)
     {
+        const char *bcdDevice = NULL;
 #ifdef HAS_PROPER_INPUT_HEADER
         const platform_vtbl *other_vtbl = NULL;
         DEVICE_OBJECT *dup = NULL;
@@ -1171,6 +1185,17 @@ static void try_add_device(struct udev_device *dev)
                           &vid, &pid, &input, &serial);
         if (serial == NULL)
             serial = strdupAtoW(base_serial);
+
+        walk_device = dev;
+        while (walk_device && !bcdDevice)
+        {
+            bcdDevice = udev_device_get_sysattr_value(walk_device, "bcdDevice");
+            walk_device = udev_device_get_parent(walk_device);
+        }
+        if (bcdDevice)
+        {
+            version = a_to_bcd(bcdDevice);
+        }
     }
 #ifdef HAS_PROPER_INPUT_HEADER
     else




More information about the wine-cvs mailing list