Commit 9f09e2a3 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winebus.sys: Return an event from UDEV bus wait on device removal.

Instead of calling bus_unlink_hid_device or IoInvalidateDeviceRelations. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 6006758c
...@@ -92,6 +92,7 @@ static struct udev *udev_context = NULL; ...@@ -92,6 +92,7 @@ static struct udev *udev_context = NULL;
static struct udev_monitor *udev_monitor; static struct udev_monitor *udev_monitor;
static int deviceloop_control[2]; static int deviceloop_control[2];
static int udev_monitor_fd; 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 hidraw_busidW[] = {'H','I','D','R','A','W',0};
static const WCHAR lnxev_busidW[] = {'L','N','X','E','V',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) ...@@ -1171,16 +1172,10 @@ static void try_add_device(struct udev_device *dev)
static void try_remove_device(struct udev_device *dev) static void try_remove_device(struct udev_device *dev)
{ {
DEVICE_OBJECT *device = NULL; bus_event_queue_device_removed(&event_queue, hidraw_busidW, dev);
device = bus_find_hid_device(hidraw_busidW, dev);
#ifdef HAS_PROPER_INPUT_HEADER #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 #endif
if (!device) return;
bus_unlink_hid_device(device);
IoInvalidateDeviceRelations(bus_pdo, BusRelations);
} }
static void build_initial_deviceset(void) static void build_initial_deviceset(void)
...@@ -1337,6 +1332,7 @@ error: ...@@ -1337,6 +1332,7 @@ error:
NTSTATUS udev_bus_wait(void *args) NTSTATUS udev_bus_wait(void *args)
{ {
struct bus_event *result = args;
struct pollfd pfd[2]; struct pollfd pfd[2];
pfd[0].fd = udev_monitor_fd; pfd[0].fd = udev_monitor_fd;
...@@ -1348,12 +1344,14 @@ NTSTATUS udev_bus_wait(void *args) ...@@ -1348,12 +1344,14 @@ NTSTATUS udev_bus_wait(void *args)
while (1) while (1)
{ {
if (bus_event_queue_pop(&event_queue, result)) return STATUS_PENDING;
if (poll(pfd, 2, -1) <= 0) continue; if (poll(pfd, 2, -1) <= 0) continue;
if (pfd[1].revents) break; if (pfd[1].revents) break;
process_monitor_event(udev_monitor); process_monitor_event(udev_monitor);
} }
TRACE("UDEV main loop exiting\n"); TRACE("UDEV main loop exiting\n");
bus_event_queue_destroy(&event_queue);
udev_monitor_unref(udev_monitor); udev_monitor_unref(udev_monitor);
udev_unref(udev_context); udev_unref(udev_context);
udev_context = NULL; udev_context = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment