Commit 3b132cb9 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

winebus.sys: Implement removing IOHID devices.

parent 8284be37
......@@ -130,6 +130,11 @@ static DWORD CFNumberToDWORD(CFNumberRef num)
static int compare_platform_device(DEVICE_OBJECT *device, void *platform_dev)
{
struct platform_private *private = impl_from_DEVICE_OBJECT(device);
IOHIDDeviceRef dev2 = (IOHIDDeviceRef)platform_dev;
if (private->device != dev2)
return 1;
else
return 0;
}
......@@ -207,6 +212,18 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
}
}
static void handle_RemovalCallback(void *context, IOReturn result, void *sender, IOHIDDeviceRef IOHIDDevice)
{
DEVICE_OBJECT *device;
TRACE("OS/X IOHID Device Removed %p\n", IOHIDDevice);
device = bus_find_hid_device(&iohid_vtbl, IOHIDDevice);
if (device)
{
IoInvalidateDeviceRelations(device, RemovalRelations);
bus_remove_hid_device(device);
}
}
/* This puts the relevant run loop for event handling into a WINE thread */
static DWORD CALLBACK runloop_thread(void *args)
{
......@@ -214,6 +231,7 @@ static DWORD CALLBACK runloop_thread(void *args)
IOHIDManagerSetDeviceMatching(hid_manager, NULL);
IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, handle_DeviceMatchingCallback, NULL);
IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, handle_RemovalCallback, NULL);
IOHIDManagerScheduleWithRunLoop(hid_manager, run_loop, kCFRunLoopDefaultMode);
if (IOHIDManagerOpen( hid_manager, 0 ) != kIOReturnSuccess)
{
......@@ -227,6 +245,7 @@ static DWORD CALLBACK runloop_thread(void *args)
TRACE("Run Loop exiting\n");
IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, NULL, NULL);
IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, NULL, NULL);
IOHIDManagerUnscheduleFromRunLoop(hid_manager, run_loop, kCFRunLoopDefaultMode);
CFRelease(hid_manager);
return 1;
......
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