tech-kern archive

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

Mostly working uts(4) touchscreen



Touchscreen of my new notebook was reporting "touchscreen has no
range report" which turned out to be Z-axis related and I thought
that always passing z=0 might solve the problem.

And it indeed mostly solved the problem. I can move the mouse and
click inside the modular Xorg. The only problem is that the mouse
moves two times faster to the right and 4-5 faster to the bottom.

Basically, it works like if I had a small touchpad at the top left
corner of my screen.

If I'm in a text mode and run 'wsmoused -d /dev/wsmouse1', the
cursor doesn't move at all but it flashes (in the center of the
screen) when I touch the screen.

I wonder where should I make the last change to restore 1:1 mappings
between movements and screen pixels?

Excerpts from dmesg, xorg.conf and my patch to dev/usb/uts.c are below.

Alex

Section "InputDevice"
        Identifier  "Mouse1"
        Driver      "mouse"
        Option      "Protocol" "wsmouse"
        Option      "Device" "/dev/wsmouse1"
        Option      "ZAxisMapping" "X"
EndSection

$ dmesg |grep uhid
uhidev0 at uhub2 port 3 configuration 1 interface 0
uhidev0: eGalax Inc. eGalaxTouch EXC7910-1031-12.00.03, rev 2.00/31.04, addr 5, 
iclass 3/1
uhidev0: 7 report ids
uhid0 at uhidev0 reportid 3: input=63, output=63, feature=0
uhid1 at uhidev0 reportid 5: input=0, output=0, feature=2
uts0 at uhidev0 reportid 6wsmouse1 at uts0 mux 0
uhid2 at uhidev0 reportid 7: input=0, output=0, feature=256
uhidev0 at uhub2 port 3 configuration 1 interface 0
uhidev0: eGalax Inc. eGalaxTouch EXC7910-1031-12.00.03, rev 2.00/31.04, addr 5, 
iclass 3/1
uhidev0: 7 report ids
uhid0 at uhidev0 reportid 3: input=63, output=63, feature=0
uhid1 at uhidev0 reportid 5: input=0, output=0, feature=2
uts0 at uhidev0 reportid 6wsmouse1 at uts0 mux 0
uhid2 at uhidev0 reportid 7: input=0, output=0, feature=256
uhidev0 at uhub2 port 3 configuration 1 interface 0
uhidev0: eGalax Inc. eGalaxTouch EXC7910-1031-12.00.03, rev 2.00/31.04, addr 4, 
iclass 3/1
uhidev0: 7 report ids
uhid0 at uhidev0 reportid 3: input=63, output=63, feature=0
uhid1 at uhidev0 reportid 5: input=0, output=0, feature=2
uts0 at uhidev0 reportid 6wsmouse1 at uts0 mux 0
uhid2 at uhidev0 reportid 7: input=0, output=0, feature=256

$ cvs diff -u sys/dev/usb/uts.c
Index: sys/dev/usb/uts.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/uts.c,v
retrieving revision 1.3
diff -p -u -u -r1.3 uts.c
--- sys/dev/usb/uts.c   5 Jan 2013 23:34:21 -0000       1.3
+++ sys/dev/usb/uts.c   4 Jan 2014 23:08:03 -0000
@@ -75,6 +75,7 @@ struct uts_softc {
        struct hid_location sc_loc_btn;

        int sc_enabled;
+       int z_enabled;

        int flags;              /* device configuration */
 #define UTS_ABS                0x1     /* absolute position */
@@ -199,13 +200,9 @@ uts_attach(device_t parent, device_t sel
                return;
        }

-       /* requires HID usage Digitizer:In_Range */
-       if (!hid_locate(desc, size, HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE),
-               uha->reportid, hid_input, &sc->sc_loc_z, &flags)) {
-               aprint_error_dev(sc->sc_hdev.sc_dev,
-                   "touchscreen has no range report\n");
-               return;
-       }
+       sc->z_enabled = hid_locate(desc, size,
+           HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE),
+           uha->reportid, hid_input, &sc->sc_loc_z, &flags);

        /* multi-touch support would need HUD_CONTACTID and HUD_CONTACTMAX */

@@ -215,8 +212,12 @@ uts_attach(device_t parent, device_t sel
                sc->sc_loc_x.pos, sc->sc_loc_x.size));
        DPRINTF(("uts_attach: Y\t%d/%d\n",
                sc->sc_loc_y.pos, sc->sc_loc_y.size));
-       DPRINTF(("uts_attach: Z\t%d/%d\n",
-               sc->sc_loc_z.pos, sc->sc_loc_z.size));
+       if (sc->z_enabled) {
+               DPRINTF(("uts_attach: Z\t%d/%d\n",
+                       sc->sc_loc_z.pos, sc->sc_loc_z.size));
+       } else {
+               DPRINTF(("uts_attach: Z disabled\n"));
+       }
 #endif

        a.accessops = &uts_accessops;
@@ -368,7 +369,7 @@ uts_intr(struct uhidev *addr, void *ibuf
        } else
                dy = -hid_get_data(ibuf, &sc->sc_loc_y);

-       dz = hid_get_data(ibuf, &sc->sc_loc_z);
+       dz = sc->z_enabled ? hid_get_data(ibuf, &sc->sc_loc_z) : 0;

        if (hid_get_data(ibuf, &sc->sc_loc_btn))
                buttons |= 1;


Home | Main Index | Thread Index | Old Index