static Bool WSConsIsTouchpad(InputInfoPtr pInfo, const char *device) { int wsmouse_type, fd = -1; Bool rc = FALSE; if (device) { #ifndef X_PRIVSEP fd = open(device, O_RDWR); #else fd = priv_open_device(device); #endif } else fd = pInfo->fd; if (fd < 0) return FALSE; if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) == -1) { xf86IDrvMsg(pInfo, X_ERROR, "cannot get mouse type\n"); goto out; } if (wsmouse_type == WSMOUSE_TYPE_SYNAPTICS || wsmouse_type == WSMOUSE_TYPE_SYNAP_SBTN || wsmouse_type == WSMOUSE_TYPE_ALPS || wsmouse_type == WSMOUSE_TYPE_ELANTECH) rc = TRUE; out: if (device) close(fd); return rc; }
static Bool WSConsReadEvent(InputInfoPtr pInfo, struct wscons_event *event) { Bool rc = TRUE; ssize_t len; len = read(pInfo->fd, event, sizeof(struct wscons_event)); if (len <= 0) { if (errno != EAGAIN) xf86IDrvMsg(pInfo, X_ERROR, "read error %s\n", strerror(errno)); rc = FALSE; } else if (len % sizeof(struct wscons_event)) { xf86IDrvMsg(pInfo, X_ERROR, "read error, invalid number of bytes\n"); rc = FALSE; } return rc; }
static Bool WSConsDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) { int wsmouse_mode = WSMOUSE_NATIVE; if (ioctl(pInfo->fd, WSMOUSEIO_SETMODE, &wsmouse_mode) == -1) { xf86IDrvMsg(pInfo, X_ERROR, "cannot set native mode\n"); return FALSE; } return TRUE; }
static Bool WSConsDeviceOffHook(InputInfoPtr pInfo) { int wsmouse_mode = WSMOUSE_COMPAT; if (ioctl(pInfo->fd, WSMOUSEIO_SETMODE, &wsmouse_mode) == -1) { xf86IDrvMsg(pInfo, X_ERROR, "cannot set compat mode\n"); return FALSE; } return TRUE; }