winebus.sys: Build report descriptors in start_device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
68c6c7d936
commit
620b514aa0
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue