Rémi Bernon : winebus.sys: Return an event from IOHID bus wait on device creation.

Alexandre Julliard julliard at winehq.org
Wed Sep 8 15:12:39 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Sep  6 09:17:33 2021 +0200

winebus.sys: Return an event from IOHID bus wait on device creation.

Instead of calling bus_create_hid_device.

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

---

 dlls/winebus.sys/bus.h       |  2 --
 dlls/winebus.sys/bus_iohid.c | 12 +++---------
 dlls/winebus.sys/main.c      |  4 ++--
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h
index 15238538328..75ff218c26d 100644
--- a/dlls/winebus.sys/bus.h
+++ b/dlls/winebus.sys/bus.h
@@ -30,7 +30,6 @@
 struct unix_device *get_unix_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
 
 /* HID Plug and Play Bus */
-DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct unix_device *unix_device) DECLSPEC_HIDDEN;
 DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev) DECLSPEC_HIDDEN;
 void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLSPEC_HIDDEN;
 
@@ -38,4 +37,3 @@ void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLS
 BOOL is_xbox_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN;
 
 extern HANDLE driver_key DECLSPEC_HIDDEN;
-extern DEVICE_OBJECT *bus_pdo DECLSPEC_HIDDEN;
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c
index 9a2a6f1ec8b..3df60a1b516 100644
--- a/dlls/winebus.sys/bus_iohid.c
+++ b/dlls/winebus.sys/bus_iohid.c
@@ -297,7 +297,6 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
         .serial = {'0','0','0','0',0},
     };
     struct platform_private *private;
-    DEVICE_OBJECT *device;
     CFStringRef str = NULL;
 
     desc.vid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDVendorIDKey)));
@@ -364,15 +363,10 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
     if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private))))
         return;
     private->unix_device.vtbl = &iohid_device_vtbl;
+    private->device = IOHIDDevice;
+    private->buffer = NULL;
 
-    device = bus_create_hid_device(&desc, &private->unix_device);
-    if (!device) HeapFree(GetProcessHeap(), 0, private);
-    else
-    {
-        private->device = IOHIDDevice;
-        private->buffer = NULL;
-        IoInvalidateDeviceRelations(bus_pdo, BusRelations);
-    }
+    bus_event_queue_device_created(&event_queue, &private->unix_device, &desc);
 }
 
 static void handle_RemovalCallback(void *context, IOReturn result, void *sender, IOHIDDeviceRef IOHIDDevice)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 8a565bc3c46..42614b09f3a 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -98,7 +98,7 @@ static DEVICE_OBJECT *mouse_obj;
 static DEVICE_OBJECT *keyboard_obj;
 
 /* The root-enumerated device stack. */
-DEVICE_OBJECT *bus_pdo;
+static DEVICE_OBJECT *bus_pdo;
 static DEVICE_OBJECT *bus_fdo;
 
 HANDLE driver_key;
@@ -341,7 +341,7 @@ static void remove_pending_irps(DEVICE_OBJECT *device)
     }
 }
 
-DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct unix_device *unix_device)
+static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct unix_device *unix_device)
 {
     static const WCHAR device_name_fmtW[] = {'\\','D','e','v','i','c','e','\\','%','s','#','%','p',0};
     struct device_extension *ext;




More information about the wine-cvs mailing list