From 20aa3410326073ba825c8c43c757e61556e4fe9f Mon Sep 17 00:00:00 2001 From: Vitaliy Margolen Date: Thu, 14 Apr 2011 08:08:01 -0600 Subject: [PATCH] dinput: Implement getting DIPROP_VIDPID property for evdev joystick driver. Fixes bug 26418. --- dlls/dinput/joystick_linuxinput.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 9b0c52c01de..c11edc78079 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -110,6 +110,8 @@ struct JoyDev { /* data returned by the EVIOCGABS() ioctl */ struct wine_input_absinfo axes[ABS_MAX]; + + WORD vendor_id, product_id; }; struct JoystickImpl @@ -187,6 +189,7 @@ static void find_joydevs(void) int no_ff_check = 0; int j; struct JoyDev *new_joydevs; + struct input_id device_id = {0}; snprintf(buf, sizeof(buf), EVDEVPREFIX"%d", i); @@ -282,6 +285,14 @@ static void find_joydevs(void) } } + if (ioctl(fd, EVIOCGID, &device_id) == -1) + WARN("ioct(EVIOCGBIT, EV_ABS) failed: %d %s\n", errno, strerror(errno)); + else + { + joydev.vendor_id = device_id.vendor; + joydev.product_id = device_id.product; + } + if (!have_joydevs) new_joydevs = HeapAlloc(GetProcessHeap(), 0, sizeof(struct JoyDev)); else @@ -946,6 +957,17 @@ static HRESULT WINAPI JoystickWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REF break; } + case (DWORD_PTR) DIPROP_VIDPID: + { + LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph; + + if (!This->joydev->product_id || !This->joydev->vendor_id) + return DIERR_UNSUPPORTED; + pd->dwData = MAKELONG(This->joydev->vendor_id, This->joydev->product_id); + TRACE("DIPROP_VIDPID(%08x)\n", pd->dwData); + break; + } + default: return JoystickWGenericImpl_GetProperty(iface, rguid, pdiph); }