Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
Supersedes: 211680-211686
dlls/winebus.sys/bus.h | 1 + dlls/winebus.sys/bus_iohid.c | 6 ++++++ dlls/winebus.sys/bus_sdl.c | 6 ++++++ dlls/winebus.sys/bus_udev.c | 12 ++++++++++++ dlls/winebus.sys/main.c | 33 ++++++++++++++++++++++++++++----- 5 files changed, 53 insertions(+), 5 deletions(-)
diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index 72bd071135b..f46daa7144d 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -39,6 +39,7 @@ typedef struct { void (*free_device)(DEVICE_OBJECT *device); int (*compare_platform_device)(DEVICE_OBJECT *device, void *platform_dev); + NTSTATUS (*start_device)(DEVICE_OBJECT *device); NTSTATUS (*get_reportdescriptor)(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length); NTSTATUS (*get_string)(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length); NTSTATUS (*begin_report_processing)(DEVICE_OBJECT *device); diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index eb6765d6aac..9b9e93f5c49 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -148,6 +148,11 @@ static int compare_platform_device(DEVICE_OBJECT *device, void *platform_dev) return 0; }
+static NTSTATUS start_device(DEVICE_OBJECT *device) +{ + return STATUS_SUCCESS; +} + static NTSTATUS get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length) { struct platform_private *private = impl_from_DEVICE_OBJECT(device); @@ -274,6 +279,7 @@ static const platform_vtbl iohid_vtbl = { free_device, compare_platform_device, + start_device, get_reportdescriptor, get_string, begin_report_processing, diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index c833b4e4c06..e7b7c1fef22 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -487,6 +487,11 @@ static int compare_platform_device(DEVICE_OBJECT *device, void *context) return impl_from_DEVICE_OBJECT(device)->id - PtrToUlong(context); }
+static NTSTATUS start_device(DEVICE_OBJECT *device) +{ + return STATUS_SUCCESS; +} + static NTSTATUS get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length) { struct platform_private *ext = impl_from_DEVICE_OBJECT(device); @@ -596,6 +601,7 @@ static const platform_vtbl sdl_vtbl = { free_device, compare_platform_device, + start_device, get_reportdescriptor, get_string, begin_report_processing, diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 9176dff69a7..eb6434ad2a5 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -558,6 +558,11 @@ static int compare_platform_device(DEVICE_OBJECT *device, void *platform_dev) return strcmp(udev_device_get_syspath(dev1), udev_device_get_syspath(dev2)); }
+static NTSTATUS hidraw_start_device(DEVICE_OBJECT *device) +{ + return STATUS_SUCCESS; +} + static NTSTATUS hidraw_get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length) { #ifdef HAVE_LINUX_HIDRAW_H @@ -818,6 +823,7 @@ static const platform_vtbl hidraw_vtbl = { hidraw_free_device, compare_platform_device, + hidraw_start_device, hidraw_get_reportdescriptor, hidraw_get_string, begin_report_processing, @@ -854,6 +860,11 @@ static void lnxev_free_device(DEVICE_OBJECT *device) udev_device_unref(ext->base.udev_device); }
+static NTSTATUS lnxev_start_device(DEVICE_OBJECT *device) +{ + return STATUS_SUCCESS; +} + static NTSTATUS lnxev_get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length) { struct wine_input_private *ext = input_impl_from_DEVICE_OBJECT(device); @@ -967,6 +978,7 @@ static NTSTATUS lnxev_set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE * static const platform_vtbl lnxev_vtbl = { lnxev_free_device, compare_platform_device, + lnxev_start_device, lnxev_get_reportdescriptor, lnxev_get_string, lnxev_begin_report_processing, diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index a60e3cc9a2c..f15e7da47b2 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -109,11 +109,17 @@ struct pnp_device DEVICE_OBJECT *device; };
+enum device_state +{ + DEVICE_STATE_STOPPED, + DEVICE_STATE_STARTED, + DEVICE_STATE_REMOVED, +}; + struct device_extension { CRITICAL_SECTION cs; - - BOOL removed; + enum device_state state;
struct pnp_device *pnp_device;
@@ -480,6 +486,11 @@ static void mouse_free_device(DEVICE_OBJECT *device) { }
+static NTSTATUS mouse_start_device(DEVICE_OBJECT *device) +{ + return STATUS_SUCCESS; +} + static NTSTATUS mouse_get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *ret_length) { TRACE("buffer %p, length %u.\n", buffer, length); @@ -528,6 +539,7 @@ static NTSTATUS mouse_set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE * static const platform_vtbl mouse_vtbl = { .free_device = mouse_free_device, + .start_device = mouse_start_device, .get_reportdescriptor = mouse_get_reportdescriptor, .get_string = mouse_get_string, .begin_report_processing = mouse_begin_report_processing, @@ -555,6 +567,11 @@ static void keyboard_free_device(DEVICE_OBJECT *device) { }
+static NTSTATUS keyboard_start_device(DEVICE_OBJECT *device) +{ + return STATUS_SUCCESS; +} + static NTSTATUS keyboard_get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *ret_length) { TRACE("buffer %p, length %u.\n", buffer, length); @@ -603,6 +620,7 @@ static NTSTATUS keyboard_set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYT static const platform_vtbl keyboard_vtbl = { .free_device = keyboard_free_device, + .start_device = keyboard_start_device, .get_reportdescriptor = keyboard_get_reportdescriptor, .get_string = keyboard_get_string, .begin_report_processing = keyboard_begin_report_processing, @@ -695,13 +713,18 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) break;
case IRP_MN_START_DEVICE: - status = STATUS_SUCCESS; + EnterCriticalSection(&ext->cs); + if (ext->state != DEVICE_STATE_STOPPED) status = STATUS_SUCCESS; + else if (ext->state == DEVICE_STATE_REMOVED) status = STATUS_DELETE_PENDING; + else if (!(status = ext->vtbl->start_device(device))) ext->state = DEVICE_STATE_STARTED; + else ERR("failed to start device %p, status %#x\n", device, status); + LeaveCriticalSection(&ext->cs); break;
case IRP_MN_SURPRISE_REMOVAL: EnterCriticalSection(&ext->cs); remove_pending_irps(device); - ext->removed = TRUE; + ext->state = DEVICE_STATE_REMOVED; LeaveCriticalSection(&ext->cs); status = STATUS_SUCCESS; break; @@ -834,7 +857,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
EnterCriticalSection(&ext->cs);
- if (ext->removed) + if (ext->state == DEVICE_STATE_REMOVED) { LeaveCriticalSection(&ext->cs); irp->IoStatus.Status = STATUS_DELETE_PENDING;
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); }
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus.h | 1 - dlls/winebus.sys/main.c | 18 ------------------ 2 files changed, 19 deletions(-)
diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index f46daa7144d..d07b33e86b3 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -56,7 +56,6 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, const platform_vtbl *vtbl, DWORD platform_data_size) 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 WCHAR *bus_id, enum_func function, void *context) DECLSPEC_HIDDEN;
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 3bb534a7d8a..4b246b0059a 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -378,24 +378,6 @@ void bus_unlink_hid_device(DEVICE_OBJECT *device) LeaveCriticalSection(&device_list_cs); }
-void bus_remove_hid_device(DEVICE_OBJECT *device) -{ - struct device_extension *ext = (struct device_extension *)device->DeviceExtension; - struct pnp_device *pnp_device = ext->pnp_device; - - TRACE("(%p)\n", device); - - ext->cs.DebugInfo->Spare[0] = 0; - DeleteCriticalSection(&ext->cs); - - HeapFree(GetProcessHeap(), 0, ext->serial); - HeapFree(GetProcessHeap(), 0, ext->last_report); - IoDeleteDevice(device); - - /* pnp_device must be released after the device is gone */ - HeapFree(GetProcessHeap(), 0, pnp_device); -} - static NTSTATUS build_device_relations(DEVICE_RELATIONS **devices) { int i;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus.h | 1 - dlls/winebus.sys/bus_iohid.c | 27 ++++------- dlls/winebus.sys/bus_sdl.c | 6 --- dlls/winebus.sys/bus_udev.c | 94 ++++++++++++++++-------------------- dlls/winebus.sys/main.c | 17 ------- 5 files changed, 51 insertions(+), 94 deletions(-)
diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index d07b33e86b3..5f763acbf3e 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -42,7 +42,6 @@ typedef struct NTSTATUS (*start_device)(DEVICE_OBJECT *device); NTSTATUS (*get_reportdescriptor)(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length); NTSTATUS (*get_string)(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length); - NTSTATUS (*begin_report_processing)(DEVICE_OBJECT *device); NTSTATUS (*set_output_report)(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written); NTSTATUS (*get_feature_report)(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *read); NTSTATUS (*set_feature_report)(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written); diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 9b9e93f5c49..394e3228838 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -150,6 +150,15 @@ static int compare_platform_device(DEVICE_OBJECT *device, void *platform_dev)
static NTSTATUS start_device(DEVICE_OBJECT *device) { + DWORD length; + struct platform_private *private = impl_from_DEVICE_OBJECT(device); + CFNumberRef num; + + num = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDMaxInputReportSizeKey)); + length = CFNumberToDWORD(num); + private->buffer = HeapAlloc(GetProcessHeap(), 0, length); + + IOHIDDeviceRegisterInputReportCallback(private->device, private->buffer, length, handle_IOHIDDeviceIOHIDReportCallback, device); return STATUS_SUCCESS; }
@@ -204,23 +213,6 @@ static NTSTATUS get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DW return STATUS_SUCCESS; }
-static NTSTATUS begin_report_processing(DEVICE_OBJECT *device) -{ - DWORD length; - struct platform_private *private = impl_from_DEVICE_OBJECT(device); - CFNumberRef num; - - if (private->buffer) - return STATUS_SUCCESS; - - num = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDMaxInputReportSizeKey)); - length = CFNumberToDWORD(num); - private->buffer = HeapAlloc(GetProcessHeap(), 0, length); - - IOHIDDeviceRegisterInputReportCallback(private->device, private->buffer, length, handle_IOHIDDeviceIOHIDReportCallback, device); - return STATUS_SUCCESS; -} - static NTSTATUS set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) { IOReturn result; @@ -282,7 +274,6 @@ static const platform_vtbl iohid_vtbl = start_device, get_reportdescriptor, get_string, - begin_report_processing, set_output_report, get_feature_report, set_feature_report, diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 21eac3c67f4..4770de02ffe 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -536,11 +536,6 @@ static NTSTATUS get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DW return STATUS_SUCCESS; }
-static NTSTATUS begin_report_processing(DEVICE_OBJECT *device) -{ - return STATUS_SUCCESS; -} - static NTSTATUS set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) { struct platform_private *ext = impl_from_DEVICE_OBJECT(device); @@ -606,7 +601,6 @@ static const platform_vtbl sdl_vtbl = start_device, get_reportdescriptor, get_string, - begin_report_processing, set_output_report, get_feature_report, set_feature_report, diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 25c8b5f0b36..977e5f2972a 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -558,8 +558,27 @@ static int compare_platform_device(DEVICE_OBJECT *device, void *platform_dev) return strcmp(udev_device_get_syspath(dev1), udev_device_get_syspath(dev2)); }
+static DWORD CALLBACK device_report_thread(void *args); + static NTSTATUS hidraw_start_device(DEVICE_OBJECT *device) { + struct platform_private *private = impl_from_DEVICE_OBJECT(device); + + if (pipe(private->control_pipe) != 0) + { + ERR("Control pipe creation failed\n"); + return STATUS_UNSUCCESSFUL; + } + + private->report_thread = CreateThread(NULL, 0, device_report_thread, device, 0, NULL); + if (!private->report_thread) + { + ERR("Unable to create device report thread\n"); + close(private->control_pipe[0]); + close(private->control_pipe[1]); + return STATUS_UNSUCCESSFUL; + } + return STATUS_SUCCESS; }
@@ -697,31 +716,6 @@ static DWORD CALLBACK device_report_thread(void *args) return 0; }
-static NTSTATUS begin_report_processing(DEVICE_OBJECT *device) -{ - struct platform_private *private = impl_from_DEVICE_OBJECT(device); - - if (private->report_thread) - return STATUS_SUCCESS; - - if (pipe(private->control_pipe) != 0) - { - ERR("Control pipe creation failed\n"); - return STATUS_UNSUCCESSFUL; - } - - private->report_thread = CreateThread(NULL, 0, device_report_thread, device, 0, NULL); - if (!private->report_thread) - { - ERR("Unable to create device report thread\n"); - close(private->control_pipe[0]); - close(private->control_pipe[1]); - return STATUS_UNSUCCESSFUL; - } - else - return STATUS_SUCCESS; -} - static NTSTATUS hidraw_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) { struct platform_private* ext = impl_from_DEVICE_OBJECT(device); @@ -826,7 +820,6 @@ static const platform_vtbl hidraw_vtbl = hidraw_start_device, hidraw_get_reportdescriptor, hidraw_get_string, - begin_report_processing, hidraw_set_output_report, hidraw_get_feature_report, hidraw_set_feature_report, @@ -860,10 +853,32 @@ static void lnxev_free_device(DEVICE_OBJECT *device) udev_device_unref(ext->base.udev_device); }
+static DWORD CALLBACK lnxev_device_report_thread(void *args); + static NTSTATUS lnxev_start_device(DEVICE_OBJECT *device) { struct wine_input_private *ext = input_impl_from_DEVICE_OBJECT(device); - return build_report_descriptor(ext, ext->base.udev_device); + NTSTATUS status; + + if ((status = build_report_descriptor(ext, ext->base.udev_device))) + return status; + + if (pipe(ext->base.control_pipe) != 0) + { + ERR("Control pipe creation failed\n"); + return STATUS_UNSUCCESSFUL; + } + + ext->base.report_thread = CreateThread(NULL, 0, lnxev_device_report_thread, device, 0, NULL); + if (!ext->base.report_thread) + { + ERR("Unable to create device report thread\n"); + close(ext->base.control_pipe[0]); + close(ext->base.control_pipe[1]); + return STATUS_UNSUCCESSFUL; + } + + return STATUS_SUCCESS; }
static NTSTATUS lnxev_get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length) @@ -934,30 +949,6 @@ static DWORD CALLBACK lnxev_device_report_thread(void *args) return 0; }
-static NTSTATUS lnxev_begin_report_processing(DEVICE_OBJECT *device) -{ - struct wine_input_private *private = input_impl_from_DEVICE_OBJECT(device); - - if (private->base.report_thread) - return STATUS_SUCCESS; - - if (pipe(private->base.control_pipe) != 0) - { - ERR("Control pipe creation failed\n"); - return STATUS_UNSUCCESSFUL; - } - - private->base.report_thread = CreateThread(NULL, 0, lnxev_device_report_thread, device, 0, NULL); - if (!private->base.report_thread) - { - ERR("Unable to create device report thread\n"); - close(private->base.control_pipe[0]); - close(private->base.control_pipe[1]); - return STATUS_UNSUCCESSFUL; - } - return STATUS_SUCCESS; -} - static NTSTATUS lnxev_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) { *written = 0; @@ -982,7 +973,6 @@ static const platform_vtbl lnxev_vtbl = { lnxev_start_device, lnxev_get_reportdescriptor, lnxev_get_string, - lnxev_begin_report_processing, lnxev_set_output_report, lnxev_get_feature_report, lnxev_set_feature_report, diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 4b246b0059a..fcaace3fba9 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -502,11 +502,6 @@ static NTSTATUS mouse_get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buff return STATUS_SUCCESS; }
-static NTSTATUS mouse_begin_report_processing(DEVICE_OBJECT *device) -{ - return STATUS_SUCCESS; -} - static NTSTATUS mouse_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length) { FIXME("id %u, stub!\n", id); @@ -531,7 +526,6 @@ static const platform_vtbl mouse_vtbl = .start_device = mouse_start_device, .get_reportdescriptor = mouse_get_reportdescriptor, .get_string = mouse_get_string, - .begin_report_processing = mouse_begin_report_processing, .set_output_report = mouse_set_output_report, .get_feature_report = mouse_get_feature_report, .set_feature_report = mouse_set_feature_report, @@ -582,11 +576,6 @@ static NTSTATUS keyboard_get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *b return STATUS_SUCCESS; }
-static NTSTATUS keyboard_begin_report_processing(DEVICE_OBJECT *device) -{ - return STATUS_SUCCESS; -} - static NTSTATUS keyboard_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length) { FIXME("id %u, stub!\n", id); @@ -611,7 +600,6 @@ static const platform_vtbl keyboard_vtbl = .start_device = keyboard_start_device, .get_reportdescriptor = keyboard_get_reportdescriptor, .get_string = keyboard_get_string, - .begin_report_processing = keyboard_begin_report_processing, .set_output_report = keyboard_set_output_report, .get_feature_report = keyboard_get_feature_report, .set_feature_report = keyboard_set_feature_report, @@ -922,9 +910,6 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) { HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer); TRACE_(hid_report)("IOCTL_HID_GET_INPUT_REPORT\n"); - irp->IoStatus.Status = ext->vtbl->begin_report_processing(device); - if (irp->IoStatus.Status != STATUS_SUCCESS) break; - irp->IoStatus.Status = deliver_last_report(ext, packet->reportBufferLen, packet->reportBuffer, &irp->IoStatus.Information); @@ -936,8 +921,6 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) case IOCTL_HID_READ_REPORT: { TRACE_(hid_report)("IOCTL_HID_READ_REPORT\n"); - irp->IoStatus.Status = ext->vtbl->begin_report_processing(device); - if (irp->IoStatus.Status != STATUS_SUCCESS) break; if (!ext->last_report_read) { irp->IoStatus.Status = deliver_last_report(ext,
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus.h | 7 +-- dlls/winebus.sys/bus_iohid.c | 41 +++++++++-------- dlls/winebus.sys/bus_sdl.c | 29 ++++++------ dlls/winebus.sys/bus_udev.c | 89 +++++++++++++++++++----------------- dlls/winebus.sys/main.c | 55 +++++++++++----------- 5 files changed, 114 insertions(+), 107 deletions(-)
diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index 5f763acbf3e..3e53b9c53f1 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -22,6 +22,7 @@ #include <winbase.h> #include <winternl.h> #include <ddk/wdm.h> +#include <ddk/hidclass.h> #include <hidusage.h>
typedef int(*enum_func)(DEVICE_OBJECT *device, void *context); @@ -42,9 +43,9 @@ typedef struct NTSTATUS (*start_device)(DEVICE_OBJECT *device); NTSTATUS (*get_reportdescriptor)(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length); NTSTATUS (*get_string)(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length); - NTSTATUS (*set_output_report)(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written); - NTSTATUS (*get_feature_report)(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *read); - NTSTATUS (*set_feature_report)(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written); + void (*set_output_report)(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); + void (*get_feature_report)(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); + void (*set_feature_report)(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); } platform_vtbl;
void *get_platform_private(DEVICE_OBJECT *device) DECLSPEC_HIDDEN; diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 394e3228838..4eb0ea0e4b3 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -213,57 +213,60 @@ static NTSTATUS get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DW return STATUS_SUCCESS; }
-static NTSTATUS set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) +static void set_output_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { IOReturn result; struct platform_private *private = impl_from_DEVICE_OBJECT(device); - result = IOHIDDeviceSetReport(private->device, kIOHIDReportTypeOutput, id, report, length); + result = IOHIDDeviceSetReport(private->device, kIOHIDReportTypeOutput, packet->reportId, + packet->reportBuffer, packet->reportBufferLen); if (result == kIOReturnSuccess) { - *written = length; - return STATUS_SUCCESS; + io->Information = packet->reportBufferLen; + io->Status = STATUS_SUCCESS; } else { - *written = 0; - return STATUS_UNSUCCESSFUL; + io->Information = 0; + io->Status = STATUS_UNSUCCESSFUL; } }
-static NTSTATUS get_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *read) +static void get_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { IOReturn ret; - CFIndex report_length = length; + CFIndex report_length = packet->reportBufferLen; struct platform_private *private = impl_from_DEVICE_OBJECT(device);
- ret = IOHIDDeviceGetReport(private->device, kIOHIDReportTypeFeature, id, report, &report_length); + ret = IOHIDDeviceGetReport(private->device, kIOHIDReportTypeFeature, packet->reportId, + packet->reportBuffer, &report_length); if (ret == kIOReturnSuccess) { - *read = report_length; - return STATUS_SUCCESS; + io->Information = report_length; + io->Status = STATUS_SUCCESS; } else { - *read = 0; - return STATUS_UNSUCCESSFUL; + io->Information = 0; + io->Status = STATUS_UNSUCCESSFUL; } }
-static NTSTATUS set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) +static void set_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { IOReturn result; struct platform_private *private = impl_from_DEVICE_OBJECT(device);
- result = IOHIDDeviceSetReport(private->device, kIOHIDReportTypeFeature, id, report, length); + result = IOHIDDeviceSetReport(private->device, kIOHIDReportTypeFeature, packet->reportId, + packet->reportBuffer, packet->reportBufferLen); if (result == kIOReturnSuccess) { - *written = length; - return STATUS_SUCCESS; + io->Information = packet->reportBufferLen; + io->Status = STATUS_SUCCESS; } else { - *written = 0; - return STATUS_UNSUCCESSFUL; + io->Information = 0; + io->Status = STATUS_UNSUCCESSFUL; } }
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 4770de02ffe..84e3ef20664 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -536,14 +536,14 @@ static NTSTATUS get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DW return STATUS_SUCCESS; }
-static NTSTATUS set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) +static void set_output_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { struct platform_private *ext = impl_from_DEVICE_OBJECT(device);
- if (ext->sdl_haptic && id == 0) + if (ext->sdl_haptic && packet->reportId == 0) { - WORD left = report[2] * 128; - WORD right = report[3] * 128; + WORD left = packet->reportBuffer[2] * 128; + WORD right = packet->reportBuffer[3] * 128;
if (ext->haptic_effect_id >= 0) { @@ -572,26 +572,27 @@ static NTSTATUS set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, pSDL_HapticRumblePlay(ext->sdl_haptic, i, -1); } } - *written = length; - return STATUS_SUCCESS; + + io->Information = packet->reportBufferLen; + io->Status = STATUS_SUCCESS; } else { - *written = 0; - return STATUS_NOT_IMPLEMENTED; + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; } }
-static NTSTATUS get_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *read) +static void get_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - *read = 0; - return STATUS_NOT_IMPLEMENTED; + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
-static NTSTATUS set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) +static void set_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - *written = 0; - return STATUS_NOT_IMPLEMENTED; + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
static const platform_vtbl sdl_vtbl = diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 977e5f2972a..77a242a6087 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -716,100 +716,103 @@ static DWORD CALLBACK device_report_thread(void *args) return 0; }
-static NTSTATUS hidraw_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) +static void hidraw_set_output_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { struct platform_private* ext = impl_from_DEVICE_OBJECT(device); + ULONG length = packet->reportBufferLen; BYTE buffer[8192]; int count = 0;
- if ((buffer[0] = id)) - count = write(ext->device_fd, report, length); + if ((buffer[0] = packet->reportId)) + count = write(ext->device_fd, packet->reportBuffer, length); else if (length > sizeof(buffer) - 1) - ERR_(hid_report)("id %d length %u >= 8192, cannot write\n", id, length); + ERR_(hid_report)("id %d length %u >= 8192, cannot write\n", packet->reportId, length); else { - memcpy(buffer + 1, report, length); + memcpy(buffer + 1, packet->reportBuffer, length); count = write(ext->device_fd, buffer, length + 1); }
if (count > 0) { - *written = count; - return STATUS_SUCCESS; + io->Information = count; + io->Status = STATUS_SUCCESS; } else { - ERR_(hid_report)("id %d write failed error: %d %s\n", id, errno, strerror(errno)); - *written = 0; - return STATUS_UNSUCCESSFUL; + ERR_(hid_report)("id %d write failed error: %d %s\n", packet->reportId, errno, strerror(errno)); + io->Information = 0; + io->Status = STATUS_UNSUCCESSFUL; } }
-static NTSTATUS hidraw_get_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *read) +static void hidraw_get_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { #if defined(HAVE_LINUX_HIDRAW_H) && defined(HIDIOCGFEATURE) struct platform_private* ext = impl_from_DEVICE_OBJECT(device); + ULONG length = packet->reportBufferLen; BYTE buffer[8192]; int count = 0;
- if ((buffer[0] = id) && length <= 0x1fff) - count = ioctl(ext->device_fd, HIDIOCGFEATURE(length), report); + if ((buffer[0] = packet->reportId) && length <= 0x1fff) + count = ioctl(ext->device_fd, HIDIOCGFEATURE(length), packet->reportBuffer); else if (length > sizeof(buffer) - 1) - ERR_(hid_report)("id %d length %u >= 8192, cannot read\n", id, length); + ERR_(hid_report)("id %d length %u >= 8192, cannot read\n", packet->reportId, length); else { count = ioctl(ext->device_fd, HIDIOCGFEATURE(length + 1), buffer); - memcpy(report, buffer + 1, length); + memcpy(packet->reportBuffer, buffer + 1, length); }
if (count > 0) { - *read = count; - return STATUS_SUCCESS; + io->Information = count; + io->Status = STATUS_SUCCESS; } else { - ERR_(hid_report)("id %d read failed, error: %d %s\n", id, errno, strerror(errno)); - *read = 0; - return STATUS_UNSUCCESSFUL; + ERR_(hid_report)("id %d read failed, error: %d %s\n", packet->reportId, errno, strerror(errno)); + io->Information = 0; + io->Status = STATUS_UNSUCCESSFUL; } #else - *read = 0; - return STATUS_NOT_IMPLEMENTED; + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; #endif }
-static NTSTATUS hidraw_set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) +static void hidraw_set_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { #if defined(HAVE_LINUX_HIDRAW_H) && defined(HIDIOCSFEATURE) struct platform_private* ext = impl_from_DEVICE_OBJECT(device); + ULONG length = packet->reportBufferLen; BYTE buffer[8192]; int count = 0;
- if ((buffer[0] = id) && length <= 0x1fff) - count = ioctl(ext->device_fd, HIDIOCSFEATURE(length), report); + if ((buffer[0] = packet->reportId) && length <= 0x1fff) + count = ioctl(ext->device_fd, HIDIOCSFEATURE(length), packet->reportBuffer); else if (length > sizeof(buffer) - 1) - ERR_(hid_report)("id %d length %u >= 8192, cannot write\n", id, length); + ERR_(hid_report)("id %d length %u >= 8192, cannot write\n", packet->reportId, length); else { - memcpy(buffer + 1, report, length); + memcpy(buffer + 1, packet->reportBuffer, length); count = ioctl(ext->device_fd, HIDIOCSFEATURE(length + 1), buffer); }
if (count > 0) { - *written = count; - return STATUS_SUCCESS; + io->Information = count; + io->Status = STATUS_SUCCESS; } else { - ERR_(hid_report)("id %d write failed, error: %d %s\n", id, errno, strerror(errno)); - *written = 0; - return STATUS_UNSUCCESSFUL; + ERR_(hid_report)("id %d write failed, error: %d %s\n", packet->reportId, errno, strerror(errno)); + io->Information = 0; + io->Status = STATUS_UNSUCCESSFUL; } #else - *written = 0; - return STATUS_NOT_IMPLEMENTED; + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; #endif }
@@ -949,22 +952,22 @@ static DWORD CALLBACK lnxev_device_report_thread(void *args) return 0; }
-static NTSTATUS lnxev_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) +static void lnxev_set_output_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - *written = 0; - return STATUS_NOT_IMPLEMENTED; + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
-static NTSTATUS lnxev_get_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *read) +static void lnxev_get_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - *read = 0; - return STATUS_NOT_IMPLEMENTED; + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
-static NTSTATUS lnxev_set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) +static void lnxev_set_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - *written = 0; - return STATUS_NOT_IMPLEMENTED; + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
static const platform_vtbl lnxev_vtbl = { diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index fcaace3fba9..e372ec6db3f 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -502,22 +502,25 @@ static NTSTATUS mouse_get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buff return STATUS_SUCCESS; }
-static NTSTATUS mouse_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length) +static void mouse_set_output_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - FIXME("id %u, stub!\n", id); - return STATUS_NOT_IMPLEMENTED; + FIXME("id %u, stub!\n", packet->reportId); + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
-static NTSTATUS mouse_get_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length) +static void mouse_get_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - FIXME("id %u, stub!\n", id); - return STATUS_NOT_IMPLEMENTED; + FIXME("id %u, stub!\n", packet->reportId); + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
-static NTSTATUS mouse_set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length) +static void mouse_set_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - FIXME("id %u, stub!\n", id); - return STATUS_NOT_IMPLEMENTED; + FIXME("id %u, stub!\n", packet->reportId); + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
static const platform_vtbl mouse_vtbl = @@ -576,22 +579,25 @@ static NTSTATUS keyboard_get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *b return STATUS_SUCCESS; }
-static NTSTATUS keyboard_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length) +static void keyboard_set_output_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - FIXME("id %u, stub!\n", id); - return STATUS_NOT_IMPLEMENTED; + FIXME("id %u, stub!\n", packet->reportId); + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
-static NTSTATUS keyboard_get_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length) +static void keyboard_get_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - FIXME("id %u, stub!\n", id); - return STATUS_NOT_IMPLEMENTED; + FIXME("id %u, stub!\n", packet->reportId); + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
-static NTSTATUS keyboard_set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length) +static void keyboard_set_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { - FIXME("id %u, stub!\n", id); - return STATUS_NOT_IMPLEMENTED; + FIXME("id %u, stub!\n", packet->reportId); + io->Information = 0; + io->Status = STATUS_NOT_IMPLEMENTED; }
static const platform_vtbl keyboard_vtbl = @@ -939,28 +945,21 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) { HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer); TRACE_(hid_report)("IOCTL_HID_WRITE_REPORT / IOCTL_HID_SET_OUTPUT_REPORT\n"); - irp->IoStatus.Status = ext->vtbl->set_output_report( - device, packet->reportId, packet->reportBuffer, - packet->reportBufferLen, &irp->IoStatus.Information); + ext->vtbl->set_output_report(device, packet, &irp->IoStatus); break; } case IOCTL_HID_GET_FEATURE: { HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer); TRACE_(hid_report)("IOCTL_HID_GET_FEATURE\n"); - irp->IoStatus.Status = ext->vtbl->get_feature_report( - device, packet->reportId, packet->reportBuffer, - packet->reportBufferLen, &irp->IoStatus.Information); - packet->reportBufferLen = irp->IoStatus.Information; + ext->vtbl->get_feature_report(device, packet, &irp->IoStatus); break; } case IOCTL_HID_SET_FEATURE: { HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer); TRACE_(hid_report)("IOCTL_HID_SET_FEATURE\n"); - irp->IoStatus.Status = ext->vtbl->set_feature_report( - device, packet->reportId, packet->reportBuffer, - packet->reportBufferLen, &irp->IoStatus.Information); + ext->vtbl->set_feature_report(device, packet, &irp->IoStatus); break; } default: