Commit ee5cde83 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winebus.sys: Merge begin_report_processing with start_device.

parent 8f065f97
......@@ -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);
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment