From 8bfb12561746b7cc56323348b5d35c4d0f2260d8 Mon Sep 17 00:00:00 2001 From: Lucas Zawacki Date: Fri, 24 Aug 2012 04:55:06 -0300 Subject: [PATCH] dinput: Append driver name to dinput joysticks on Linux. --- dlls/dinput/joystick_linux.c | 7 ++++++- dlls/dinput/joystick_linuxinput.c | 15 ++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 5afd07c626d..9a24157b48a 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -71,6 +71,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); #define JOYDEV_NEW "/dev/input/js" #define JOYDEV_OLD "/dev/js" +#define JOYDEVDRIVER " (js)" struct JoyDev { @@ -150,9 +151,13 @@ static INT find_joystick_devices(void) strcpy(joydev.name, "Wine Joystick"); #if defined(JSIOCGNAME) - if (ioctl(fd, JSIOCGNAME(sizeof(joydev.name)), joydev.name) < 0) + if (ioctl(fd, JSIOCGNAME(sizeof(joydev.name) - sizeof(JOYDEVDRIVER)), joydev.name) < 0) WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", joydev.device, strerror(errno)); #endif + + /* Append driver name */ + strcat(joydev.name, JOYDEVDRIVER); + #ifdef JSIOCGAXES if (ioctl(fd, JSIOCGAXES, &joydev.axis_count) < 0) { diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 3cab015bd13..808ebf4d4b9 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -67,7 +67,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); #ifdef HAVE_CORRECT_LINUXINPUT_H -#define EVDEVPREFIX "/dev/input/event" +#define EVDEVPREFIX "/dev/input/event" +#define EVDEVDRIVER " (event)" /* Wine joystick driver object instances */ #define WINE_JOYSTICK_MAX_AXES 8 @@ -241,15 +242,19 @@ static void find_joydevs(void) buf[MAX_PATH - 1] = 0; if (ioctl(fd, EVIOCGNAME(MAX_PATH - 1), buf) != -1 && - (joydev.name = HeapAlloc(GetProcessHeap(), 0, strlen(buf) + 1))) + (joydev.name = HeapAlloc(GetProcessHeap(), 0, strlen(buf) + strlen(EVDEVDRIVER) + 1))) + { strcpy(joydev.name, buf); + /* Append driver name */ + strcat(joydev.name, EVDEVDRIVER); + } else joydev.name = joydev.device; - joydev.guid = DInput_Wine_Joystick_Base_GUID; - joydev.guid.Data3 += have_joydevs; + joydev.guid = DInput_Wine_Joystick_Base_GUID; + joydev.guid.Data3 += have_joydevs; - TRACE("Found a joystick on %s: %s (%s)\n", + TRACE("Found a joystick on %s: %s (%s)\n", joydev.device, joydev.name, debugstr_guid(&joydev.guid) );