Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xf86-input-ws/dist/src Assume WSMOUSE_TYPE_TP...



details:   https://anonhg.NetBSD.org/xsrc/rev/2bd0c880f3bd
branches:  trunk
changeset: 10825:2bd0c880f3bd
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Dec 04 15:21:55 2021 +0000

description:
Assume WSMOUSE_TYPE_TPANEL if calibration data is present and the device
is in raw mode. The WSMOUSEIO_GTYPE ioctl may not return the correct type
on a wsmux if there is a mix of absolute and relative pointers attached.

Reverts "xf86-input-ws: Port auto-calibration bits from xf86-input-mouse".

Suggested by uwe@

diffstat:

 external/mit/xf86-input-ws/dist/src/ws.c |  64 ++++++--------------------------
 external/mit/xf86-input-ws/dist/src/ws.h |   3 -
 2 files changed, 12 insertions(+), 55 deletions(-)

diffs (121 lines):

diff -r 950ca8a4e239 -r 2bd0c880f3bd external/mit/xf86-input-ws/dist/src/ws.c
--- a/external/mit/xf86-input-ws/dist/src/ws.c  Fri Dec 03 19:53:23 2021 +0000
+++ b/external/mit/xf86-input-ws/dist/src/ws.c  Sat Dec 04 15:21:55 2021 +0000
@@ -219,10 +219,6 @@
                buttons_from = X_CONFIG;
        }
 
-       priv->autoCalibrate = xf86SetBoolOption(pInfo->options, "AutoCalibrate", TRUE);
-       xf86Msg(X_CONFIG, "%s: auto calibration %sabled\n",
-           pInfo->name, priv->autoCalibrate ? "en" : "dis"); 
-
        priv->screen_no = xf86SetIntOption(pInfo->options, "ScreenNo", 0);
        xf86Msg(X_CONFIG, "%s associated screen: %d\n",
            pInfo->name, priv->screen_no);
@@ -302,6 +298,18 @@
                pInfo->type_name = XI_TOUCHSCREEN;
        }
 
+       /*
+        * Force TPANEL type for muxes have have calibration data. A mux
+        * may have a mix of absolute and relative positioning devices,
+        * and we need to ensure that the xinput layer translates raw
+        * absolute position events for us.
+        */
+       if (priv->raw && priv->type != WSMOUSE_TYPE_TPANEL) {
+               xf86Msg(X_INFO, "%s detected calibration data in raw mode, "
+                   "using touch panel mode\n", pInfo->name);
+               priv->type = WSMOUSE_TYPE_TPANEL;
+       }
+
        if (priv->raw) {
                xf86Msg(X_CONFIG,
                    "%s device will work in raw mode\n",
@@ -606,45 +614,6 @@
 }
 
 static void
-wsAutoCalibrate(InputInfoPtr pInfo)
-{
-       WSDevicePtr priv;
-       int width, height;
-       struct wsmouse_calibcoords cal;
-
-       priv = pInfo->private;
-       width = screenInfo.screens[priv->screen_no]->width;
-       height = screenInfo.screens[priv->screen_no]->height;
-
-       if (width != priv->lastScreenWidth ||
-           height != priv->lastScreenHeight) {
-               if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, &cal) == 0 &&
-                   cal.minx != cal.maxy && cal.miny != cal.maxy) {
-
-                       xf86Msg(X_INFO, "%s: auto-calibrating abs pointer for %dx%d screen\n",
-                           pInfo->name, width, height);
-
-                       priv->min_x = cal.minx;
-                       priv->min_y = cal.miny;
-                       priv->max_x = cal.maxx;
-                       priv->max_y = cal.maxy;
-
-                       priv->translateAbs =
-                           cal.samplelen == WSMOUSE_CALIBCOORDS_RESET;
-               }
-               priv->lastScreenWidth = width;
-               priv->lastScreenHeight = height;
-       }
-}
-
-static int
-wsTranslate(InputInfoPtr pInfo, int scrRange,
-    int rawMin, int rawMax, int rawVal)
-{
-       return ((rawVal - rawMin) * scrRange) / (rawMax - rawMin);
-}
-
-static void
 wsReadInput(InputInfoPtr pInfo)
 {
        WSDevicePtr priv;
@@ -656,9 +625,6 @@
 
        priv = pInfo->private;
 
-       if (priv->autoCalibrate)
-               wsAutoCalibrate(pInfo);
-
        XisbBlockDuration(priv->buffer, -1);
        pBuf = (unsigned char *)eventList;
        n = 0;
@@ -704,18 +670,12 @@
                        if (event->value == 4095) 
                                break;
                        ax = event->value;
-                       if (priv->translateAbs)
-                               ax = wsTranslate(pInfo, priv->lastScreenWidth,
-                                   priv->min_x, priv->max_x, ax);
                        if (priv->inv_x)
                                ax = priv->max_x - ax + priv->min_x;
                        break;
                case WSCONS_EVENT_MOUSE_ABSOLUTE_Y:
                        DBG(4, ErrorF("Absolute Y %d\n", event->value));
                        ay = event->value;
-                       if (priv->translateAbs)
-                               ay = wsTranslate(pInfo, priv->lastScreenHeight,
-                                   priv->min_y, priv->max_y, ay);
                        if (priv->inv_y)
                                ay = priv->max_y - ay + priv->min_y;
                        break;
diff -r 950ca8a4e239 -r 2bd0c880f3bd external/mit/xf86-input-ws/dist/src/ws.h
--- a/external/mit/xf86-input-ws/dist/src/ws.h  Fri Dec 03 19:53:23 2021 +0000
+++ b/external/mit/xf86-input-ws/dist/src/ws.h  Sat Dec 04 15:21:55 2021 +0000
@@ -47,9 +47,6 @@
        int screen_no;
        int num, den, threshold; /* relative accel params */
        pointer buffer;
-       int autoCalibrate;
-       int translateAbs;
-       int lastScreenWidth, lastScreenHeight;
        int negativeZ, positiveZ; /* mappings for Z axis */
        int negativeW, positiveW; /* mappings for W axis */
        struct wsmouse_calibcoords coords; /* mirror of the kernel values */



Home | Main Index | Thread Index | Old Index