Aric Stewart : hid: Implement HidD_SetOutputReport.

Alexandre Julliard julliard at winehq.org
Wed Oct 26 14:50:09 CDT 2016


Module: wine
Branch: master
Commit: fc1485b86b8554cacb0066162feee094de799583
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fc1485b86b8554cacb0066162feee094de799583

Author: Aric Stewart <aric at codeweavers.com>
Date:   Wed Oct 26 12:46:12 2016 -0500

hid: Implement HidD_SetOutputReport.

Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hid/hid.spec          |  2 +-
 dlls/hid/hidd.c            |  6 ++++++
 dlls/hidclass.sys/device.c | 12 ++++++------
 include/ddk/hidsdi.h       |  1 +
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec
index 2131af2..91a83f6 100644
--- a/dlls/hid/hid.spec
+++ b/dlls/hid/hid.spec
@@ -17,7 +17,7 @@
 @ stub HidD_SetConfiguration
 @ stdcall HidD_SetFeature(long ptr long)
 @ stdcall HidD_SetNumInputBuffers(long long)
-@ stub HidD_SetOutputReport
+@ stdcall HidD_SetOutputReport(long ptr long)
 @ stdcall HidP_GetButtonCaps(long ptr ptr ptr)
 @ stdcall HidP_GetCaps(ptr ptr)
 @ stub HidP_GetData
diff --git a/dlls/hid/hidd.c b/dlls/hid/hidd.c
index 31220ec..99665dd 100644
--- a/dlls/hid/hidd.c
+++ b/dlls/hid/hidd.c
@@ -133,3 +133,9 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT
     *PreparsedData = data;
     return TRUE;
 }
+
+BOOLEAN WINAPI HidD_SetOutputReport(HANDLE HidDeviceObject, void *ReportBuffer, ULONG ReportBufferLength)
+{
+    TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
+    return DeviceIoControl(HidDeviceObject, IOCTL_HID_SET_OUTPUT_REPORT, ReportBuffer, ReportBufferLength, NULL, 0, NULL, NULL);
+}
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index 45f88eb..bc871b9 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -463,21 +463,20 @@ static NTSTATUS HID_get_feature(DEVICE_OBJECT *device, IRP *irp)
     return rc;
 }
 
-static NTSTATUS HID_set_feature(DEVICE_OBJECT *device, IRP *irp)
+static NTSTATUS HID_set_to_device(DEVICE_OBJECT *device, IRP *irp)
 {
-    IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
+    IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp);
     HID_XFER_PACKET packet;
     NTSTATUS rc;
 
-    irp->IoStatus.Information = 0;
-
     TRACE_(hid_report)("Device %p Buffer length %i Buffer %p\n", device, irpsp->Parameters.DeviceIoControl.InputBufferLength, irp->AssociatedIrp.SystemBuffer);
     packet.reportBuffer = irp->AssociatedIrp.SystemBuffer;
     packet.reportId = ((char*)irp->AssociatedIrp.SystemBuffer)[0];
     packet.reportBufferLen = irpsp->Parameters.DeviceIoControl.InputBufferLength;
     TRACE_(hid_report)("(id %i, len %i buffer %p)\n", packet.reportId, packet.reportBufferLen, packet.reportBuffer);
 
-    rc = call_minidriver(IOCTL_HID_SET_FEATURE, device, &packet, sizeof(packet), NULL, 0);
+    rc = call_minidriver(irpsp->Parameters.DeviceIoControl.IoControlCode,
+        device, NULL, 0, &packet, sizeof(packet));
 
     irp->IoStatus.u.Status = rc;
     if (irp->IoStatus.u.Status == STATUS_SUCCESS)
@@ -609,7 +608,8 @@ NTSTATUS WINAPI HID_Device_ioctl(DEVICE_OBJECT *device, IRP *irp)
             rc = HID_get_feature(device, irp);
             break;
         case IOCTL_HID_SET_FEATURE:
-            rc = HID_set_feature(device, irp);
+        case IOCTL_HID_SET_OUTPUT_REPORT:
+            rc = HID_set_to_device(device, irp);
             break;
         default:
         {
diff --git a/include/ddk/hidsdi.h b/include/ddk/hidsdi.h
index 75f2e3b..8b3b5a2 100644
--- a/include/ddk/hidsdi.h
+++ b/include/ddk/hidsdi.h
@@ -45,5 +45,6 @@ BOOLEAN WINAPI HidD_SetNumInputBuffers(HANDLE HidDeviceObject, ULONG NumberBuffe
 BOOLEAN WINAPI HidD_GetPreparsedData( HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData);
 BOOLEAN WINAPI HidD_FreePreparsedData(PHIDP_PREPARSED_DATA PreparsedData);
 BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr);
+BOOLEAN WINAPI HidD_SetOutputReport(HANDLE HidDeviceObject, void *ReportBuffer, ULONG ReportBufferLength);
 
 #endif  /* __WINE_HIDSDI_H */




More information about the wine-cvs mailing list