Created
August 23, 2012 21:58
-
-
Save lfzawacki/3442507 to your computer and use it in GitHub Desktop.
joystick names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d035e950c47861a94215a2508ef5f27247b89c0e Mon Sep 17 00:00:00 2001 | |
From: Lucas Zawacki <lfzawacki@gmail.com> | |
Date: Mon, 18 Jun 2012 14:48:50 -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 5afd07c..9a24157 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 3cab015..808ebf4 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) | |
); | |
-- | |
1.7.9.5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment