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

Alexandre Julliard julliard at winehq.org
Wed Sep 15 16:21:32 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed Sep 15 09:04:43 2021 +0200

winebus.sys: Return an event from IOHID bus wait on input report.

Instead of calling process_hid_report.

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

---

 dlls/winebus.sys/bus.h       | 4 ----
 dlls/winebus.sys/bus_iohid.c | 9 ++++++---
 dlls/winebus.sys/main.c      | 4 ++--
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h
index 75ff218c26d..67215019dfc 100644
--- a/dlls/winebus.sys/bus.h
+++ b/dlls/winebus.sys/bus.h
@@ -29,10 +29,6 @@
 
 struct unix_device *get_unix_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
 
-/* HID Plug and Play Bus */
-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;
-
 /* General Bus Functions */
 BOOL is_xbox_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN;
 
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c
index d9de7059be3..c16c780bc76 100644
--- a/dlls/winebus.sys/bus_iohid.c
+++ b/dlls/winebus.sys/bus_iohid.c
@@ -133,8 +133,8 @@ static void handle_IOHIDDeviceIOHIDReportCallback(void *context,
         IOReturn result, void *sender, IOHIDReportType type,
         uint32_t reportID, uint8_t *report, CFIndex report_length)
 {
-    DEVICE_OBJECT *device = (DEVICE_OBJECT*)context;
-    process_hid_report(device, report, report_length);
+    struct unix_device *iface = (struct unix_device *)context;
+    bus_event_queue_input_report(&event_queue, iface, report, report_length);
 }
 
 static void iohid_device_destroy(struct unix_device *iface)
@@ -161,7 +161,7 @@ static NTSTATUS iohid_device_start(struct unix_device *iface, DEVICE_OBJECT *dev
     length = CFNumberToDWORD(num);
     private->buffer = HeapAlloc(GetProcessHeap(), 0, length);
 
-    IOHIDDeviceRegisterInputReportCallback(private->device, private->buffer, length, handle_IOHIDDeviceIOHIDReportCallback, device);
+    IOHIDDeviceRegisterInputReportCallback(private->device, private->buffer, length, handle_IOHIDDeviceIOHIDReportCallback, iface);
     return STATUS_SUCCESS;
 }
 
@@ -378,6 +378,9 @@ NTSTATUS iohid_bus_wait(void *args)
 {
     struct bus_event *result = args;
 
+    /* cleanup previously returned event */
+    bus_event_cleanup(result);
+
     do
     {
         if (bus_event_queue_pop(&event_queue, result)) return STATUS_PENDING;
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 87526fc2129..ce548980640 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -370,7 +370,7 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni
     return device;
 }
 
-DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev)
+static DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev)
 {
     struct device_extension *ext;
     DEVICE_OBJECT *ret = NULL;
@@ -477,7 +477,7 @@ static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_l
     }
 }
 
-void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length)
+static void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length)
 {
     struct device_extension *ext = (struct device_extension*)device->DeviceExtension;
     IRP *irp;




More information about the wine-cvs mailing list