Commit 72dd8baf authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

winebus.sys: Implement IOCTL_HID_GET(SET)_FEATURE for hidraw.

parent 07cfeac3
......@@ -27,6 +27,8 @@ typedef struct
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);
} platform_vtbl;
void *get_platform_private(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
......
......@@ -301,6 +301,52 @@ static NTSTATUS hidraw_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *
}
}
static NTSTATUS hidraw_get_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *read)
{
#ifdef HAVE_LINUX_HIDRAW_H
int rc;
struct platform_private* ext = impl_from_DEVICE_OBJECT(device);
length = min(length, 0x1fff);
rc = ioctl(ext->device_fd, HIDIOCGFEATURE(length), report);
if (rc >= 0)
{
*read = rc;
return STATUS_SUCCESS;
}
else
{
*read = 0;
return STATUS_UNSUCCESSFUL;
}
#else
*read = 0;
return STATUS_NOT_IMPLEMENTED;
#endif
}
static NTSTATUS hidraw_set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written)
{
#ifdef HAVE_LINUX_HIDRAW_H
int rc;
struct platform_private* ext = impl_from_DEVICE_OBJECT(device);
length = min(length, 0x1fff);
rc = ioctl(ext->device_fd, HIDIOCSFEATURE(length), report);
if (rc >= 0)
{
*written = rc;
return STATUS_SUCCESS;
}
else
{
*written = 0;
return STATUS_UNSUCCESSFUL;
}
#else
*written = 0;
return STATUS_NOT_IMPLEMENTED;
#endif
}
static const platform_vtbl hidraw_vtbl =
{
compare_platform_device,
......@@ -308,6 +354,8 @@ static const platform_vtbl hidraw_vtbl =
hidraw_get_string,
begin_report_processing,
hidraw_set_output_report,
hidraw_get_feature_report,
hidraw_set_feature_report,
};
static void try_add_device(struct udev_device *dev)
......
......@@ -541,6 +541,25 @@ NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
packet->reportBufferLen, &irp->IoStatus.Information);
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.u.Status = status = ext->vtbl->get_feature_report(
device, packet->reportId, packet->reportBuffer,
packet->reportBufferLen, &irp->IoStatus.Information);
packet->reportBufferLen = irp->IoStatus.Information;
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.u.Status = status = ext->vtbl->set_feature_report(
device, packet->reportId, packet->reportBuffer,
packet->reportBufferLen, &irp->IoStatus.Information);
break;
}
default:
{
ULONG code = irpsp->Parameters.DeviceIoControl.IoControlCode;
......
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