Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_sdl.c | 19 +++---------------- dlls/winebus.sys/bus_udev.c | 17 ++--------------- dlls/winebus.sys/main.c | 30 ++++++++++++++---------------- 3 files changed, 19 insertions(+), 47 deletions(-)
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index e7b7c1fef22..21eac3c67f4 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -489,7 +489,9 @@ static int compare_platform_device(DEVICE_OBJECT *device, void *context)
static NTSTATUS start_device(DEVICE_OBJECT *device) { - return STATUS_SUCCESS; + struct platform_private *ext = impl_from_DEVICE_OBJECT(device); + if (ext->sdl_controller) return build_mapped_report_descriptor(ext); + return build_report_descriptor(ext); }
static NTSTATUS get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length) @@ -797,25 +799,10 @@ static void try_add_device(unsigned int index)
if (device) { - NTSTATUS status; struct platform_private *private = impl_from_DEVICE_OBJECT(device); private->sdl_joystick = joystick; private->sdl_controller = controller; private->id = id; - - /* FIXME: We should probably move this to IRP_MN_START_DEVICE. */ - if (controller) - status = build_mapped_report_descriptor(private); - else - status = build_report_descriptor(private); - if (status) - { - ERR("Building report descriptor failed, removing device\n"); - bus_unlink_hid_device(device); - bus_remove_hid_device(device); - HeapFree(GetProcessHeap(), 0, serial); - return; - } IoInvalidateDeviceRelations(bus_pdo, BusRelations); } else diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index eb6434ad2a5..25c8b5f0b36 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -862,7 +862,8 @@ static void lnxev_free_device(DEVICE_OBJECT *device)
static NTSTATUS lnxev_start_device(DEVICE_OBJECT *device) { - return STATUS_SUCCESS; + struct wine_input_private *ext = input_impl_from_DEVICE_OBJECT(device); + return build_report_descriptor(ext, ext->base.udev_device); }
static NTSTATUS lnxev_get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length) @@ -1148,20 +1149,6 @@ static void try_add_device(struct udev_device *dev) struct platform_private *private = impl_from_DEVICE_OBJECT(device); private->udev_device = udev_device_ref(dev); private->device_fd = fd; -#ifdef HAS_PROPER_INPUT_HEADER - if (strcmp(subsystem, "input") == 0) - /* FIXME: We should probably move this to IRP_MN_START_DEVICE. */ - if (build_report_descriptor((struct wine_input_private *)private, dev)) - { - ERR("Building report descriptor failed, removing device\n"); - close(fd); - udev_device_unref(dev); - bus_unlink_hid_device(device); - bus_remove_hid_device(device); - HeapFree(GetProcessHeap(), 0, serial); - return; - } -#endif IoInvalidateDeviceRelations(bus_pdo, BusRelations); } else diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index f15e7da47b2..3bb534a7d8a 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -488,6 +488,13 @@ static void mouse_free_device(DEVICE_OBJECT *device)
static NTSTATUS mouse_start_device(DEVICE_OBJECT *device) { + if (!hid_descriptor_begin(&mouse_desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_MOUSE)) + return STATUS_NO_MEMORY; + if (!hid_descriptor_add_buttons(&mouse_desc, HID_USAGE_PAGE_BUTTON, 1, 3)) + return STATUS_NO_MEMORY; + if (!hid_descriptor_end(&mouse_desc)) + return STATUS_NO_MEMORY; + return STATUS_SUCCESS; }
@@ -551,14 +558,6 @@ static const platform_vtbl mouse_vtbl = static void mouse_device_create(void) { static const WCHAR busidW[] = {'W','I','N','E','M','O','U','S','E',0}; - - if (!hid_descriptor_begin(&mouse_desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_MOUSE)) - return; - if (!hid_descriptor_add_buttons(&mouse_desc, HID_USAGE_PAGE_BUTTON, 1, 3)) - return; - if (!hid_descriptor_end(&mouse_desc)) - return; - mouse_obj = bus_create_hid_device(busidW, 0, 0, -1, 0, 0, busidW, FALSE, &mouse_vtbl, 0); IoInvalidateDeviceRelations(bus_pdo, BusRelations); } @@ -569,6 +568,13 @@ static void keyboard_free_device(DEVICE_OBJECT *device)
static NTSTATUS keyboard_start_device(DEVICE_OBJECT *device) { + if (!hid_descriptor_begin(&keyboard_desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_KEYBOARD)) + return STATUS_NO_MEMORY; + if (!hid_descriptor_add_buttons(&keyboard_desc, HID_USAGE_PAGE_KEYBOARD, 0, 101)) + return STATUS_NO_MEMORY; + if (!hid_descriptor_end(&keyboard_desc)) + return STATUS_NO_MEMORY; + return STATUS_SUCCESS; }
@@ -632,14 +638,6 @@ static const platform_vtbl keyboard_vtbl = static void keyboard_device_create(void) { static const WCHAR busidW[] = {'W','I','N','E','K','E','Y','B','O','A','R','D',0}; - - if (!hid_descriptor_begin(&keyboard_desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_KEYBOARD)) - return; - if (!hid_descriptor_add_buttons(&keyboard_desc, HID_USAGE_PAGE_KEYBOARD, 0, 101)) - return; - if (!hid_descriptor_end(&keyboard_desc)) - return; - keyboard_obj = bus_create_hid_device(busidW, 0, 0, -1, 0, 0, busidW, FALSE, &keyboard_vtbl, 0); IoInvalidateDeviceRelations(bus_pdo, BusRelations); }