diff options
author | Peter Osterlund <petero2@telia.com> | 2004-04-20 20:17:51 +0200 |
---|---|---|
committer | Peter Osterlund <petero2@telia.com> | 2006-04-09 04:02:14 +0200 |
commit | 3fa4224a123e60bb51f8144dc95d5034fd3152ba (patch) | |
tree | b88808f77d51e5f233a985abe378d3e12935dd03 /eventcomm.c | |
parent | 70d8648301d81c9035799818e4d4e616256df0d3 (diff) |
Properly implement EventQueryHardware().
Diffstat (limited to 'eventcomm.c')
-rw-r--r-- | eventcomm.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/eventcomm.c b/eventcomm.c index 0c299e2..a9b52c5 100644 --- a/eventcomm.c +++ b/eventcomm.c @@ -49,8 +49,30 @@ EventDeviceOffHook(LocalDevicePtr local) } static Bool +event_query_is_synaptics(int fd) +{ + struct input_id id; + int ret; + + SYSCALL(ret = ioctl(fd, EVIOCGID, &id)); + if (ret >= 0) { + if ((id.bustype == BUS_I8042) && + (id.vendor == 0x0002) && + (id.product == PSMOUSE_SYNAPTICS)) { + return TRUE; + } + } + return FALSE; +} + +static Bool EventQueryHardware(LocalDevicePtr local, struct SynapticsHwInfo *synhw) { + /* is the synaptics touchpad active? */ + if (!event_query_is_synaptics(local->fd)) + return FALSE; + + xf86Msg(X_PROBED, "%s synaptics touchpad found\n", local->name); return TRUE; } @@ -174,12 +196,12 @@ 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; + int fd = -1; + Bool is_synaptics; sprintf(fname, "%s/%s%d", DEV_INPUT_EVENT, EVENT_DEV_NAME, i); SYSCALL(fd = open(fname, O_RDONLY)); @@ -190,17 +212,13 @@ EventAutoDevProbe(LocalDevicePtr local) continue; } } - SYSCALL(ret = ioctl(fd, EVIOCGID, &id)); + is_synaptics = event_query_is_synaptics(fd); 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; - } + if (is_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", |