Commit 8bfb1256 authored by Lucas Zawacki's avatar Lucas Zawacki Committed by Alexandre Julliard

dinput: Append driver name to dinput joysticks on Linux.

parent 79ba36ae
......@@ -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)
{
......
......@@ -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)
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment