summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-04-02 14:12:26 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-04-16 10:25:02 +1000
commitb59a1a25dad4437e013ce8d3d65d4591c6f4ee4a (patch)
tree7c67d316b45c5d918b5d2210812d601519aacfc1
parent5138cd2ff47a1a28db82688b932cb1ecd618778f (diff)
Add option TypeName (#62831)
evdev tries to assign the right XI 1.x type-name based on various device capabilities. In some cases, that fails. e.g. the Mionix Naos 5000 mouse looks like a keyboard. And we assign a keyboard type in that case since there are plenty of keyboards that also advertise some axes or others. Add a new option TypeName to allow for system-wide configuration of such devices in a quirks file. This can also be used to address #55867 X.Org Bug 62831 <http://bugs.freedesktop.org/show_bug.cgi?id=62831> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--man/evdev.man6
-rw-r--r--src/evdev.c13
-rw-r--r--src/evdev.h2
3 files changed, 21 insertions, 0 deletions
diff --git a/man/evdev.man b/man/evdev.man
index 2709d7a..220dd13 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -220,6 +220,12 @@ is mapped to the negative Y axis motion and button number
.I N2
is mapped to the positive Y axis motion. Default: "4 5". Property:
"Evdev Wheel Emulation Axes".
+.TP 7
+.BI "Option \*qTypeName\*q \*q"type"\*q
+Specify the X Input 1.x type (see XListInputDevices(__libmansuffix__)).
+There is rarely a need to use this option, evdev will guess the device type
+based on the device's capabilities. This option is provided for devices that
+need quirks.
.SH SUPPORTED PROPERTIES
The following properties are provided by the
diff --git a/src/evdev.c b/src/evdev.c
index 052e9f0..94f5499 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2548,6 +2548,9 @@ EvdevUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
/* Release string allocated in EvdevOpenDevice. */
free(pEvdev->device);
pEvdev->device = NULL;
+
+ free(pEvdev->type_name);
+ pEvdev->type_name = NULL;
}
xf86DeleteInput(pInfo, flags);
}
@@ -2579,6 +2582,8 @@ EvdevAlloc(void)
pEvdev->rel_axis_map[0] = 0;
pEvdev->rel_axis_map[1] = 1;
+ pEvdev->type_name = NULL;
+
return pEvdev;
}
@@ -2623,6 +2628,14 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
goto error;
}
+ /* Overwrite type_name with custom-defined one (#62831).
+ Note: pInfo->type_name isn't freed so we need to manually do this
+ */
+ pEvdev->type_name = xf86SetStrOption(pInfo->options,
+ "TypeName",
+ pInfo->type_name);
+ pInfo->type_name = pEvdev->type_name;
+
EvdevAddDevice(pInfo);
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
diff --git a/src/evdev.h b/src/evdev.h
index 63c3bfa..6ae389c 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -251,6 +251,8 @@ typedef struct {
EventQueueRec queue[EVDEV_MAXQUEUE];
enum fkeymode fkeymode;
+
+ char *type_name;
} EvdevRec, *EvdevPtr;
/* Event posting functions */