summaryrefslogtreecommitdiff
path: root/eventcomm.c
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2004-04-18 01:18:06 +0200
committerPeter Osterlund <petero2@telia.com>2006-04-09 04:02:06 +0200
commitf574d42c776f0687cce5c15406ea870211058b39 (patch)
treea9ac2c5fa547997581b353587a8d01ad6f1d0fcb /eventcomm.c
parent7bd534c0e315a2b9bb3f549df0a30f113d21ee93 (diff)
Moved autodev handling to the protocol specific files.
Diffstat (limited to 'eventcomm.c')
-rw-r--r--eventcomm.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/eventcomm.c b/eventcomm.c
index b7e9a25..93834cc 100644
--- a/eventcomm.c
+++ b/eventcomm.c
@@ -170,9 +170,48 @@ EventReadHwState(LocalDevicePtr local, struct synapticshw *synhw,
return FALSE;
}
+static Bool EventAutoDevProbe(LocalDevicePtr local)
+{
+ /* We are trying to find the right eventX device or fall back to
+ the psaux protocol and the given device from XF86Config */
+ int fd = -1;
+ int i;
+ for (i = 0; ; i++) {
+ char fname[64];
+ struct input_id id;
+ int ret;
+
+ sprintf(fname, "%s/%s%d", DEV_INPUT_EVENT, EVENT_DEV_NAME, i);
+ SYSCALL(fd = open(fname, O_RDONLY));
+ if (fd < 0) {
+ if (errno == ENOENT) {
+ break;
+ } else {
+ continue;
+ }
+ }
+ SYSCALL(ret = ioctl(fd, EVIOCGID, &id));
+ SYSCALL(close(fd));
+ if (ret >= 0) {
+ if ((id.bustype == BUS_I8042) &&
+ (id.vendor == 0x0002) &&
+ (id.product == PSMOUSE_SYNAPTICS)) {
+ xf86Msg(X_PROBED, "%s auto-dev sets Synaptics Device to %s\n",
+ local->name, fname);
+ xf86ReplaceStrOption(local->options, "Device", fname);
+ return TRUE;
+ }
+ }
+ }
+ ErrorF("%s no synaptics event device found (checked %d nodes)\n",
+ local->name, i + 1);
+ return FALSE;
+}
+
struct SynapticsProtocolOperations event_proto_operations = {
EventDeviceOnHook,
EventDeviceOffHook,
EventQueryHardware,
- EventReadHwState
+ EventReadHwState,
+ EventAutoDevProbe
};