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 5db80784a5b..c5408f29beb 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -504,11 +504,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); @@ -533,7 +528,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, @@ -584,11 +578,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); @@ -613,7 +602,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, @@ -923,9 +911,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); @@ -937,8 +922,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,