Aric Stewart : winebus.sys: Implement IOCTL_HID_SET_OUTPUT_REPORT for hidraw.

Alexandre Julliard julliard at winehq.org
Thu Oct 27 14:27:56 CDT 2016


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu Oct 27 08:37:41 2016 -0500

winebus.sys: Implement IOCTL_HID_SET_OUTPUT_REPORT for hidraw.

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/winebus.sys/bus.h      |  1 +
 dlls/winebus.sys/bus_udev.c | 18 ++++++++++++++++++
 dlls/winebus.sys/main.c     | 10 ++++++++++
 3 files changed, 29 insertions(+)

diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h
index dcebd96..18bebcf 100644
--- a/dlls/winebus.sys/bus.h
+++ b/dlls/winebus.sys/bus.h
@@ -26,6 +26,7 @@ typedef struct
     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);
 } 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 664ce58..be8e93f 100644
--- a/dlls/winebus.sys/bus_udev.c
+++ b/dlls/winebus.sys/bus_udev.c
@@ -284,12 +284,30 @@ static NTSTATUS begin_report_processing(DEVICE_OBJECT *device)
         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);
+    ssize_t rc;
+    rc = write(ext->device_fd, report, length);
+    if (rc > 0)
+    {
+        *written = rc;
+        return STATUS_SUCCESS;
+    }
+    else
+    {
+        *written = 0;
+        return STATUS_UNSUCCESSFUL;
+    }
+}
+
 static const platform_vtbl hidraw_vtbl =
 {
     compare_platform_device,
     hidraw_get_reportdescriptor,
     hidraw_get_string,
     begin_report_processing,
+    hidraw_set_output_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 29de07a..802122f 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -531,6 +531,16 @@ NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
             LeaveCriticalSection(&ext->report_cs);
             break;
         }
+        case IOCTL_HID_SET_OUTPUT_REPORT:
+        case IOCTL_HID_WRITE_REPORT:
+        {
+            HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer);
+            TRACE_(hid_report)("IOCTL_HID_WRITE_REPORT / IOCTL_HID_SET_OUTPUT_REPORT\n");
+            irp->IoStatus.u.Status = status = ext->vtbl->set_output_report(
+                device, packet->reportId, packet->reportBuffer,
+                packet->reportBufferLen, &irp->IoStatus.Information);
+            break;
+        }
         default:
         {
             ULONG code = irpsp->Parameters.DeviceIoControl.IoControlCode;




More information about the wine-cvs mailing list