diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index 18bebcfeb09..45a65e2a312 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -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; diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index be8e93f4eb8..6cfbdb8f905 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -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) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 802122fbb27..791ccbb2e1a 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -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;