Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Nov 2000 10:15:51 -0800 (PST)
From:      david@catwhisker.org
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        david@catwhisker.org
Subject:   bin/23081: Touchpad on NEC Versa laptop is unusable as mouse button.
Message-ID:  <200011241815.eAOIFpN58218@dhcp-133.catwhisker.org>

next in thread | raw e-mail | index | archive | help

>Number:         23081
>Category:       bin
>Synopsis:       Touchpad on NEC Versa laptop is unusable as mouse button.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 24 10:20:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     David Wolfskill
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Just me, at home
>Environment:

NEC Versa 6030X; 4.2-S as of 22 Nov 2000 (AM).

I happen to be using moused with the flags "-m 1=4 -m 2=1 -p /dev/psm0 -t auto"
(because the Versa has but 2 actual buttons, and I wanted to map those to
effective buttons 2 & 3, while using the "touchpad tap" as mouse button 1).

But the problem occurs regardless of moused.

I also had psm0 flags of 0x0900.

>Description:

The effect is that the "depressed/released" state of the "button" that
corresponds to the touchpad (button 4) is reversed from what is actually
going on in reality.  This makes the "button 4" capability of the touchpad
very difficult to use, especially if it's mapped (as I did) to "effective
button 1" (via moused).

>How-To-Repeat:

* Get an NEC Versa.  (It may be specific to the 6030X model, though I
  would find that surprising.)

* Install FreeBSD on it -- anything from the 3.x series up through 4.2-S
  will exhibit the problem.  (I had mentioned the problem earlier, but the
  circumvention I had used was truly gross -- a couple of hard-coded
  logic-reversals in psm.c.)

* Run moused with the above flags.

* Run XF86Setup, and try to get (effective) mouse button 1 to do anything
  sane.  You will find that with nothing touching the pad, buttons, or
  keyboard, button 1 will be seen as "depressed", and if you tap the
  touchpad, the button will be released... momentarily.

>Fix:

Well, the above-referenced logic switch makes the NEC Versa work, but it
breaks everything else, which is Really Bad.

So I survived for a while by custom-hacking psm.c just for kernels for
the NEC.  But over the long holiday (Thanksgiving here in the US), I
wanted to experiment with Ambrisko's Aironet encryption patches, so I
upgraded 3 laptops to 4.2-S (with Doug's patches -- unrelated to the
topic of the PR, but that's why I was doing it).  And all went Really Well
until I actually tried to use the NEC Versa -- I had forgotten about the
psm.c hack.

So I decided to do something moiderately constructive, and try to cobble
up a patch that would actually fix the problem.  I saw that there was a
psm config flag bit left in the low-order 16 bits, so the patch I cobbled
up has made use of it; I gave it the name "PSM_CONFOG_SYNCLOGICREV"; I
also hacked up a patch for the psm (4) man page:


===================================================================
RCS file: src/sys/isa/RCS/psm.c,v
retrieving revision 1.1
diff -u -r1.1 src/sys/isa/psm.c
--- src/sys/isa/psm.c	2000/11/23 14:00:15	1.1
+++ src/sys/isa/psm.c	2000/11/23 21:50:21
@@ -178,6 +178,7 @@
 #define PSM_CONFIG_IGNPORTERROR	0x1000  /* ignore error in aux port test */
 #define PSM_CONFIG_HOOKRESUME	0x2000	/* hook the system resume event */
 #define PSM_CONFIG_INITAFTERSUSPEND 0x4000 /* init the device at the resume event */
+#define PSM_CONFIG_SYNCLOGICREV 0x8000 /* logic reversal for sync bit */
 
 #define PSM_CONFIG_FLAGS	(PSM_CONFIG_RESOLUTION 		\
 				    | PSM_CONFIG_ACCEL		\
@@ -187,7 +188,8 @@
 				    | PSM_CONFIG_FORCETAP	\
 				    | PSM_CONFIG_IGNPORTERROR	\
 				    | PSM_CONFIG_HOOKRESUME	\
-				    | PSM_CONFIG_INITAFTERSUSPEND)
+				    | PSM_CONFIG_INITAFTERSUSPEND	\
+				    | PSM_CONFIG_SYNCLOGICREV)
 
 /* other flags (flags) */
 #define PSM_FLAGS_FINGERDOWN	0x0001 /* VersaPad finger down */
@@ -1920,7 +1922,7 @@
         ms.button = butmap[c & MOUSE_PS2_BUTTONS];
 	/* `tapping' action */
 	if (sc->config & PSM_CONFIG_FORCETAP)
-	    ms.button |= ((c & MOUSE_PS2_TAP)) ? 0 : MOUSE_BUTTON4DOWN;
+	    ms.button |= ((c & MOUSE_PS2_TAP) ^ ((sc->config & PSM_CONFIG_SYNCLOGICREV) ? MOUSE_PS2_TAP : 0)) ? 0 : MOUSE_BUTTON4DOWN;
 
 	switch (sc->hw.model) {
 
@@ -2052,7 +2054,7 @@
 
 	case MOUSE_MODEL_GLIDEPOINT:
 	    /* `tapping' action */
-	    ms.button |= ((c & MOUSE_PS2_TAP)) ? 0 : MOUSE_BUTTON4DOWN;
+	    ms.button |= ((c & MOUSE_PS2_TAP) ^ ((sc->config & PSM_CONFIG_SYNCLOGICREV) ? MOUSE_PS2_TAP : 0)) ? 0 : MOUSE_BUTTON4DOWN;
 	    break;
 
 	case MOUSE_MODEL_NETSCROLL:
===================================================================
RCS file: src/share/man/man4/RCS/psm.4,v
retrieving revision 1.1
diff -u -r1.1 src/share/man/man4/psm.4
--- src/share/man/man4/psm.4	2000/11/24 17:11:55	1.1
+++ src/share/man/man4/psm.4	2000/11/24 17:18:30
@@ -336,6 +336,13 @@
 It has no effect unless the
 .Em HOOKRESUME
 flag is set as well.
+.It bit 15 SYNCLOGICREV
+This flag causes a ``logic reversal'' in the code that handles
+the SYNC bit.  It appears to be useful for a variant of the
+ALPS GlidePoint that is used on the NEC Versa series of laptops.
+A symptom that this flag would be appropriate is if the ``normal state''
+of the first mouse button is ``pressed,'' and changing the state to
+act ``released'' requires that you press the button.
 .El
 .Sh IOCTLS
 There are a few 
===================================================================


Now I specify psm0 flags of 0x8900 (effectively 0xe900; 0x0600 is ORed in
by psm.c during probing, and has been all along).  And because of that
0x8000 flag, the logic-reversal is accomplished.  The code is not at
all pretty, and my feelings will not be hurt if the solution doesn't
look like that at all; what I'm providing is something that seems to
do the job for me, while not breaking other machines.  (I note that
it is still impossible to "triple click" the touchpad, though.  That's
not ideal, but it's far better than inability to use the touchpad as a
mouse button at all.)

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011241815.eAOIFpN58218>