Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus.h | 4 ++-- dlls/winebus.sys/bus_iohid.c | 2 +- dlls/winebus.sys/bus_sdl.c | 6 +++--- dlls/winebus.sys/bus_udev.c | 9 ++++----- dlls/winebus.sys/main.c | 12 ++++++------ 5 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index bf2e157af4d..72bd071135b 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -53,11 +53,11 @@ void *get_platform_private(DEVICE_OBJECT *device) DECLSPEC_HIDDEN; DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, WORD input, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad, const platform_vtbl *vtbl, DWORD platform_data_size) DECLSPEC_HIDDEN; -DEVICE_OBJECT *bus_find_hid_device(const platform_vtbl *vtbl, void *platform_dev) DECLSPEC_HIDDEN; +DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev) DECLSPEC_HIDDEN; void bus_unlink_hid_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN; void bus_remove_hid_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN; void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLSPEC_HIDDEN; -DEVICE_OBJECT* bus_enumerate_hid_devices(const platform_vtbl *vtbl, enum_func function, void* context) DECLSPEC_HIDDEN; +DEVICE_OBJECT *bus_enumerate_hid_devices(const WCHAR *bus_id, enum_func function, void *context) DECLSPEC_HIDDEN;
/* General Bus Functions */ DWORD check_bus_option(const UNICODE_STRING *option, DWORD default_value) DECLSPEC_HIDDEN; diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index f660a3c789a..eb6765d6aac 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -377,7 +377,7 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender, safe way to deallocate that buffer. */ IOHIDDeviceUnscheduleFromRunLoop(IOHIDDevice, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); IOHIDDeviceClose(IOHIDDevice, 0); - device = bus_find_hid_device(&iohid_vtbl, IOHIDDevice); + device = bus_find_hid_device(busidW, IOHIDDevice); if (device) { bus_unlink_hid_device(device); diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 8c9886c7d3c..3607634b7a0 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -617,7 +617,7 @@ static BOOL set_report_from_event(SDL_Event *event) struct platform_private *private; /* All the events coming in will have 'which' as a 3rd field */ SDL_JoystickID id = ((SDL_JoyButtonEvent*)event)->which; - device = bus_enumerate_hid_devices(&sdl_vtbl, compare_joystick_id, ULongToPtr(id)); + device = bus_enumerate_hid_devices(sdl_busidW, compare_joystick_id, ULongToPtr(id)); if (!device) { ERR("Failed to find device at index %i\n",id); @@ -681,7 +681,7 @@ static BOOL set_mapped_report_from_event(SDL_Event *event) struct platform_private *private; /* All the events coming in will have 'which' as a 3rd field */ SDL_JoystickID id = ((SDL_ControllerButtonEvent*)event)->which; - device = bus_enumerate_hid_devices(&sdl_vtbl, compare_joystick_id, ULongToPtr(id)); + device = bus_enumerate_hid_devices(sdl_busidW, compare_joystick_id, ULongToPtr(id)); if (!device) { ERR("Failed to find device at index %i\n",id); @@ -748,7 +748,7 @@ static void try_remove_device(SDL_JoystickID id) { DEVICE_OBJECT *device = NULL;
- device = bus_enumerate_hid_devices(&sdl_vtbl, compare_joystick_id, ULongToPtr(id)); + device = bus_enumerate_hid_devices(sdl_busidW, compare_joystick_id, ULongToPtr(id)); if (!device) return;
bus_unlink_hid_device(device); diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 887996daf49..864ffc0bf09 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1095,8 +1095,8 @@ static void try_add_device(struct udev_device *dev) TRACE("udev %s syspath %s\n", debugstr_a(devnode), udev_device_get_syspath(dev));
#ifdef HAS_PROPER_INPUT_HEADER - device = bus_enumerate_hid_devices(&lnxev_vtbl, check_device_syspath, (void *)get_device_syspath(dev)); - if (!device) device = bus_enumerate_hid_devices(&hidraw_vtbl, check_device_syspath, (void *)get_device_syspath(dev)); + device = bus_enumerate_hid_devices(lnxev_busidW, check_device_syspath, (void *)get_device_syspath(dev)); + if (!device) device = bus_enumerate_hid_devices(hidraw_busidW, check_device_syspath, (void *)get_device_syspath(dev)); if (device) { TRACE("duplicate device found, not adding the new one\n"); @@ -1212,10 +1212,9 @@ static void try_remove_device(struct udev_device *dev) { DEVICE_OBJECT *device = NULL;
- device = bus_find_hid_device(&hidraw_vtbl, dev); + device = bus_find_hid_device(hidraw_busidW, dev); #ifdef HAS_PROPER_INPUT_HEADER - if (device == NULL) - device = bus_find_hid_device(&lnxev_vtbl, dev); + if (device == NULL) device = bus_find_hid_device(lnxev_busidW, dev); #endif if (!device) return;
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index b7230cf2e33..23c40e6895e 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -312,18 +312,18 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, return device; }
-DEVICE_OBJECT *bus_find_hid_device(const platform_vtbl *vtbl, void *platform_dev) +DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev) { struct pnp_device *dev; DEVICE_OBJECT *ret = NULL;
- TRACE("(%p, %p)\n", vtbl, platform_dev); + TRACE("bus_id %s, platform_dev %p\n", debugstr_w(bus_id), platform_dev);
EnterCriticalSection(&device_list_cs); LIST_FOR_EACH_ENTRY(dev, &pnp_devset, struct pnp_device, entry) { struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension; - if (ext->vtbl != vtbl) continue; + if (strcmpW(ext->busid, bus_id)) continue; if (ext->vtbl->compare_platform_device(dev->device, platform_dev) == 0) { ret = dev->device; @@ -336,19 +336,19 @@ DEVICE_OBJECT *bus_find_hid_device(const platform_vtbl *vtbl, void *platform_dev return ret; }
-DEVICE_OBJECT* bus_enumerate_hid_devices(const platform_vtbl *vtbl, enum_func function, void* context) +DEVICE_OBJECT *bus_enumerate_hid_devices(const WCHAR *bus_id, enum_func function, void *context) { struct pnp_device *dev, *dev_next; DEVICE_OBJECT *ret = NULL; int cont;
- TRACE("(%p)\n", vtbl); + TRACE("bus_id %p\n", debugstr_w(bus_id));
EnterCriticalSection(&device_list_cs); LIST_FOR_EACH_ENTRY_SAFE(dev, dev_next, &pnp_devset, struct pnp_device, entry) { struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension; - if (ext->vtbl != vtbl) continue; + if (strcmpW(ext->busid, bus_id)) continue; LeaveCriticalSection(&device_list_cs); cont = function(dev->device, context); EnterCriticalSection(&device_list_cs);