Rémi Bernon : winebus.sys: Return an event from UDEV bus wait on device removal.
Alexandre Julliard
julliard at winehq.org
Thu Sep 2 15:45:30 CDT 2021
Module: wine
Branch: master
Commit: 9f09e2a3cbadf89aec91100cb4e0a88041f17e48
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9f09e2a3cbadf89aec91100cb4e0a88041f17e48
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon Aug 30 11:22:53 2021 +0200
winebus.sys: Return an event from UDEV bus wait on device removal.
Instead of calling bus_unlink_hid_device or IoInvalidateDeviceRelations.
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 | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c
index 8d631fb928e..c954e6b2128 100644
--- a/dlls/winebus.sys/bus_udev.c
+++ b/dlls/winebus.sys/bus_udev.c
@@ -92,6 +92,7 @@ static struct udev *udev_context = NULL;
static struct udev_monitor *udev_monitor;
static int deviceloop_control[2];
static int udev_monitor_fd;
+static struct list event_queue = LIST_INIT(event_queue);
static const WCHAR hidraw_busidW[] = {'H','I','D','R','A','W',0};
static const WCHAR lnxev_busidW[] = {'L','N','X','E','V',0};
@@ -1171,16 +1172,10 @@ static void try_add_device(struct udev_device *dev)
static void try_remove_device(struct udev_device *dev)
{
- DEVICE_OBJECT *device = NULL;
-
- device = bus_find_hid_device(hidraw_busidW, dev);
+ bus_event_queue_device_removed(&event_queue, hidraw_busidW, dev);
#ifdef HAS_PROPER_INPUT_HEADER
- if (device == NULL) device = bus_find_hid_device(lnxev_busidW, dev);
+ bus_event_queue_device_removed(&event_queue, lnxev_busidW, dev);
#endif
- if (!device) return;
-
- bus_unlink_hid_device(device);
- IoInvalidateDeviceRelations(bus_pdo, BusRelations);
}
static void build_initial_deviceset(void)
@@ -1337,6 +1332,7 @@ error:
NTSTATUS udev_bus_wait(void *args)
{
+ struct bus_event *result = args;
struct pollfd pfd[2];
pfd[0].fd = udev_monitor_fd;
@@ -1348,12 +1344,14 @@ NTSTATUS udev_bus_wait(void *args)
while (1)
{
+ if (bus_event_queue_pop(&event_queue, result)) return STATUS_PENDING;
if (poll(pfd, 2, -1) <= 0) continue;
if (pfd[1].revents) break;
process_monitor_event(udev_monitor);
}
TRACE("UDEV main loop exiting\n");
+ bus_event_queue_destroy(&event_queue);
udev_monitor_unref(udev_monitor);
udev_unref(udev_context);
udev_context = NULL;
More information about the wine-cvs
mailing list