Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winexinput.sys/main.c | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
diff --git a/dlls/winexinput.sys/main.c b/dlls/winexinput.sys/main.c index 3832c97ef26..667ce867269 100644 --- a/dlls/winexinput.sys/main.c +++ b/dlls/winexinput.sys/main.c @@ -32,6 +32,7 @@ #include "ddk/wdm.h" #include "ddk/hidport.h" #include "ddk/hidpddi.h" +#include "ddk/hidtypes.h"
#include "wine/asm.h" #include "wine/debug.h" @@ -314,17 +315,76 @@ static NTSTATUS try_complete_pending_read(DEVICE_OBJECT *device, IRP *irp) return IoCallDriver(fdo->bus_device, xinput_irp); }
+struct device_strings +{ + const WCHAR *id; + const WCHAR *product; +}; + +static const struct device_strings device_strings[] = +{ + { .id = L"VID_045E&PID_028E&IG_00", .product = L"Controller (XBOX 360 For Windows)" }, + { .id = L"VID_045E&PID_028F&IG_00", .product = L"Controller (XBOX 360 For Windows)" }, + { .id = L"VID_045E&PID_02D1&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_02DD&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_02E3&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_02EA&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_02FD&IG_00", .product = L"Controller (XBOX One For Windows)" }, + { .id = L"VID_045E&PID_0719&IG_00", .product = L"Controller (XBOX 360 For Windows)" }, +}; + +static const WCHAR *find_product_string(const WCHAR *device_id) +{ + const WCHAR *match_id = wcsrchr(device_id, '\') + 1; + DWORD i; + + for (i = 0; i < ARRAY_SIZE(device_strings); ++i) + if (!wcsicmp(device_strings[i].id, match_id)) + return device_strings[i].product; + + return NULL; +} + static NTSTATUS WINAPI gamepad_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) { IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp); ULONG output_len = stack->Parameters.DeviceIoControl.OutputBufferLength; ULONG code = stack->Parameters.DeviceIoControl.IoControlCode; struct func_device *fdo = fdo_from_DEVICE_OBJECT(device); + struct device *impl = impl_from_DEVICE_OBJECT(device); + const WCHAR *str = NULL;
TRACE("device %p, irp %p, code %#x, bus_device %p.\n", device, irp, code, fdo->bus_device);
switch (code) { + case IOCTL_HID_GET_STRING: + switch ((ULONG_PTR)stack->Parameters.DeviceIoControl.Type3InputBuffer) + { + case HID_STRING_ID_IPRODUCT: + str = find_product_string(impl->device_id); + break; + } + + if (!str) + { + IoSkipCurrentIrpStackLocation(irp); + return IoCallDriver(fdo->bus_device, irp); + } + + irp->IoStatus.Information = (wcslen(str) + 1) * sizeof(WCHAR); + if (output_len < irp->IoStatus.Information) + { + irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return STATUS_BUFFER_TOO_SMALL; + } + + wcscpy(irp->UserBuffer, str); + irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + case IOCTL_HID_GET_DEVICE_DESCRIPTOR: { HID_DESCRIPTOR *descriptor = (HID_DESCRIPTOR *)irp->UserBuffer;
This should now be handled by winexinput.sys.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/main.c | 93 +++++++---------------------------------- 1 file changed, 16 insertions(+), 77 deletions(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 42614b09f3a..53f6ac032e8 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -61,35 +61,25 @@ struct product_desc { WORD vid; WORD pid; - const WCHAR* manufacturer; - const WCHAR* product; - const WCHAR* serialnumber; };
#define VID_MICROSOFT 0x045e
-static const WCHAR xbox360_product_string[] = { - 'C','o','n','t','r','o','l','l','e','r',' ','(','X','B','O','X',' ','3','6','0',' ','F','o','r',' ','W','i','n','d','o','w','s',')',0 -}; - -static const WCHAR xboxone_product_string[] = { - 'C','o','n','t','r','o','l','l','e','r',' ','(','X','B','O','X',' ','O','n','e',' ','F','o','r',' ','W','i','n','d','o','w','s',')',0 -}; - -static const struct product_desc XBOX_CONTROLLERS[] = { - {VID_MICROSOFT, 0x0202, NULL, NULL, NULL}, /* Xbox Controller */ - {VID_MICROSOFT, 0x0285, NULL, NULL, NULL}, /* Xbox Controller S */ - {VID_MICROSOFT, 0x0289, NULL, NULL, NULL}, /* Xbox Controller S */ - {VID_MICROSOFT, 0x028e, NULL, xbox360_product_string, NULL}, /* Xbox360 Controller */ - {VID_MICROSOFT, 0x028f, NULL, xbox360_product_string, NULL}, /* Xbox360 Wireless Controller */ - {VID_MICROSOFT, 0x02d1, NULL, xboxone_product_string, NULL}, /* Xbox One Controller */ - {VID_MICROSOFT, 0x02dd, NULL, xboxone_product_string, NULL}, /* Xbox One Controller (Covert Forces/Firmware 2015) */ - {VID_MICROSOFT, 0x02e0, NULL, NULL, NULL}, /* Xbox One X Controller */ - {VID_MICROSOFT, 0x02e3, NULL, xboxone_product_string, NULL}, /* Xbox One Elite Controller */ - {VID_MICROSOFT, 0x02e6, NULL, NULL, NULL}, /* Wireless XBox Controller Dongle */ - {VID_MICROSOFT, 0x02ea, NULL, xboxone_product_string, NULL}, /* Xbox One S Controller */ - {VID_MICROSOFT, 0x02fd, NULL, xboxone_product_string, NULL}, /* Xbox One S Controller (Firmware 2017) */ - {VID_MICROSOFT, 0x0719, NULL, xbox360_product_string, NULL}, /* Xbox 360 Wireless Adapter */ +static const struct product_desc XBOX_CONTROLLERS[] = +{ + {VID_MICROSOFT, 0x0202}, /* Xbox Controller */ + {VID_MICROSOFT, 0x0285}, /* Xbox Controller S */ + {VID_MICROSOFT, 0x0289}, /* Xbox Controller S */ + {VID_MICROSOFT, 0x028e}, /* Xbox360 Controller */ + {VID_MICROSOFT, 0x028f}, /* Xbox360 Wireless Controller */ + {VID_MICROSOFT, 0x02d1}, /* Xbox One Controller */ + {VID_MICROSOFT, 0x02dd}, /* Xbox One Controller (Covert Forces/Firmware 2015) */ + {VID_MICROSOFT, 0x02e0}, /* Xbox One X Controller */ + {VID_MICROSOFT, 0x02e3}, /* Xbox One Elite Controller */ + {VID_MICROSOFT, 0x02e6}, /* Wireless XBox Controller Dongle */ + {VID_MICROSOFT, 0x02ea}, /* Xbox One S Controller */ + {VID_MICROSOFT, 0x02fd}, /* Xbox One S Controller (Firmware 2017) */ + {VID_MICROSOFT, 0x0719}, /* Xbox 360 Wireless Adapter */ };
static DRIVER_OBJECT *driver_obj; @@ -825,55 +815,6 @@ static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_l } }
-static NTSTATUS hid_get_native_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length) -{ - struct device_extension *ext = (struct device_extension *)device->DeviceExtension; - const struct product_desc *vendor_products; - unsigned int i, vendor_products_size = 0; - - if (ext->desc.vid == VID_MICROSOFT) - { - vendor_products = XBOX_CONTROLLERS; - vendor_products_size = ARRAY_SIZE(XBOX_CONTROLLERS); - } - - for (i = 0; i < vendor_products_size; i++) - { - if (ext->desc.pid == vendor_products[i].pid) - break; - } - - if (i >= vendor_products_size) - return STATUS_UNSUCCESSFUL; - - switch (index) - { - case HID_STRING_ID_IPRODUCT: - if (vendor_products[i].product) - { - strcpyW(buffer, vendor_products[i].product); - return STATUS_SUCCESS; - } - break; - case HID_STRING_ID_IMANUFACTURER: - if (vendor_products[i].manufacturer) - { - strcpyW(buffer, vendor_products[i].manufacturer); - return STATUS_SUCCESS; - } - break; - case HID_STRING_ID_ISERIALNUMBER: - if (vendor_products[i].serialnumber) - { - strcpyW(buffer, vendor_products[i].serialnumber); - return STATUS_SUCCESS; - } - break; - } - - return STATUS_UNSUCCESSFUL; -} - static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) { IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp); @@ -965,9 +906,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) DWORD index = (ULONG_PTR)irpsp->Parameters.DeviceIoControl.Type3InputBuffer; TRACE("IOCTL_HID_GET_STRING[%08x]\n", index);
- irp->IoStatus.Status = hid_get_native_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR)); - if (irp->IoStatus.Status != STATUS_SUCCESS) - irp->IoStatus.Status = unix_device_get_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR)); + irp->IoStatus.Status = unix_device_get_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR)); if (irp->IoStatus.Status == STATUS_SUCCESS) irp->IoStatus.Information = (strlenW((WCHAR *)irp->UserBuffer) + 1) * sizeof(WCHAR); break;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_iohid.c | 6 +++--- dlls/winebus.sys/bus_sdl.c | 4 +--- dlls/winebus.sys/bus_udev.c | 14 ++++++-------- dlls/winebus.sys/main.c | 25 ++++++++++++++++++++++++- dlls/winebus.sys/unixlib.c | 2 ++ dlls/winebus.sys/unixlib.h | 2 ++ 6 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 3df60a1b516..8969e59f252 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -193,9 +193,6 @@ static NTSTATUS iohid_device_get_string(struct unix_device *iface, DWORD index, case HID_STRING_ID_IPRODUCT: str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDProductKey)); break; - case HID_STRING_ID_IMANUFACTURER: - str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDManufacturerKey)); - break; case HID_STRING_ID_ISERIALNUMBER: str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDSerialNumberKey)); break; @@ -313,6 +310,9 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * } IOHIDDeviceScheduleWithRunLoop(IOHIDDevice, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDManufacturerKey)); + if (str) lstrcpynA(desc.manufacturer, str, sizeof(desc.manufacturer)); + if (IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad) || IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick)) { diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 80252e7e6b1..1f4098dcb40 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -528,9 +528,6 @@ static NTSTATUS sdl_device_get_string(struct unix_device *iface, DWORD index, WC else str = pSDL_JoystickName(ext->sdl_joystick); break; - case HID_STRING_ID_IMANUFACTURER: - str = "SDL"; - break; case HID_STRING_ID_ISERIALNUMBER: str = "000000"; break; @@ -739,6 +736,7 @@ static void sdl_add_device(unsigned int index) .busid = sdl_busidW, .input = -1, .serial = {'0','0','0','0',0}, + .manufacturer = {"SDL"}, }; struct platform_private *private; char guid_str[34]; diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 78e74de842a..b5b478b2d3d 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -677,9 +677,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index, case HID_STRING_ID_IPRODUCT: str = get_sysattr_string(usbdev, "product"); break; - case HID_STRING_ID_IMANUFACTURER: - str = get_sysattr_string(usbdev, "manufacturer"); - break; case HID_STRING_ID_ISERIALNUMBER: str = get_sysattr_string(usbdev, "serial"); break; @@ -702,8 +699,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index, str = strdupAtoW(buf); break; } - case HID_STRING_ID_IMANUFACTURER: - break; case HID_STRING_ID_ISERIALNUMBER: break; default: @@ -969,9 +964,6 @@ static NTSTATUS lnxev_device_get_string(struct unix_device *iface, DWORD index, case HID_STRING_ID_IPRODUCT: ioctl(ext->base.device_fd, EVIOCGNAME(sizeof(str)), str); break; - case HID_STRING_ID_IMANUFACTURER: - strcpy(str,"evdev"); - break; case HID_STRING_ID_ISERIALNUMBER: ioctl(ext->base.device_fd, EVIOCGUNIQ(sizeof(str)), str); break; @@ -1088,6 +1080,9 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy } } } + + if (!desc->manufacturer[0] && (tmp = udev_device_get_sysattr_value(dev, "manufacturer"))) + lstrcpynA(desc->manufacturer, tmp, sizeof(desc->manufacturer)); }
static void udev_add_device(struct udev_device *dev) @@ -1133,6 +1128,7 @@ static void udev_add_device(struct udev_device *dev) if (!strcmp(subsystem, "hidraw")) { desc.busid = hidraw_busidW; + if (!desc.manufacturer[0]) strcpy(desc.manufacturer, "hidraw"); } #ifdef HAS_PROPER_INPUT_HEADER else if (!strcmp(subsystem, "input")) @@ -1154,6 +1150,8 @@ static void udev_add_device(struct udev_device *dev) device_uid[0] = 0; if (ioctl(fd, EVIOCGUNIQ(254), device_uid) >= 0 && device_uid[0]) MultiByteToWideChar(CP_UNIXCP, 0, device_uid, -1, desc.serial, ARRAY_SIZE(desc.serial)); + + if (!desc.manufacturer[0]) strcpy(desc.manufacturer, "evdev"); } #endif
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 53f6ac032e8..2e355be0d99 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -111,6 +111,8 @@ struct device_extension struct device_desc desc; DWORD index;
+ WCHAR manufacturer[MAX_PATH]; + BYTE *last_report; DWORD last_report_size; BOOL last_report_read; @@ -364,6 +366,8 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni ext->buffer_size = 0; ext->unix_device = unix_device;
+ MultiByteToWideChar(CP_UNIXCP, 0, ext->desc.manufacturer, -1, ext->manufacturer, MAX_PATH); + InitializeListHead(&ext->irp_queue); InitializeCriticalSection(&ext->cs); ext->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs"); @@ -815,6 +819,23 @@ static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_l } }
+static NTSTATUS hid_get_device_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD buffer_len) +{ + struct device_extension *ext = (struct device_extension *)device->DeviceExtension; + DWORD len; + + switch (index) + { + case HID_STRING_ID_IMANUFACTURER: + len = (strlenW(ext->manufacturer) + 1) * sizeof(WCHAR); + if (len > buffer_len) return STATUS_BUFFER_TOO_SMALL; + else memcpy(buffer, ext->manufacturer, len); + return STATUS_SUCCESS; + } + + return STATUS_NOT_IMPLEMENTED; +} + static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) { IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp); @@ -906,7 +927,9 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) DWORD index = (ULONG_PTR)irpsp->Parameters.DeviceIoControl.Type3InputBuffer; TRACE("IOCTL_HID_GET_STRING[%08x]\n", index);
- irp->IoStatus.Status = unix_device_get_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR)); + irp->IoStatus.Status = hid_get_device_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len); + if (irp->IoStatus.Status != STATUS_SUCCESS) + irp->IoStatus.Status = unix_device_get_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR)); if (irp->IoStatus.Status == STATUS_SUCCESS) irp->IoStatus.Information = (strlenW((WCHAR *)irp->UserBuffer) + 1) * sizeof(WCHAR); break; diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 9b0ccc0ae1a..357a327ef37 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -119,6 +119,7 @@ static const struct device_desc mouse_device_desc = .busid = mouse_bus_id, .input = -1, .serial = {'0','0','0','0',0}, + .manufacturer = {"The Wine Project"}, }; static struct unix_device mouse_device = {.vtbl = &mouse_vtbl};
@@ -212,6 +213,7 @@ static const struct device_desc keyboard_device_desc = .busid = keyboard_bus_id, .input = -1, .serial = {'0','0','0','0',0}, + .manufacturer = {"The Wine Project"}, }; static struct unix_device keyboard_device = {.vtbl = &keyboard_vtbl};
diff --git a/dlls/winebus.sys/unixlib.h b/dlls/winebus.sys/unixlib.h index 85a03dd17ee..cedee183507 100644 --- a/dlls/winebus.sys/unixlib.h +++ b/dlls/winebus.sys/unixlib.h @@ -42,6 +42,8 @@ struct device_desc DWORD uid; WCHAR serial[256]; BOOL is_gamepad; + + char manufacturer[MAX_PATH]; };
struct sdl_bus_options
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_iohid.c | 5 ++--- dlls/winebus.sys/bus_sdl.c | 10 +++------- dlls/winebus.sys/bus_udev.c | 26 +++++++++++--------------- dlls/winebus.sys/main.c | 7 +++++++ dlls/winebus.sys/unixlib.c | 18 ++++-------------- dlls/winebus.sys/unixlib.h | 1 + 6 files changed, 28 insertions(+), 39 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 8969e59f252..274d104e1f4 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -190,9 +190,6 @@ static NTSTATUS iohid_device_get_string(struct unix_device *iface, DWORD index, CFStringRef str; switch (index) { - case HID_STRING_ID_IPRODUCT: - str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDProductKey)); - break; case HID_STRING_ID_ISERIALNUMBER: str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDSerialNumberKey)); break; @@ -312,6 +309,8 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDManufacturerKey)); if (str) lstrcpynA(desc.manufacturer, str, sizeof(desc.manufacturer)); + str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDProductKey)); + if (str) lstrcpynA(desc.product, str, sizeof(desc.product));
if (IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad) || IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick)) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 1f4098dcb40..534cb5da6f5 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -517,17 +517,10 @@ static NTSTATUS sdl_device_get_reportdescriptor(struct unix_device *iface, BYTE
static NTSTATUS sdl_device_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) { - struct platform_private *ext = impl_from_unix_device(iface); const char* str = NULL;
switch (index) { - case HID_STRING_ID_IPRODUCT: - if (ext->sdl_controller) - str = pSDL_GameControllerName(ext->sdl_controller); - else - str = pSDL_JoystickName(ext->sdl_joystick); - break; case HID_STRING_ID_ISERIALNUMBER: str = "000000"; break; @@ -755,6 +748,9 @@ static void sdl_add_device(unsigned int index) if (options.map_controllers && pSDL_IsGameController(index)) controller = pSDL_GameControllerOpen(index);
+ if (controller) lstrcpynA(desc.product, pSDL_GameControllerName(controller), sizeof(desc.product)); + else lstrcpynA(desc.product, pSDL_JoystickName(joystick), sizeof(desc.product)); + id = pSDL_JoystickInstanceID(joystick);
if (pSDL_JoystickGetProductVersion != NULL) { diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index b5b478b2d3d..859363512dc 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -674,9 +674,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index, { switch (index) { - case HID_STRING_ID_IPRODUCT: - str = get_sysattr_string(usbdev, "product"); - break; case HID_STRING_ID_ISERIALNUMBER: str = get_sysattr_string(usbdev, "serial"); break; @@ -690,15 +687,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index, #ifdef HAVE_LINUX_HIDRAW_H switch (index) { - case HID_STRING_ID_IPRODUCT: - { - char buf[MAX_PATH]; - if (ioctl(private->device_fd, HIDIOCGRAWNAME(MAX_PATH), buf) == -1) - WARN("ioctl(HIDIOCGRAWNAME) failed: %d %s\n", errno, strerror(errno)); - else - str = strdupAtoW(buf); - break; - } case HID_STRING_ID_ISERIALNUMBER: break; default: @@ -961,9 +949,6 @@ static NTSTATUS lnxev_device_get_string(struct unix_device *iface, DWORD index, str[0] = 0; switch (index) { - case HID_STRING_ID_IPRODUCT: - ioctl(ext->base.device_fd, EVIOCGNAME(sizeof(str)), str); - break; case HID_STRING_ID_ISERIALNUMBER: ioctl(ext->base.device_fd, EVIOCGUNIQ(sizeof(str)), str); break; @@ -1083,6 +1068,9 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy
if (!desc->manufacturer[0] && (tmp = udev_device_get_sysattr_value(dev, "manufacturer"))) lstrcpynA(desc->manufacturer, tmp, sizeof(desc->manufacturer)); + + if (!desc->product[0] && (tmp = udev_device_get_sysattr_value(dev, "product"))) + lstrcpynA(desc->product, tmp, sizeof(desc->product)); }
static void udev_add_device(struct udev_device *dev) @@ -1129,6 +1117,11 @@ static void udev_add_device(struct udev_device *dev) { desc.busid = hidraw_busidW; if (!desc.manufacturer[0]) strcpy(desc.manufacturer, "hidraw"); + +#ifdef HAVE_LINUX_HIDRAW_H + if (!desc.product[0] && ioctl(fd, HIDIOCGRAWNAME(sizeof(desc.product) - 1), desc.product) < 0) + desc.product[0] = 0; +#endif } #ifdef HAS_PROPER_INPUT_HEADER else if (!strcmp(subsystem, "input")) @@ -1152,6 +1145,9 @@ static void udev_add_device(struct udev_device *dev) MultiByteToWideChar(CP_UNIXCP, 0, device_uid, -1, desc.serial, ARRAY_SIZE(desc.serial));
if (!desc.manufacturer[0]) strcpy(desc.manufacturer, "evdev"); + + if (!desc.product[0] && ioctl(fd, EVIOCGNAME(sizeof(desc.product) - 1), desc.product) <= 0) + desc.product[0] = 0; } #endif
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 2e355be0d99..9da2c83082a 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -112,6 +112,7 @@ struct device_extension DWORD index;
WCHAR manufacturer[MAX_PATH]; + WCHAR product[MAX_PATH];
BYTE *last_report; DWORD last_report_size; @@ -367,6 +368,7 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni ext->unix_device = unix_device;
MultiByteToWideChar(CP_UNIXCP, 0, ext->desc.manufacturer, -1, ext->manufacturer, MAX_PATH); + MultiByteToWideChar(CP_UNIXCP, 0, ext->desc.product, -1, ext->product, MAX_PATH);
InitializeListHead(&ext->irp_queue); InitializeCriticalSection(&ext->cs); @@ -831,6 +833,11 @@ static NTSTATUS hid_get_device_string(DEVICE_OBJECT *device, DWORD index, WCHAR if (len > buffer_len) return STATUS_BUFFER_TOO_SMALL; else memcpy(buffer, ext->manufacturer, len); return STATUS_SUCCESS; + case HID_STRING_ID_IPRODUCT: + len = (strlenW(ext->product) + 1) * sizeof(WCHAR); + if (len > buffer_len) return STATUS_BUFFER_TOO_SMALL; + else memcpy(buffer, ext->product, len); + return STATUS_SUCCESS; }
return STATUS_NOT_IMPLEMENTED; diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 357a327ef37..80d42ab278d 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -71,13 +71,7 @@ static NTSTATUS mouse_get_report_descriptor(struct unix_device *iface, BYTE *buf
static NTSTATUS mouse_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) { - static const WCHAR nameW[] = {'W','i','n','e',' ','H','I','D',' ','m','o','u','s','e',0}; - if (index != HID_STRING_ID_IPRODUCT) - return STATUS_NOT_IMPLEMENTED; - if (length < ARRAY_SIZE(nameW)) - return STATUS_BUFFER_TOO_SMALL; - lstrcpyW(buffer, nameW); - return STATUS_SUCCESS; + return STATUS_NOT_IMPLEMENTED; }
static void mouse_set_output_report(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) @@ -120,6 +114,7 @@ static const struct device_desc mouse_device_desc = .input = -1, .serial = {'0','0','0','0',0}, .manufacturer = {"The Wine Project"}, + .product = {"Wine HID mouse"}, }; static struct unix_device mouse_device = {.vtbl = &mouse_vtbl};
@@ -165,13 +160,7 @@ static NTSTATUS keyboard_get_report_descriptor(struct unix_device *iface, BYTE *
static NTSTATUS keyboard_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) { - static const WCHAR nameW[] = {'W','i','n','e',' ','H','I','D',' ','k','e','y','b','o','a','r','d',0}; - if (index != HID_STRING_ID_IPRODUCT) - return STATUS_NOT_IMPLEMENTED; - if (length < ARRAY_SIZE(nameW)) - return STATUS_BUFFER_TOO_SMALL; - lstrcpyW(buffer, nameW); - return STATUS_SUCCESS; + return STATUS_NOT_IMPLEMENTED; }
static void keyboard_set_output_report(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) @@ -214,6 +203,7 @@ static const struct device_desc keyboard_device_desc = .input = -1, .serial = {'0','0','0','0',0}, .manufacturer = {"The Wine Project"}, + .product = {"Wine HID keyboard"}, }; static struct unix_device keyboard_device = {.vtbl = &keyboard_vtbl};
diff --git a/dlls/winebus.sys/unixlib.h b/dlls/winebus.sys/unixlib.h index cedee183507..142ef13f6b9 100644 --- a/dlls/winebus.sys/unixlib.h +++ b/dlls/winebus.sys/unixlib.h @@ -44,6 +44,7 @@ struct device_desc BOOL is_gamepad;
char manufacturer[MAX_PATH]; + char product[MAX_PATH]; };
struct sdl_bus_options
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_iohid.c | 9 +++---- dlls/winebus.sys/bus_sdl.c | 9 ++----- dlls/winebus.sys/bus_udev.c | 50 +++++++----------------------------- dlls/winebus.sys/main.c | 11 ++++++-- dlls/winebus.sys/unixlib.c | 4 +-- dlls/winebus.sys/unixlib.h | 6 ++--- 6 files changed, 28 insertions(+), 61 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 274d104e1f4..d80c7b3aad5 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -190,9 +190,6 @@ static NTSTATUS iohid_device_get_string(struct unix_device *iface, DWORD index, CFStringRef str; switch (index) { - case HID_STRING_ID_ISERIALNUMBER: - str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDSerialNumberKey)); - break; default: ERR("Unknown string index\n"); return STATUS_NOT_IMPLEMENTED; @@ -288,7 +285,7 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * { .busid = busidW, .input = -1, - .serial = {'0','0','0','0',0}, + .serialnumber = {"0000"}, }; struct platform_private *private; CFStringRef str = NULL; @@ -296,8 +293,6 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * desc.vid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDVendorIDKey))); desc.pid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDProductIDKey))); desc.version = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDVersionNumberKey))); - str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDSerialNumberKey)); - if (str) CFStringToWSTR(str, desc.serial, ARRAY_SIZE(desc.serial)); desc.uid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDLocationIDKey)));
if (IOHIDDeviceOpen(IOHIDDevice, 0) != kIOReturnSuccess) @@ -311,6 +306,8 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * if (str) lstrcpynA(desc.manufacturer, str, sizeof(desc.manufacturer)); str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDProductKey)); if (str) lstrcpynA(desc.product, str, sizeof(desc.product)); + str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDSerialNumberKey)); + if (str) lstrcpynA(desc.serialnumber, str, sizeof(desc.serialnumber));
if (IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad) || IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick)) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 534cb5da6f5..78c22f0e139 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -521,9 +521,6 @@ static NTSTATUS sdl_device_get_string(struct unix_device *iface, DWORD index, WC
switch (index) { - case HID_STRING_ID_ISERIALNUMBER: - str = "000000"; - break; default: ERR("Unhandled string index %i\n", index); } @@ -728,11 +725,10 @@ static void sdl_add_device(unsigned int index) { .busid = sdl_busidW, .input = -1, - .serial = {'0','0','0','0',0}, .manufacturer = {"SDL"}, + .serialnumber = {"0000"}, }; struct platform_private *private; - char guid_str[34];
SDL_Joystick* joystick; SDL_JoystickID id; @@ -766,8 +762,7 @@ static void sdl_add_device(unsigned int index) }
guid = pSDL_JoystickGetGUID(joystick); - pSDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); - MultiByteToWideChar(CP_ACP, 0, guid_str, -1, desc.serial, sizeof(guid_str)); + pSDL_JoystickGetGUIDString(guid, desc.serialnumber, sizeof(desc.serialnumber));
if (controller) desc.is_gamepad = TRUE; else diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 859363512dc..6cfd4e7fb38 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -554,28 +554,6 @@ static BOOL set_report_from_event(struct wine_input_private *ext, struct input_e } #endif
-static inline WCHAR *strdupAtoW(const char *src) -{ - WCHAR *dst; - DWORD len; - if (!src) return NULL; - len = MultiByteToWideChar(CP_UNIXCP, 0, src, -1, NULL, 0); - if ((dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) - MultiByteToWideChar(CP_UNIXCP, 0, src, -1, dst, len); - return dst; -} - -static WCHAR *get_sysattr_string(struct udev_device *dev, const char *sysattr) -{ - const char *attr = udev_device_get_sysattr_value(dev, sysattr); - if (!attr) - { - WARN("Could not get %s from device\n", sysattr); - return NULL; - } - return strdupAtoW(attr); -} - static void hidraw_device_destroy(struct unix_device *iface) { struct platform_private *private = impl_from_unix_device(iface); @@ -674,9 +652,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index, { switch (index) { - case HID_STRING_ID_ISERIALNUMBER: - str = get_sysattr_string(usbdev, "serial"); - break; default: ERR("Unhandled string index %08x\n", index); return STATUS_NOT_IMPLEMENTED; @@ -687,8 +662,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index, #ifdef HAVE_LINUX_HIDRAW_H switch (index) { - case HID_STRING_ID_ISERIALNUMBER: - break; default: ERR("Unhandled string index %08x\n", index); return STATUS_NOT_IMPLEMENTED; @@ -943,15 +916,11 @@ static NTSTATUS lnxev_device_get_report_descriptor(struct unix_device *iface, BY
static NTSTATUS lnxev_device_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) { - struct wine_input_private *ext = input_impl_from_unix_device(iface); char str[255];
str[0] = 0; switch (index) { - case HID_STRING_ID_ISERIALNUMBER: - ioctl(ext->base.device_fd, EVIOCGUNIQ(sizeof(str)), str); - break; default: ERR("Unhandled string index %i\n", index); } @@ -1027,7 +996,6 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy { struct udev_device *parent = NULL; const char *ptr, *next, *tmp; - char buffer[256]; DWORD bus = 0;
if (!(parent = udev_device_get_parent_with_subsystem_devtype(dev, subsystem, NULL))) return; @@ -1042,8 +1010,8 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy
if (!strncmp(ptr, "HID_UNIQ=", 9)) { - if (sscanf(ptr, "HID_UNIQ=%256s\n", buffer) != 1 || !*buffer) continue; - if (!desc->serial[0]) MultiByteToWideChar(CP_UNIXCP, 0, buffer, -1, desc->serial, ARRAY_SIZE(desc->serial)); + if (desc->serialnumber[0]) continue; + sscanf(ptr, "HID_UNIQ=%256s\n", desc->serialnumber); } if (!strncmp(ptr, "HID_PHYS=", 9) || !strncmp(ptr, "PHYS="", 6)) { @@ -1071,11 +1039,13 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy
if (!desc->product[0] && (tmp = udev_device_get_sysattr_value(dev, "product"))) lstrcpynA(desc->product, tmp, sizeof(desc->product)); + + if (!desc->serialnumber[0] && (tmp = udev_device_get_sysattr_value(dev, "serial"))) + lstrcpynA(desc->serialnumber, tmp, sizeof(desc->serialnumber)); }
static void udev_add_device(struct udev_device *dev) { - static const WCHAR base_serial[] = {'0','0','0','0',0}; struct device_desc desc = { .input = -1, @@ -1127,7 +1097,6 @@ static void udev_add_device(struct udev_device *dev) else if (!strcmp(subsystem, "input")) { struct input_id device_id = {0}; - char device_uid[255];
desc.busid = lnxev_busidW;
@@ -1140,18 +1109,17 @@ static void udev_add_device(struct udev_device *dev) desc.version = device_id.version; }
- device_uid[0] = 0; - if (ioctl(fd, EVIOCGUNIQ(254), device_uid) >= 0 && device_uid[0]) - MultiByteToWideChar(CP_UNIXCP, 0, device_uid, -1, desc.serial, ARRAY_SIZE(desc.serial)); - if (!desc.manufacturer[0]) strcpy(desc.manufacturer, "evdev");
if (!desc.product[0] && ioctl(fd, EVIOCGNAME(sizeof(desc.product) - 1), desc.product) <= 0) desc.product[0] = 0; + + if (!desc.serialnumber[0] && ioctl(fd, EVIOCGUNIQ(sizeof(desc.serialnumber)), desc.serialnumber) < 0) + desc.serialnumber[0] = 0; } #endif
- if (!desc.serial[0]) lstrcpyW(desc.serial, base_serial); + if (!desc.serialnumber[0]) strcpy(desc.serialnumber, "0000");
if (is_xbox_gamepad(desc.vid, desc.pid)) desc.is_gamepad = TRUE; diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 9da2c83082a..79367989c63 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -113,6 +113,7 @@ struct device_extension
WCHAR manufacturer[MAX_PATH]; WCHAR product[MAX_PATH]; + WCHAR serialnumber[MAX_PATH];
BYTE *last_report; DWORD last_report_size; @@ -253,11 +254,11 @@ static WCHAR *get_instance_id(DEVICE_OBJECT *device) { static const WCHAR formatW[] = {'%','i','&','%','s','&','%','x','&','%','i',0}; struct device_extension *ext = (struct device_extension *)device->DeviceExtension; - DWORD len = strlenW(ext->desc.serial) + 33; + DWORD len = strlenW(ext->serialnumber) + 33; WCHAR *dst;
if ((dst = ExAllocatePool(PagedPool, len * sizeof(WCHAR)))) - sprintfW(dst, formatW, ext->desc.version, ext->desc.serial, ext->desc.uid, ext->index); + sprintfW(dst, formatW, ext->desc.version, ext->serialnumber, ext->desc.uid, ext->index);
return dst; } @@ -369,6 +370,7 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni
MultiByteToWideChar(CP_UNIXCP, 0, ext->desc.manufacturer, -1, ext->manufacturer, MAX_PATH); MultiByteToWideChar(CP_UNIXCP, 0, ext->desc.product, -1, ext->product, MAX_PATH); + MultiByteToWideChar(CP_UNIXCP, 0, ext->desc.serialnumber, -1, ext->serialnumber, MAX_PATH);
InitializeListHead(&ext->irp_queue); InitializeCriticalSection(&ext->cs); @@ -838,6 +840,11 @@ static NTSTATUS hid_get_device_string(DEVICE_OBJECT *device, DWORD index, WCHAR if (len > buffer_len) return STATUS_BUFFER_TOO_SMALL; else memcpy(buffer, ext->product, len); return STATUS_SUCCESS; + case HID_STRING_ID_ISERIALNUMBER: + len = (strlenW(ext->serialnumber) + 1) * sizeof(WCHAR); + if (len > buffer_len) return STATUS_BUFFER_TOO_SMALL; + else memcpy(buffer, ext->serialnumber, len); + return STATUS_SUCCESS; }
return STATUS_NOT_IMPLEMENTED; diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 80d42ab278d..dc0f3e4e608 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -112,9 +112,9 @@ static const struct device_desc mouse_device_desc = { .busid = mouse_bus_id, .input = -1, - .serial = {'0','0','0','0',0}, .manufacturer = {"The Wine Project"}, .product = {"Wine HID mouse"}, + .serialnumber = {"0000"}, }; static struct unix_device mouse_device = {.vtbl = &mouse_vtbl};
@@ -201,9 +201,9 @@ static const struct device_desc keyboard_device_desc = { .busid = keyboard_bus_id, .input = -1, - .serial = {'0','0','0','0',0}, .manufacturer = {"The Wine Project"}, .product = {"Wine HID keyboard"}, + .serialnumber = {"0000"}, }; static struct unix_device keyboard_device = {.vtbl = &keyboard_vtbl};
diff --git a/dlls/winebus.sys/unixlib.h b/dlls/winebus.sys/unixlib.h index 142ef13f6b9..164a7984938 100644 --- a/dlls/winebus.sys/unixlib.h +++ b/dlls/winebus.sys/unixlib.h @@ -40,11 +40,11 @@ struct device_desc DWORD version; DWORD input; DWORD uid; - WCHAR serial[256]; BOOL is_gamepad;
char manufacturer[MAX_PATH]; char product[MAX_PATH]; + char serialnumber[MAX_PATH]; };
struct sdl_bus_options @@ -161,9 +161,9 @@ extern const unixlib_entry_t __wine_unix_call_funcs[] DECLSPEC_HIDDEN; static inline const char *debugstr_device_desc(struct device_desc *desc) { if (!desc) return "(null)"; - return wine_dbg_sprintf("{busid %s, vid %04x, pid %04x, version %04x, input %d, uid %08x, serial %s, is_gamepad %u}", + return wine_dbg_sprintf("{busid %s, vid %04x, pid %04x, version %04x, input %d, uid %08x, is_gamepad %u}", debugstr_w(desc->busid), desc->vid, desc->pid, desc->version, - desc->input, desc->uid, debugstr_w(desc->serial), desc->is_gamepad); + desc->input, desc->uid, desc->is_gamepad); }
#endif /* __WINEBUS_UNIXLIB_H */
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_iohid.c | 27 -------------- dlls/winebus.sys/bus_sdl.c | 19 ---------- dlls/winebus.sys/bus_udev.c | 65 --------------------------------- dlls/winebus.sys/main.c | 15 -------- dlls/winebus.sys/unix_private.h | 1 - dlls/winebus.sys/unixlib.c | 20 ---------- dlls/winebus.sys/unixlib.h | 9 ----- 7 files changed, 156 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index d80c7b3aad5..18e318f7789 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -184,32 +184,6 @@ static NTSTATUS iohid_device_get_report_descriptor(struct unix_device *iface, BY return STATUS_SUCCESS; }
-static NTSTATUS iohid_device_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) -{ - struct platform_private *private = impl_from_unix_device(iface); - CFStringRef str; - switch (index) - { - default: - ERR("Unknown string index\n"); - return STATUS_NOT_IMPLEMENTED; - } - - if (str) - { - if (length < CFStringGetLength(str) + 1) - return STATUS_BUFFER_TOO_SMALL; - CFStringToWSTR(str, buffer, length); - } - else - { - if (!length) return STATUS_BUFFER_TOO_SMALL; - buffer[0] = 0; - } - - return STATUS_SUCCESS; -} - static void iohid_device_set_output_report(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { IOReturn result; @@ -273,7 +247,6 @@ static const struct unix_device_vtbl iohid_device_vtbl = iohid_device_compare, iohid_device_start, iohid_device_get_report_descriptor, - iohid_device_get_string, iohid_device_set_output_report, iohid_device_get_feature_report, iohid_device_set_feature_report, diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 78c22f0e139..8d6df3e1f13 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -515,24 +515,6 @@ static NTSTATUS sdl_device_get_reportdescriptor(struct unix_device *iface, BYTE return STATUS_SUCCESS; }
-static NTSTATUS sdl_device_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) -{ - const char* str = NULL; - - switch (index) - { - default: - ERR("Unhandled string index %i\n", index); - } - - if (str && str[0]) - MultiByteToWideChar(CP_ACP, 0, str, -1, buffer, length); - else - buffer[0] = 0; - - return STATUS_SUCCESS; -} - static void sdl_device_set_output_report(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { struct platform_private *ext = impl_from_unix_device(iface); @@ -598,7 +580,6 @@ static const struct unix_device_vtbl sdl_device_vtbl = sdl_device_compare, sdl_device_start, sdl_device_get_reportdescriptor, - sdl_device_get_string, sdl_device_set_output_report, sdl_device_get_feature_report, sdl_device_set_feature_report, diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 6cfd4e7fb38..3010e50ce98 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -641,54 +641,6 @@ static NTSTATUS hidraw_device_get_report_descriptor(struct unix_device *iface, B #endif }
-static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) -{ - struct udev_device *usbdev; - struct platform_private *private = impl_from_unix_device(iface); - WCHAR *str = NULL; - - usbdev = udev_device_get_parent_with_subsystem_devtype(private->udev_device, "usb", "usb_device"); - if (usbdev) - { - switch (index) - { - default: - ERR("Unhandled string index %08x\n", index); - return STATUS_NOT_IMPLEMENTED; - } - } - else - { -#ifdef HAVE_LINUX_HIDRAW_H - switch (index) - { - default: - ERR("Unhandled string index %08x\n", index); - return STATUS_NOT_IMPLEMENTED; - } -#else - return STATUS_NOT_IMPLEMENTED; -#endif - } - - if (!str) - { - if (!length) return STATUS_BUFFER_TOO_SMALL; - buffer[0] = 0; - return STATUS_SUCCESS; - } - - if (length <= strlenW(str)) - { - HeapFree(GetProcessHeap(), 0, str); - return STATUS_BUFFER_TOO_SMALL; - } - - strcpyW(buffer, str); - HeapFree(GetProcessHeap(), 0, str); - return STATUS_SUCCESS; -} - static DWORD CALLBACK device_report_thread(void *args) { DEVICE_OBJECT *device = (DEVICE_OBJECT*)args; @@ -829,7 +781,6 @@ static const struct unix_device_vtbl hidraw_device_vtbl = udev_device_compare, hidraw_device_start, hidraw_device_get_report_descriptor, - hidraw_device_get_string, hidraw_device_set_output_report, hidraw_device_get_feature_report, hidraw_device_set_feature_report, @@ -914,21 +865,6 @@ static NTSTATUS lnxev_device_get_report_descriptor(struct unix_device *iface, BY return STATUS_SUCCESS; }
-static NTSTATUS lnxev_device_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) -{ - char str[255]; - - str[0] = 0; - switch (index) - { - default: - ERR("Unhandled string index %i\n", index); - } - - MultiByteToWideChar(CP_ACP, 0, str, -1, buffer, length); - return STATUS_SUCCESS; -} - static DWORD CALLBACK lnxev_device_report_thread(void *args) { DEVICE_OBJECT *device = (DEVICE_OBJECT*)args; @@ -985,7 +921,6 @@ static const struct unix_device_vtbl lnxev_device_vtbl = udev_device_compare, lnxev_device_start, lnxev_device_get_report_descriptor, - lnxev_device_get_string, lnxev_device_set_output_report, lnxev_device_get_feature_report, lnxev_device_set_feature_report, diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 79367989c63..c6d7859dcfa 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -181,19 +181,6 @@ static NTSTATUS unix_device_get_report_descriptor(DEVICE_OBJECT *device, BYTE *b return winebus_call(device_get_report_descriptor, ¶ms); }
-static NTSTATUS unix_device_get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length) -{ - struct device_extension *ext = (struct device_extension *)device->DeviceExtension; - struct device_string_params params = - { - .iface = ext->unix_device, - .index = index, - .buffer = buffer, - .length = length, - }; - return winebus_call(device_get_string, ¶ms); -} - static void unix_device_set_output_report(DEVICE_OBJECT *device, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { struct device_extension *ext = (struct device_extension *)device->DeviceExtension; @@ -942,8 +929,6 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) TRACE("IOCTL_HID_GET_STRING[%08x]\n", index);
irp->IoStatus.Status = hid_get_device_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len); - if (irp->IoStatus.Status != STATUS_SUCCESS) - irp->IoStatus.Status = unix_device_get_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR)); if (irp->IoStatus.Status == STATUS_SUCCESS) irp->IoStatus.Information = (strlenW((WCHAR *)irp->UserBuffer) + 1) * sizeof(WCHAR); break; diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 5cf999fff86..767c9335114 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -35,7 +35,6 @@ struct unix_device_vtbl int (*compare)(struct unix_device *iface, void *platform_dev); NTSTATUS (*start)(struct unix_device *iface, DEVICE_OBJECT *device); NTSTATUS (*get_report_descriptor)(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length); - NTSTATUS (*get_string)(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length); void (*set_output_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); void (*get_feature_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); void (*set_feature_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index dc0f3e4e608..67efb794e4f 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -69,11 +69,6 @@ static NTSTATUS mouse_get_report_descriptor(struct unix_device *iface, BYTE *buf return STATUS_SUCCESS; }
-static NTSTATUS mouse_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) -{ - return STATUS_NOT_IMPLEMENTED; -} - static void mouse_set_output_report(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { FIXME("id %u, stub!\n", packet->reportId); @@ -101,7 +96,6 @@ static const struct unix_device_vtbl mouse_vtbl = mouse_compare, mouse_start, mouse_get_report_descriptor, - mouse_get_string, mouse_set_output_report, mouse_get_feature_report, mouse_set_feature_report, @@ -158,11 +152,6 @@ static NTSTATUS keyboard_get_report_descriptor(struct unix_device *iface, BYTE * return STATUS_SUCCESS; }
-static NTSTATUS keyboard_get_string(struct unix_device *iface, DWORD index, WCHAR *buffer, DWORD length) -{ - return STATUS_NOT_IMPLEMENTED; -} - static void keyboard_set_output_report(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io) { FIXME("id %u, stub!\n", packet->reportId); @@ -190,7 +179,6 @@ static const struct unix_device_vtbl keyboard_vtbl = keyboard_compare, keyboard_start, keyboard_get_report_descriptor, - keyboard_get_string, keyboard_set_output_report, keyboard_get_feature_report, keyboard_set_feature_report, @@ -243,13 +231,6 @@ static NTSTATUS unix_device_get_report_descriptor(void *args) return iface->vtbl->get_report_descriptor(iface, params->buffer, params->length, params->out_length); }
-static NTSTATUS unix_device_get_string(void *args) -{ - struct device_string_params *params = args; - struct unix_device *iface = params->iface; - return iface->vtbl->get_string(iface, params->index, params->buffer, params->length); -} - static NTSTATUS unix_device_set_output_report(void *args) { struct device_report_params *params = args; @@ -291,7 +272,6 @@ const unixlib_entry_t __wine_unix_call_funcs[] = unix_device_compare, unix_device_start, unix_device_get_report_descriptor, - unix_device_get_string, unix_device_set_output_report, unix_device_get_feature_report, unix_device_set_feature_report, diff --git a/dlls/winebus.sys/unixlib.h b/dlls/winebus.sys/unixlib.h index 164a7984938..12df5d8bd5b 100644 --- a/dlls/winebus.sys/unixlib.h +++ b/dlls/winebus.sys/unixlib.h @@ -118,14 +118,6 @@ struct device_descriptor_params DWORD *out_length; };
-struct device_string_params -{ - struct unix_device *iface; - DWORD index; - WCHAR *buffer; - DWORD length; -}; - struct device_report_params { struct unix_device *iface; @@ -150,7 +142,6 @@ enum unix_funcs device_compare, device_start, device_get_report_descriptor, - device_get_string, device_set_output_report, device_get_feature_report, device_set_feature_report,