diff options
author | Peter Osterlund <petero2@telia.com> | 2004-04-18 01:18:06 +0200 |
---|---|---|
committer | Peter Osterlund <petero2@telia.com> | 2006-04-09 04:02:06 +0200 |
commit | f574d42c776f0687cce5c15406ea870211058b39 (patch) | |
tree | a9ac2c5fa547997581b353587a8d01ad6f1d0fcb /eventcomm.c | |
parent | 7bd534c0e315a2b9bb3f549df0a30f113d21ee93 (diff) |
Moved autodev handling to the protocol specific files.
Diffstat (limited to 'eventcomm.c')
-rw-r--r-- | eventcomm.c | 41 |
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 }; |