winebus.sys: Pass bus id instead of vtbl to lookup functions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
de0fb2adfd
commit
5703d5c0b3
|
@ -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,
|
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,
|
WORD input, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad,
|
||||||
const platform_vtbl *vtbl, DWORD platform_data_size) DECLSPEC_HIDDEN;
|
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_unlink_hid_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
|
||||||
void bus_remove_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;
|
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 */
|
/* General Bus Functions */
|
||||||
DWORD check_bus_option(const UNICODE_STRING *option, DWORD default_value) DECLSPEC_HIDDEN;
|
DWORD check_bus_option(const UNICODE_STRING *option, DWORD default_value) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -377,7 +377,7 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender,
|
||||||
safe way to deallocate that buffer. */
|
safe way to deallocate that buffer. */
|
||||||
IOHIDDeviceUnscheduleFromRunLoop(IOHIDDevice, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
IOHIDDeviceUnscheduleFromRunLoop(IOHIDDevice, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||||
IOHIDDeviceClose(IOHIDDevice, 0);
|
IOHIDDeviceClose(IOHIDDevice, 0);
|
||||||
device = bus_find_hid_device(&iohid_vtbl, IOHIDDevice);
|
device = bus_find_hid_device(busidW, IOHIDDevice);
|
||||||
if (device)
|
if (device)
|
||||||
{
|
{
|
||||||
bus_unlink_hid_device(device);
|
bus_unlink_hid_device(device);
|
||||||
|
|
|
@ -617,7 +617,7 @@ static BOOL set_report_from_event(SDL_Event *event)
|
||||||
struct platform_private *private;
|
struct platform_private *private;
|
||||||
/* All the events coming in will have 'which' as a 3rd field */
|
/* All the events coming in will have 'which' as a 3rd field */
|
||||||
SDL_JoystickID id = ((SDL_JoyButtonEvent*)event)->which;
|
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)
|
if (!device)
|
||||||
{
|
{
|
||||||
ERR("Failed to find device at index %i\n",id);
|
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;
|
struct platform_private *private;
|
||||||
/* All the events coming in will have 'which' as a 3rd field */
|
/* All the events coming in will have 'which' as a 3rd field */
|
||||||
SDL_JoystickID id = ((SDL_ControllerButtonEvent*)event)->which;
|
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)
|
if (!device)
|
||||||
{
|
{
|
||||||
ERR("Failed to find device at index %i\n",id);
|
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_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;
|
if (!device) return;
|
||||||
|
|
||||||
bus_unlink_hid_device(device);
|
bus_unlink_hid_device(device);
|
||||||
|
|
|
@ -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));
|
TRACE("udev %s syspath %s\n", debugstr_a(devnode), udev_device_get_syspath(dev));
|
||||||
|
|
||||||
#ifdef HAS_PROPER_INPUT_HEADER
|
#ifdef HAS_PROPER_INPUT_HEADER
|
||||||
device = bus_enumerate_hid_devices(&lnxev_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_vtbl, 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)
|
if (device)
|
||||||
{
|
{
|
||||||
TRACE("duplicate device found, not adding the new one\n");
|
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_OBJECT *device = NULL;
|
||||||
|
|
||||||
device = bus_find_hid_device(&hidraw_vtbl, dev);
|
device = bus_find_hid_device(hidraw_busidW, dev);
|
||||||
#ifdef HAS_PROPER_INPUT_HEADER
|
#ifdef HAS_PROPER_INPUT_HEADER
|
||||||
if (device == NULL)
|
if (device == NULL) device = bus_find_hid_device(lnxev_busidW, dev);
|
||||||
device = bus_find_hid_device(&lnxev_vtbl, dev);
|
|
||||||
#endif
|
#endif
|
||||||
if (!device) return;
|
if (!device) return;
|
||||||
|
|
||||||
|
|
|
@ -312,18 +312,18 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid,
|
||||||
return device;
|
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;
|
struct pnp_device *dev;
|
||||||
DEVICE_OBJECT *ret = NULL;
|
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);
|
EnterCriticalSection(&device_list_cs);
|
||||||
LIST_FOR_EACH_ENTRY(dev, &pnp_devset, struct pnp_device, entry)
|
LIST_FOR_EACH_ENTRY(dev, &pnp_devset, struct pnp_device, entry)
|
||||||
{
|
{
|
||||||
struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension;
|
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)
|
if (ext->vtbl->compare_platform_device(dev->device, platform_dev) == 0)
|
||||||
{
|
{
|
||||||
ret = dev->device;
|
ret = dev->device;
|
||||||
|
@ -336,19 +336,19 @@ DEVICE_OBJECT *bus_find_hid_device(const platform_vtbl *vtbl, void *platform_dev
|
||||||
return ret;
|
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;
|
struct pnp_device *dev, *dev_next;
|
||||||
DEVICE_OBJECT *ret = NULL;
|
DEVICE_OBJECT *ret = NULL;
|
||||||
int cont;
|
int cont;
|
||||||
|
|
||||||
TRACE("(%p)\n", vtbl);
|
TRACE("bus_id %p\n", debugstr_w(bus_id));
|
||||||
|
|
||||||
EnterCriticalSection(&device_list_cs);
|
EnterCriticalSection(&device_list_cs);
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(dev, dev_next, &pnp_devset, struct pnp_device, entry)
|
LIST_FOR_EACH_ENTRY_SAFE(dev, dev_next, &pnp_devset, struct pnp_device, entry)
|
||||||
{
|
{
|
||||||
struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension;
|
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);
|
LeaveCriticalSection(&device_list_cs);
|
||||||
cont = function(dev->device, context);
|
cont = function(dev->device, context);
|
||||||
EnterCriticalSection(&device_list_cs);
|
EnterCriticalSection(&device_list_cs);
|
||||||
|
|
Loading…
Reference in New Issue