summaryrefslogtreecommitdiff
path: root/src/ws.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@openbsd.org>2009-11-23 21:11:27 +0000
committerMatthieu Herrb <matthieu@openbsd.org>2009-11-23 21:11:27 +0000
commit067f01383a9a23d36c15b07f688b768f366a83db (patch)
treec07ad66aaf6ce4d6c91fe57e4f05d19f33e1555c /src/ws.c
parentb0badf20a452a16bfb2cb4bbda325e7143785f4d (diff)
Fix previous for non tablet cases. the WSMOUSE_IO_GCALIBCOODS fails there.
Diffstat (limited to 'src/ws.c')
-rw-r--r--src/ws.c72
1 files changed, 42 insertions, 30 deletions
diff --git a/src/ws.c b/src/ws.c
index c515f9b..b6c6e84 100644
--- a/src/ws.c
+++ b/src/ws.c
@@ -272,11 +272,6 @@ wsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
}
}
priv->raw = xf86SetBoolOption(pInfo->options, "Raw", 0);
- if (priv->raw) {
- xf86Msg(X_CONFIG,
- "%s device will work in raw mode\n",
- dev->identifier);
- }
if (wsOpen(pInfo) != Success) {
goto fail;
}
@@ -286,10 +281,21 @@ wsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
}
if (priv->type == WSMOUSE_TYPE_TPANEL)
pInfo->type_name = XI_TOUCHSCREEN;
- else
+ else {
pInfo->type_name = XI_MOUSE;
-
+ if (priv->raw) {
+ xf86Msg(X_WARNING, "Device is not a touch panel,"
+ "ignoring 'Option \"Raw\"'\n");
+ priv->raw = 0;
+ }
+ }
if (priv->raw) {
+ xf86Msg(X_CONFIG,
+ "%s device will work in raw mode\n",
+ dev->identifier);
+ }
+
+ if (priv->type == WSMOUSE_TYPE_TPANEL && priv->raw) {
if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, &coords) != 0) {
xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n",
strerror(errno));
@@ -483,18 +489,22 @@ wsDeviceOn(DeviceIntPtr pWS)
strerror(errno));
return !Success;
}
- raw = priv->raw;
- if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, &coords) != 0) {
- xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n",
- strerror(errno));
- return !Success;
- }
- priv->raw = coords.samplelen;
- coords.samplelen = raw;
- if (ioctl(pInfo->fd, WSMOUSEIO_SCALIBCOORDS, &coords) != 0) {
- xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n",
- strerror(errno));
- return !Success;
+
+ if (priv->type == WSMOUSE_TYPE_TPANEL) {
+ /* Set raw mode */
+ raw = priv->raw;
+ if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, &coords) != 0) {
+ xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n",
+ strerror(errno));
+ return !Success;
+ }
+ priv->raw = coords.samplelen;
+ coords.samplelen = raw;
+ if (ioctl(pInfo->fd, WSMOUSEIO_SCALIBCOORDS, &coords) != 0) {
+ xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n",
+ strerror(errno));
+ return !Success;
+ }
}
priv->buffer = XisbNew(pInfo->fd,
sizeof(struct wscons_event) * NUMEVENTS);
@@ -517,18 +527,20 @@ wsDeviceOff(DeviceIntPtr pWS)
int raw;
DBG(1, ErrorF("WS DEVICE OFF\n"));
- raw = priv->raw;
- if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, &coords) != 0) {
- xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n",
- strerror(errno));
- }
- priv->raw = coords.samplelen;
- coords.samplelen = raw;
- if (ioctl(pInfo->fd, WSMOUSEIO_SCALIBCOORDS, &coords) != 0) {
- xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n",
- strerror(errno));
+ if (priv->type == WSMOUSE_TYPE_TPANEL) {
+ /* Restore raw mode */
+ raw = priv->raw;
+ if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, &coords) != 0) {
+ xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n",
+ strerror(errno));
+ }
+ priv->raw = coords.samplelen;
+ coords.samplelen = raw;
+ if (ioctl(pInfo->fd, WSMOUSEIO_SCALIBCOORDS, &coords) != 0) {
+ xf86Msg(X_ERROR, "GCALIBCOORS failed %s\n",
+ strerror(errno));
+ }
}
-
if (pInfo->fd >= 0) {
xf86RemoveEnabledDevice(pInfo);
wsClose(pInfo);