Rémi Bernon : winebus.sys: Do not parse bluetooth "PRODUCT=" uevent field.

Alexandre Julliard julliard at winehq.org
Tue Oct 12 16:12:48 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Oct 12 09:59:12 2021 +0200

winebus.sys: Do not parse bluetooth "PRODUCT=" uevent field.

These contain the bluetooth dongle VID / PID instead.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winebus.sys/bus_udev.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c
index 2ed9a031af6..b857ba25df8 100644
--- a/dlls/winebus.sys/bus_udev.c
+++ b/dlls/winebus.sys/bus_udev.c
@@ -1085,12 +1085,12 @@ static const struct hid_device_vtbl lnxev_device_vtbl =
 };
 #endif /* HAS_PROPER_INPUT_HEADER */
 
-static void get_device_subsystem_info(struct udev_device *dev, char const *subsystem, struct device_desc *desc)
+static void get_device_subsystem_info(struct udev_device *dev, char const *subsystem, struct device_desc *desc,
+                                      int *bus)
 {
     struct udev_device *parent = NULL;
     const char *ptr, *next, *tmp;
     char buffer[MAX_PATH];
-    DWORD bus = 0;
 
     if (!(parent = udev_device_get_parent_with_subsystem_devtype(dev, subsystem, NULL))) return;
 
@@ -1121,16 +1121,16 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy
             }
             if (!strncmp(ptr, "HID_ID=", 7))
             {
-                if (bus || desc->vid || desc->pid) continue;
-                sscanf(ptr, "HID_ID=%x:%x:%x\n", &bus, &desc->vid, &desc->pid);
+                if (*bus || desc->vid || desc->pid) continue;
+                sscanf(ptr, "HID_ID=%x:%x:%x\n", bus, &desc->vid, &desc->pid);
             }
-            if (!strncmp(ptr, "PRODUCT=", 8))
+            if (!strncmp(ptr, "PRODUCT=", 8) && *bus != BUS_BLUETOOTH)
             {
                 if (desc->version) continue;
                 if (!strcmp(subsystem, "usb"))
                     sscanf(ptr, "PRODUCT=%x/%x/%x\n", &desc->vid, &desc->pid, &desc->version);
                 else
-                    sscanf(ptr, "PRODUCT=%x/%x/%x/%x\n", &bus, &desc->vid, &desc->pid, &desc->version);
+                    sscanf(ptr, "PRODUCT=%x/%x/%x/%x\n", bus, &desc->vid, &desc->pid, &desc->version);
             }
         }
     }
@@ -1154,7 +1154,7 @@ static void udev_add_device(struct udev_device *dev)
     struct base_device *impl;
     const char *subsystem;
     const char *devnode;
-    int fd;
+    int fd, bus = 0;
 
     if (!(devnode = udev_device_get_devnode(dev)))
         return;
@@ -1176,9 +1176,9 @@ static void udev_add_device(struct udev_device *dev)
     }
 #endif
 
-    get_device_subsystem_info(dev, "hid", &desc);
-    get_device_subsystem_info(dev, "input", &desc);
-    get_device_subsystem_info(dev, "usb", &desc);
+    get_device_subsystem_info(dev, "hid", &desc, &bus);
+    get_device_subsystem_info(dev, "input", &desc, &bus);
+    get_device_subsystem_info(dev, "usb", &desc, &bus);
 
     subsystem = udev_device_get_subsystem(dev);
     if (!strcmp(subsystem, "hidraw"))




More information about the wine-cvs mailing list