From: Sanskar Jaiswal <phoenix2810@protonmail.com> get_compatible_ids() only ever returns WINEBUS\WINE_COMP_HID (plus WINE_COMP_XINPUT for gamepads). hidapi looks for a "USB" compatible id on the parent PDO to recover a device's USB interface number, and without it treats every Wine-enumerated device as interface -1. Add the standard USB\VID_xxxx&PID_yyyy compatible id for devices on the USB bus, matching what Windows exposes. Signed-off-by: Sanskar Jaiswal <phoenix2810@protonmail.com> --- dlls/winebus.sys/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index c5d47994d3f..6edf15ef2be 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -258,8 +258,9 @@ static WCHAR *get_compatible_ids(DEVICE_OBJECT *device) { static const WCHAR xinput_compat[] = L"WINEBUS\\WINE_COMP_XINPUT"; static const WCHAR hid_compat[] = L"WINEBUS\\WINE_COMP_HID"; + static const WCHAR usb_compat_format[] = L"USB\\VID_%04X&PID_%04X"; struct device_extension *ext = (struct device_extension *)device->DeviceExtension; - WCHAR usb_compat[71]; + WCHAR usb_compat[93]; DWORD usb_len = 0, size; WCHAR *dst, *pos; @@ -281,6 +282,10 @@ static WCHAR *get_compatible_ids(DEVICE_OBJECT *device) L"USB\\Class_%02x", class) + 1; } + if (ext->desc.bus_type == BUS_TYPE_USB) + usb_len += swprintf(usb_compat + usb_len, ARRAY_SIZE(usb_compat) - usb_len, + usb_compat_format, ext->desc.vid, ext->desc.pid) + 1; + size = sizeof(hid_compat) + usb_len * sizeof(WCHAR); if (ext->desc.is_gamepad) size += sizeof(xinput_compat); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11745