Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/hid/hidd.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/dlls/hid/hidd.c b/dlls/hid/hidd.c index 4b703ca536..ca14c4f571 100644 --- a/dlls/hid/hidd.c +++ b/dlls/hid/hidd.c @@ -38,15 +38,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(hid);
-static BOOL sync_ioctl(HANDLE file, DWORD code, void *in_buf, DWORD in_len, void *out_buf, DWORD out_len, DWORD *ret_len) +static BOOL sync_ioctl(HANDLE file, DWORD code, void *in_buf, DWORD in_len, void *out_buf, DWORD out_len) { OVERLAPPED ovl = {0}; + DWORD ret_len; BOOL ret;
ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - ret = DeviceIoControl(file, code, in_buf, in_len, out_buf, out_len, ret_len, &ovl); + ret = DeviceIoControl(file, code, in_buf, in_len, out_buf, out_len, &ret_len, &ovl); if (!ret && GetLastError() == ERROR_IO_PENDING) - ret = GetOverlappedResult(file, &ovl, ret_len, TRUE); + ret = GetOverlappedResult(file, &ovl, &ret_len, TRUE); CloseHandle(ovl.hEvent); return ret; } @@ -65,7 +66,7 @@ BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr)
TRACE("(%p %p)\n", HidDeviceObject, Attr);
- ret = sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, &info, sizeof(HID_COLLECTION_INFORMATION), NULL); + ret = sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, &info, sizeof(HID_COLLECTION_INFORMATION));
if (ret) { @@ -79,7 +80,7 @@ BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr) BOOLEAN WINAPI HidD_GetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength); - return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_FEATURE, NULL, 0, ReportBuffer, ReportBufferLength, NULL); + return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_FEATURE, NULL, 0, ReportBuffer, ReportBufferLength); }
void WINAPI HidD_GetHidGuid(LPGUID guid) @@ -91,43 +92,43 @@ void WINAPI HidD_GetHidGuid(LPGUID guid) BOOLEAN WINAPI HidD_GetInputReport(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength); - return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_INPUT_REPORT, NULL, 0, ReportBuffer, ReportBufferLength, NULL); + return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_INPUT_REPORT, NULL, 0, ReportBuffer, ReportBufferLength); }
BOOLEAN WINAPI HidD_GetManufacturerString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength); - return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_MANUFACTURER_STRING, NULL, 0, Buffer, BufferLength, NULL); + return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_MANUFACTURER_STRING, NULL, 0, Buffer, BufferLength); }
BOOLEAN WINAPI HidD_GetNumInputBuffers(HANDLE HidDeviceObject, ULONG *NumberBuffers) { TRACE("(%p %p)\n", HidDeviceObject, NumberBuffers); - return sync_ioctl(HidDeviceObject, IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS, NULL, 0, NumberBuffers, sizeof(*NumberBuffers), NULL); + return sync_ioctl(HidDeviceObject, IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS, NULL, 0, NumberBuffers, sizeof(*NumberBuffers)); }
BOOLEAN WINAPI HidD_SetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength); - return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_FEATURE, ReportBuffer, ReportBufferLength, NULL, 0, NULL); + return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_FEATURE, ReportBuffer, ReportBufferLength, NULL, 0); }
BOOLEAN WINAPI HidD_SetNumInputBuffers(HANDLE HidDeviceObject, ULONG NumberBuffers) { TRACE("(%p %i)\n", HidDeviceObject, NumberBuffers); - return sync_ioctl(HidDeviceObject, IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS, &NumberBuffers, sizeof(NumberBuffers), NULL, 0, NULL); + return sync_ioctl(HidDeviceObject, IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS, &NumberBuffers, sizeof(NumberBuffers), NULL, 0); }
BOOLEAN WINAPI HidD_GetProductString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength); - return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_PRODUCT_STRING, NULL, 0, Buffer, BufferLength, NULL); + return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_PRODUCT_STRING, NULL, 0, Buffer, BufferLength); }
BOOLEAN WINAPI HidD_GetSerialNumberString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength); - return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_SERIALNUMBER_STRING, NULL, 0, Buffer, BufferLength, NULL); + return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_SERIALNUMBER_STRING, NULL, 0, Buffer, BufferLength); }
BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData) @@ -137,14 +138,12 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT
TRACE("(%p %p)\n", HidDeviceObject, PreparsedData);
- if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, - &info, sizeof(HID_COLLECTION_INFORMATION), NULL)) + if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, &info, sizeof(info))) return FALSE;
if (!(data = HeapAlloc(GetProcessHeap(), 0, info.DescriptorSize))) return FALSE;
- if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_DESCRIPTOR, NULL, 0, - data, info.DescriptorSize, NULL)) + if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_DESCRIPTOR, NULL, 0, data, info.DescriptorSize)) { HeapFree( GetProcessHeap(), 0, data ); return FALSE; @@ -156,5 +155,5 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT BOOLEAN WINAPI HidD_SetOutputReport(HANDLE HidDeviceObject, void *ReportBuffer, ULONG ReportBufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength); - return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_OUTPUT_REPORT, ReportBuffer, ReportBufferLength, NULL, 0, NULL); + return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_OUTPUT_REPORT, ReportBuffer, ReportBufferLength, NULL, 0); }
This partially reverts 164517fe575564daa44f74cc3bc4a6bbdd7d3f3d. The manufacturer, product, and serial string attributes are not exposed by the HID device on Linux, but by its parent USB device.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46711 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winebus.sys/bus_udev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 1f671cf568..99753d603e 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -674,23 +674,23 @@ static NTSTATUS hidraw_get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer,
static NTSTATUS hidraw_get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length) { - struct udev_device *hiddev; + struct udev_device *usbdev; struct platform_private *private = impl_from_DEVICE_OBJECT(device); WCHAR *str = NULL;
- hiddev = udev_device_get_parent_with_subsystem_devtype(private->udev_device, "hid", NULL); - if (hiddev) + usbdev = udev_device_get_parent_with_subsystem_devtype(private->udev_device, "usb", "usb_device"); + if (usbdev) { switch (index) { case HID_STRING_ID_IPRODUCT: - str = get_sysattr_string(hiddev, "product"); + str = get_sysattr_string(usbdev, "product"); break; case HID_STRING_ID_IMANUFACTURER: - str = get_sysattr_string(hiddev, "manufacturer"); + str = get_sysattr_string(usbdev, "manufacturer"); break; case HID_STRING_ID_ISERIALNUMBER: - str = get_sysattr_string(hiddev, "serial"); + str = get_sysattr_string(usbdev, "serial"); break; default: ERR("Unhandled string index %08x\n", index);
On 3/29/19 4:18 PM, Zebediah Figura wrote:
This partially reverts 164517fe575564daa44f74cc3bc4a6bbdd7d3f3d. The manufacturer, product, and serial string attributes are not exposed by the HID device on Linux, but by its parent USB device.
Does this work with bluetooth devices? I know I did some revision to this code in order to support bluetooth devices in the past.
-aric
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46711 Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/winebus.sys/bus_udev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 1f671cf568..99753d603e 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -674,23 +674,23 @@ static NTSTATUS hidraw_get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer,
static NTSTATUS hidraw_get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length) {
- struct udev_device *hiddev;
- struct udev_device *usbdev; struct platform_private *private = impl_from_DEVICE_OBJECT(device); WCHAR *str = NULL;
- hiddev = udev_device_get_parent_with_subsystem_devtype(private->udev_device, "hid", NULL);
- if (hiddev)
- usbdev = udev_device_get_parent_with_subsystem_devtype(private->udev_device, "usb", "usb_device");
- if (usbdev) { switch (index) { case HID_STRING_ID_IPRODUCT:
str = get_sysattr_string(hiddev, "product");
str = get_sysattr_string(usbdev, "product"); break; case HID_STRING_ID_IMANUFACTURER:
str = get_sysattr_string(hiddev, "manufacturer");
str = get_sysattr_string(usbdev, "manufacturer"); break; case HID_STRING_ID_ISERIALNUMBER:
str = get_sysattr_string(hiddev, "serial");
str = get_sysattr_string(usbdev, "serial"); break; default: ERR("Unhandled string index %08x\n", index);
On 4/1/19 7:25 AM, Aric Stewart wrote:
On 3/29/19 4:18 PM, Zebediah Figura wrote:
This partially reverts 164517fe575564daa44f74cc3bc4a6bbdd7d3f3d. The manufacturer, product, and serial string attributes are not exposed by the HID device on Linux, but by its parent USB device.
Does this work with bluetooth devices? I know I did some revision to this code in order to support bluetooth devices in the past.
-aric
I don't have any bluetooth devices to test with, but just from looking at the Linux driver sources, I don't see how the current code could work with bluetooth devices, so it can't be making things worse. The hid driver doesn't expose any of those attributes.
Signed-off-by: Aric Stewart aric@codeweavers.com
On 3/29/19 4:18 PM, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/hid/hidd.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/dlls/hid/hidd.c b/dlls/hid/hidd.c index 4b703ca536..ca14c4f571 100644 --- a/dlls/hid/hidd.c +++ b/dlls/hid/hidd.c @@ -38,15 +38,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(hid);
-static BOOL sync_ioctl(HANDLE file, DWORD code, void *in_buf, DWORD in_len, void *out_buf, DWORD out_len, DWORD *ret_len) +static BOOL sync_ioctl(HANDLE file, DWORD code, void *in_buf, DWORD in_len, void *out_buf, DWORD out_len) { OVERLAPPED ovl = {0};
DWORD ret_len; BOOL ret;
ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
- ret = DeviceIoControl(file, code, in_buf, in_len, out_buf, out_len, ret_len, &ovl);
- ret = DeviceIoControl(file, code, in_buf, in_len, out_buf, out_len, &ret_len, &ovl); if (!ret && GetLastError() == ERROR_IO_PENDING)
ret = GetOverlappedResult(file, &ovl, ret_len, TRUE);
}ret = GetOverlappedResult(file, &ovl, &ret_len, TRUE); CloseHandle(ovl.hEvent); return ret;
@@ -65,7 +66,7 @@ BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr)
TRACE("(%p %p)\n", HidDeviceObject, Attr);
- ret = sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, &info, sizeof(HID_COLLECTION_INFORMATION), NULL);
ret = sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, &info, sizeof(HID_COLLECTION_INFORMATION));
if (ret) {
@@ -79,7 +80,7 @@ BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr) BOOLEAN WINAPI HidD_GetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
- return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_FEATURE, NULL, 0, ReportBuffer, ReportBufferLength, NULL);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_FEATURE, NULL, 0, ReportBuffer, ReportBufferLength); }
void WINAPI HidD_GetHidGuid(LPGUID guid)
@@ -91,43 +92,43 @@ void WINAPI HidD_GetHidGuid(LPGUID guid) BOOLEAN WINAPI HidD_GetInputReport(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
- return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_INPUT_REPORT, NULL, 0, ReportBuffer, ReportBufferLength, NULL);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_INPUT_REPORT, NULL, 0, ReportBuffer, ReportBufferLength); }
BOOLEAN WINAPI HidD_GetManufacturerString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength);
- return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_MANUFACTURER_STRING, NULL, 0, Buffer, BufferLength, NULL);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_MANUFACTURER_STRING, NULL, 0, Buffer, BufferLength); }
BOOLEAN WINAPI HidD_GetNumInputBuffers(HANDLE HidDeviceObject, ULONG *NumberBuffers) { TRACE("(%p %p)\n", HidDeviceObject, NumberBuffers);
- return sync_ioctl(HidDeviceObject, IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS, NULL, 0, NumberBuffers, sizeof(*NumberBuffers), NULL);
return sync_ioctl(HidDeviceObject, IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS, NULL, 0, NumberBuffers, sizeof(*NumberBuffers)); }
BOOLEAN WINAPI HidD_SetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
- return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_FEATURE, ReportBuffer, ReportBufferLength, NULL, 0, NULL);
return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_FEATURE, ReportBuffer, ReportBufferLength, NULL, 0); }
BOOLEAN WINAPI HidD_SetNumInputBuffers(HANDLE HidDeviceObject, ULONG NumberBuffers) { TRACE("(%p %i)\n", HidDeviceObject, NumberBuffers);
- return sync_ioctl(HidDeviceObject, IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS, &NumberBuffers, sizeof(NumberBuffers), NULL, 0, NULL);
return sync_ioctl(HidDeviceObject, IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS, &NumberBuffers, sizeof(NumberBuffers), NULL, 0); }
BOOLEAN WINAPI HidD_GetProductString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength);
- return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_PRODUCT_STRING, NULL, 0, Buffer, BufferLength, NULL);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_PRODUCT_STRING, NULL, 0, Buffer, BufferLength); }
BOOLEAN WINAPI HidD_GetSerialNumberString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength);
- return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_SERIALNUMBER_STRING, NULL, 0, Buffer, BufferLength, NULL);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_SERIALNUMBER_STRING, NULL, 0, Buffer, BufferLength); }
BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData)
@@ -137,14 +138,12 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT
TRACE("(%p %p)\n", HidDeviceObject, PreparsedData);
- if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0,
&info, sizeof(HID_COLLECTION_INFORMATION), NULL))
if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, &info, sizeof(info))) return FALSE;
if (!(data = HeapAlloc(GetProcessHeap(), 0, info.DescriptorSize))) return FALSE;
- if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_DESCRIPTOR, NULL, 0,
data, info.DescriptorSize, NULL))
- if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_DESCRIPTOR, NULL, 0, data, info.DescriptorSize)) { HeapFree( GetProcessHeap(), 0, data ); return FALSE;
@@ -156,5 +155,5 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT BOOLEAN WINAPI HidD_SetOutputReport(HANDLE HidDeviceObject, void *ReportBuffer, ULONG ReportBufferLength) { TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
- return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_OUTPUT_REPORT, ReportBuffer, ReportBufferLength, NULL, 0, NULL);
- return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_OUTPUT_REPORT, ReportBuffer, ReportBufferLength, NULL, 0); }