summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/eventcomm.c18
-rw-r--r--src/synaptics.c2
-rw-r--r--src/synproto.h2
3 files changed, 19 insertions, 3 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 0215269..30007ab 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -504,7 +504,7 @@ EventReadDevDimensions(InputInfoPtr pInfo)
}
static Bool
-EventAutoDevProbe(InputInfoPtr pInfo)
+EventAutoDevProbe(InputInfoPtr pInfo, const char *device)
{
/* We are trying to find the right eventX device or fall back to
the psaux protocol and the given device from XF86Config */
@@ -512,6 +512,22 @@ EventAutoDevProbe(InputInfoPtr pInfo)
Bool touchpad_found = FALSE;
struct dirent **namelist;
+ if (device) {
+ int fd = -1;
+ SYSCALL(fd = open(device, O_RDONLY));
+ if (fd >= 0)
+ {
+ touchpad_found = event_query_is_touchpad(fd, TRUE);
+
+ SYSCALL(close(fd));
+ /* if a device is set and not a touchpad (or already grabbed),
+ * we must return FALSE. Otherwise, we'll add a device that
+ * wasn't requested for and repeat
+ * f5687a6741a19ef3081e7fd83ac55f6df8bcd5c2. */
+ return touchpad_found;
+ }
+ }
+
i = scandir(DEV_INPUT_EVENT, &namelist, EventDevOnly, alphasort);
if (i < 0) {
xf86Msg(X_ERROR, "Couldn't open %s\n", DEV_INPUT_EVENT);
diff --git a/src/synaptics.c b/src/synaptics.c
index 1233917..102a701 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -261,7 +261,7 @@ SetDeviceAndProtocol(InputInfoPtr pInfo)
for (i = 0; protocols[i].name; i++) {
if ((!device || !proto) &&
protocols[i].proto_ops->AutoDevProbe &&
- protocols[i].proto_ops->AutoDevProbe(pInfo))
+ protocols[i].proto_ops->AutoDevProbe(pInfo, device))
break;
else if (proto && !strcmp(proto, protocols[i].name))
break;
diff --git a/src/synproto.h b/src/synproto.h
index 251dc84..75f90e4 100644
--- a/src/synproto.h
+++ b/src/synproto.h
@@ -75,7 +75,7 @@ struct SynapticsProtocolOperations {
Bool (*QueryHardware)(InputInfoPtr pInfo);
Bool (*ReadHwState)(InputInfoPtr pInfo,
struct CommData *comm, struct SynapticsHwState *hwRet);
- Bool (*AutoDevProbe)(InputInfoPtr pInfo);
+ Bool (*AutoDevProbe)(InputInfoPtr pInfo, const char *device);
void (*ReadDevDimensions)(InputInfoPtr pInfo);
};