Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Powerbook Touchpad/Trackpad unwanted right-clicks
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
eisenack
n00b
n00b


Joined: 07 Apr 2004
Posts: 23

PostPosted: Tue May 25, 2004 10:29 pm    Post subject: Powerbook Touchpad/Trackpad unwanted right-clicks Reply with quote

Hi

I configured my Powerbook G4 17" with gentoo linux kernel 2.6.5...
i discovered a lot of posts from people wanting their touchpad do right-clicks/ middle-clicks / double-clicks and scrolling wheel things when touching it at special areas like edges or corners

WHAT I WANT IS:
My touchpad/trackpad should ONLY move the mouse pointer.

easy.. isn't it?

but it happens to be, that my touchpad is _somewhere_ configured to interpret touching at the left or right edge as an right-click.
it's just annoying when i try to move the pointer over the screen, there are context-menus appearing everywhere just because my finger came to close to the left or right egde...


can anybody tell me where to turn this off?

(the so-called trackpad-mode-switch obviously works somehow, meaning "/usr/sbin/trackpad show" is reporting a change but i can't experience any difference between tap, notap, lock, drag or whatever modes)

i want to make clear that TAPPING is NOT the problem.
i was able to turn off tap invoked left-clicks by modifying corresponding configuration of either /etc/init.d/pbbuttonsd or /etc/init.d/pb-mouse-emulation, i don't remember.
but as i said, these edge areas unfortunately still work...

thanks
Back to top
View user's profile Send private message
tomasino
Apprentice
Apprentice


Joined: 11 Feb 2004
Posts: 154
Location: Italy, Bologna

PostPosted: Tue May 25, 2004 11:09 pm    Post subject: Re: Powerbook Touchpad/Trackpad unwanted right-clicks Reply with quote

eisenack wrote:

but it happens to be, that my touchpad is _somewhere_ configured to interpret touching at the left or right edge as an right-click.


:o I want this working on my pb :o
Back to top
View user's profile Send private message
snowlander
n00b
n00b


Joined: 27 Mar 2004
Posts: 32
Location: Pohnpei, Micronesia

PostPosted: Wed May 26, 2004 10:19 am    Post subject: Reply with quote

I have a similar problem on my pismo: my touchpad is very sensitive to double taps; when I first touch it, it often feels a double tap. Is there any way to make it just place the cursor, regardless of extra/accidental taps?
Back to top
View user's profile Send private message
theefer
n00b
n00b


Joined: 12 Jul 2003
Posts: 32

PostPosted: Mon May 31, 2004 1:53 pm    Post subject: Reply with quote

Hey, that's cool :-)
I've been looking for a "clever" touchpad for weeks !

Could you post your /etc/X11/XF86Config and /etc/pbbuttonsd.conf configuration files ? Do you use special modules related to the touchpad (synaptics maybe ? though I didn't know they worked on pb) ?

Quote:
i was able to turn off tap invoked left-clicks by modifying corresponding configuration of either /etc/init.d/pbbuttonsd or /etc/init.d/pb-mouse-emulation, i don't remember.

Definitely not /etc/init.d/pb-mouse-emulation since I wrote this simple script and I don't have advanced touchpad behavior ;-) It's only a script that lets you use Fn-Ctrl and Fn-Alt (default configuration) as Middle and Right click.
_________________
Theefer
Back to top
View user's profile Send private message
makia
n00b
n00b


Joined: 03 Jun 2004
Posts: 9

PostPosted: Mon Jun 07, 2004 4:24 pm    Post subject: Reply with quote

I'm having exactly the same problem. It's quite the annoyance. Since I haven't seen anyone post their configs, I'll post mine.

Here's the relevant bits from XF86Config-4 for the mouse:

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "IMPS/2"
Option "ZAxisMapping" "4 5"
Option "Device" "/dev/input/mice"
EndSection

As for pbbuttonsd.conf:

TPModeUpKey = 225 + alt
TPModeDownKey = 224 + alt
TPMode = none

Grepping through /var/log/XFree86.0.log:

(II) LoadModule: "mouse"
(II) Loading /usr/X11R6/lib/modules/input/mouse_drv.o
(II) Module mouse: vendor="The XFree86 Project"
compiled for 4.3.99.902, module version = 1.0.0
Module class: XFree86 XInput Driver
ABI class: XFree86 XInput driver, version 0.4

Nothing here seems to point towards anything obvious. Are there any special device drivers that could be used for this trackpad?
Back to top
View user's profile Send private message
colinleroy
n00b
n00b


Joined: 24 Nov 2003
Posts: 50

PostPosted: Tue Jun 08, 2004 2:20 pm    Post subject: IMPS/2 ? Reply with quote

That may be due to the fact you need to use Protocol "ExplorerPS/2", regardless of the type of the mouse, with kernel 2.6*.
Back to top
View user's profile Send private message
makia
n00b
n00b


Joined: 03 Jun 2004
Posts: 9

PostPosted: Tue Jun 08, 2004 4:45 pm    Post subject: Reply with quote

I changed my XF86Config-4 to use the ExplorerPS/2, but this didn't seem to change anything. Thanks for the tip, though.
Back to top
View user's profile Send private message
ozonator
Guru
Guru


Joined: 11 Jun 2003
Posts: 591
Location: Ontario, Canada

PostPosted: Thu Jun 10, 2004 1:13 pm    Post subject: Re: IMPS/2 ? Reply with quote

colinleroy wrote:
That may be due to the fact you need to use Protocol "ExplorerPS/2", regardless of the type of the mouse, with kernel 2.6*.


I'm using Protocol "IMPS/2" without any problems here with 2.6.x, on an iBook 800 MHz. Haven't heard of that requirement, either; is that only for powerbooks?

eisenack, have you tried "TPMode = notap" in your pbbuttonsd.conf? That's what I use, and my trackpad only moves the pointer. "TPMode = none" isn't a valid setting -- when the pbbuttonsd.conf man page says 'default: none', it doesn't mean that 'none' is the setting, just that pbbuttonsd doesn't try to change the trackpad mode. In other words, if you don't set TPMode to an explicit setting, pbbuttonsd will just leave the trackpad in the default mode, i.e., emulating clicks, etc. To explicitly set the mode, use one of 'notap', 'tap', 'drag', or 'lock ' as the value for TPMode.
Back to top
View user's profile Send private message
makia
n00b
n00b


Joined: 03 Jun 2004
Posts: 9

PostPosted: Thu Jun 10, 2004 3:46 pm    Post subject: Reply with quote

Thanks for the reply, but no luck. The 17in powerbook appears to have a larger than normal touchpad, and therefore seems to behave oddly. The TPMode options (thanks for correcting me on the "none" problem) only seems to accect the central portion of the trackpad, on the outer left and outer right there is what seems to be a band that behaves completely separately to taps. When I turn tapping on via TPMode, the central portion behaves like mouse button 1, but the outside always behaves like mouse button 3. It's quite wierd/annoying.
Back to top
View user's profile Send private message
ozonator
Guru
Guru


Joined: 11 Jun 2003
Posts: 591
Location: Ontario, Canada

PostPosted: Thu Jun 10, 2004 4:11 pm    Post subject: Reply with quote

It's a stab in the dark, but which kernel sources are you using? I just remembered this thread, which discussed a kernel patch for adding scroll/click support to the trackpad. I'm sure that patch isn't in the stock kernel sources (e.g., the development-sources-2.6.6 I'm using), but it could have been added to the patches used in other sources. If so, there might be an option in the kernel config for disabling it, or maybe something in /proc or /sys.
Back to top
View user's profile Send private message
makia
n00b
n00b


Joined: 03 Jun 2004
Posts: 9

PostPosted: Thu Jun 10, 2004 5:00 pm    Post subject: Reply with quote

Thanks for the patch idea. This at least changed the behaviour. Now, it's forced the trackpad to scroll on one side and the rest will tap as the first mouse button (much better than before). I'll just need to get into it more and see if I can disable it all together. Thanks for the help.
Back to top
View user's profile Send private message
makia
n00b
n00b


Joined: 03 Jun 2004
Posts: 9

PostPosted: Thu Jun 10, 2004 6:07 pm    Post subject: Reply with quote

Hooray!!! It worked. Here's the patch I used/modified:

:::<START PATCH>::::
Code:
diff -uNr linux-2.6.5-gentoo.orig/drivers/macintosh/.adbhid.o.cmd linux-2.6.5-ge
ntoo/drivers/macintosh/.adbhid.o.cmd
--- linux-2.6.5-gentoo.orig/drivers/macintosh/.adbhid.o.cmd     2004-06-07 13:38
:55.000000000 -0700
+++ linux-2.6.5-gentoo/drivers/macintosh/.adbhid.o.cmd  2004-06-10 10:33:14.0000
00000 -0700
@@ -4,6 +4,7 @@
   drivers/macintosh/adbhid.c \
     $(wildcard include/config/ppc/pmac.h) \
     $(wildcard include/config/pmac/backlight.h) \
+    $(wildcard include/config/adb/trackpad/absolute.h) \
     $(wildcard include/config/mac.h) \
   include/linux/config.h \
     $(wildcard include/config/h.h) \
diff -uNr linux-2.6.5-gentoo.orig/drivers/macintosh/Kconfig linux-2.6.5-gentoo/d
rivers/macintosh/Kconfig
--- linux-2.6.5-gentoo.orig/drivers/macintosh/Kconfig   2004-05-25 09:37:48.0000
00000 -0700
+++ linux-2.6.5-gentoo/drivers/macintosh/Kconfig        2004-06-10 10:25:36.0000
00000 -0700
@@ -154,6 +154,22 @@
 
          If unsure, say Y.
 
+config ADB_TRACKPAD_ABSOLUTE
+       bool "Turn on absolute mode for trackpads"
+       depends on INPUT_ADBHID
+       help
+         For some powerbooks (namely the 17in albook) the trackpad behaves
+         peculiarly.  This will enable it in absolute mode and hopefully make
+         it a bit better.
+
+config ADB_TRACKPAD_SCROLLING
+       bool "Scrolling for ADB input devices (trackpad)"
+       depends on ADB_TRACKPAD_ABSOLUTE
+       help
+         Add the scrolling feature commonly seen on Windows laptops. If you
+         say Y here you can easily scroll in your applications by moving your
+         finger at the right border of your trackpad.
+
 config MAC_EMUMOUSEBTN
        bool "Support for mouse button 2+3 emulation"
        depends on INPUT_ADBHID
diff -uNr linux-2.6.5-gentoo.orig/drivers/macintosh/adbhid.c linux-2.6.5-gentoo/
drivers/macintosh/adbhid.c
--- linux-2.6.5-gentoo.orig/drivers/macintosh/adbhid.c  2004-05-25 09:37:48.0000
00000 -0700
+++ linux-2.6.5-gentoo/drivers/macintosh/adbhid.c       2004-06-10 10:23:27.0000
00000 -0700
@@ -238,6 +238,97 @@
 }
 
 static void
+emulate_relative_trackpad_mode(unsigned char *data)
+{
+       static int prev_x[16] = {-1,-1,-1,-1,-1,-1,-1,-1,
+                                -1,-1,-1,-1,-1,-1,-1,-1};
+       static int prev_y[16] = {-1,-1,-1,-1,-1,-1,-1,-1,
+                                -1,-1,-1,-1,-1,-1,-1,-1};
+       static int max_x[16] = {1400,1400,1400,1400,1400,1400,1400,1400,
+                               1400,1400,1400,1400,1400,1400,1400,1400};
+       int btn1, btn2, x_axis, y_axis;
+       int rel_x, rel_y;
+       int id = (data[0] >> 4) & 0x0f;
+
+       x_axis  = (data[2] & 0x7f) |
+           ((data[3] & 0x07) << 7) |
+           ((data[4] & 0x07) << 10);
+       y_axis  = (data[1] & 0x7f) |
+           ((data[3] & 0x70) << 3) |
+           ((data[4] & 0x70) << 6);
+       btn1 = (!(data[1] >> 7)) & 1;
+       btn2 = (!(data[2] >> 7)) & 1;
+#ifdef ADB_TRACKPAD_SCROLLING
+       /* Map btn2 (tap-click) to the left button */
+       btn1 |= btn2;
+       btn2 = 0;
+#endif
+
+       if (x_axis > max_x[id])
+               max_x[id] = x_axis;
+
+       rel_x = rel_y = 0;
+       if (x_axis == 0 && y_axis == 0) {
+               /* No finger on the pad */
+               prev_x[id] = prev_y[id] = -1;
+       }
+       else if (x_axis > 0 && prev_x[id] > 0 &&
+                y_axis > 0 && prev_y[id] > 0) {
+
+               /* "filter" the position somewhat */
+               x_axis = (prev_x[id] + x_axis) / 2;
+               y_axis = (prev_y[id] + y_axis) / 2;
+
+               rel_x = (x_axis - prev_x[id]);
+               rel_y = (y_axis - prev_y[id]);
+               /* Slow it down somewhat */
+               if (rel_x > 1 || rel_x < -1)
+                       rel_x /= 2;
+               if (rel_y > 1 || rel_y < -1)
+                       rel_y /= 2;
+               /* Make sure we don't overflow the 7 bits allocated
+                * for the relative movement */
+               if (rel_x > 63)
+                       rel_x = 63;
+               if (rel_x < -64)
+                       rel_x = -64;
+               if (rel_y > 63)
+                       rel_y = 63;
+               if (rel_y < -64)
+                       rel_y = -64;
+               prev_x[id] = x_axis;
+               prev_y[id] = y_axis;
+       }
+       else {
+               prev_x[id] = x_axis;
+               prev_y[id] = y_axis;
+       }
+#ifdef ADB_TRACKPAD_SCROLLING
+       /* Is the finger positioned in the scrolling area? */
+       if (x_axis > max_x[id] - 150) {
+               static int count = 0;
+
+               if (++count == 6) {
+                       int diff = - rel_y;
+                       count = 0;
+                       if (diff > 0)
+                               input_report_rel(&adbhid[id]->input,
+                                                REL_WHEEL, diff / 4 + 1);
+                       else if (diff < 0)
+                               input_report_rel(&adbhid[id]->input,
+                                                REL_WHEEL, diff / 4 - 1);
+               }
+               /* cancel all movment and clicks */
+               btn1 = 0;
+               rel_x = rel_y = 0;
+       }
+#endif
+       /* Format the data so adbhid_mouse_input can use it */
+       data[1] = (rel_y & 0x7f) | (((!btn1) & 1) << 7);
+       data[2] = (rel_x & 0x7f) | 0x80;
+}
+
+static void
 adbhid_mouse_input(unsigned char *data, int nb, struct pt_regs *regs, int autop
oll)
 {
        int id = (data[0] >> 4) & 0x0f;
@@ -294,8 +385,12 @@
        switch (adbhid[id]->mouse_kind)
        {
            case ADBMOUSE_TRACKPAD:
+#ifdef CONFIG_ADB_TRACKPAD_ABSOLUTE
+               emulate_relative_trackpad_mode(data);
+#else
                data[1] = (data[1] & 0x7f) | ((data[1] & data[2]) & 0x80);
                data[2] = data[2] | 0x80;
+#endif
                break;
            case ADBMOUSE_MICROSPEED:
                data[1] = (data[1] & 0x7f) | ((data[3] & 0x01) << 7);
@@ -633,7 +728,11 @@
 
                adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
                adbhid[id]->input.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(
BTN_MIDDLE) | BIT(BTN_RIGHT);
+#ifdef CONFIG_ADB_TRACKPAD_ABSOLUTE
+               adbhid[id]->input.relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_
WHEEL);
+#else
                adbhid[id]->input.relbit[0] = BIT(REL_X) | BIT(REL_Y);
+#endif
                break;
 
        case ADB_MISC:
@@ -903,7 +1002,11 @@
                    r1_buffer[3],
                    r1_buffer[4],
                    r1_buffer[5],
+#ifdef CONFIG_ADB_TRACKPAD_ABSOLUTE
+                   0x00, /* Enable absolute mode */
+#else
                    0x03, /*r1_buffer[6],*/
+#endif
                    r1_buffer[7]);
 
            /* Without this flush, the trackpad may be locked up */

::::<END PATCH>::::

With this, there are 2 new options for macintosh devices. If you want to completely disable the tapping, just set CONFIG_ADB_TRACKPAD_ABSOLUTE=y in your kernel config file. Also, make sure that in /etc/pbbuttonsd.conf that you set dev_ADB = "/dev/null", or else you'll have issues.
Back to top
View user's profile Send private message
ozonator
Guru
Guru


Joined: 11 Jun 2003
Posts: 591
Location: Ontario, Canada

PostPosted: Thu Jun 10, 2004 11:59 pm    Post subject: Reply with quote

Glad to hear you've had success! Thanks for posting the patch, too -- I don't think I need it myself, but it might still come in handy: a good friend of mine recently got a 17" PB that I've been encouraging him to try with Linux... :)
Back to top
View user's profile Send private message
stimuli
Apprentice
Apprentice


Joined: 16 Dec 2002
Posts: 292
Location: Vancouver, BC, Canada

PostPosted: Fri Jun 11, 2004 3:07 am    Post subject: Reply with quote

edit: oops.

PS I have no idea how you turned it on! Thus I have no idea how to turn it off. You did
/etc/init.d/pbbuttonsd restart

after making changes in /etc/pbbuttonsd.conf, yes? If not, perhaps your kernel patch was unnecessary. I have trackpad set to notap and have no issues like this. IMHO trackpad notap should be the default.
Back to top
View user's profile Send private message
makia
n00b
n00b


Joined: 03 Jun 2004
Posts: 9

PostPosted: Tue Jun 15, 2004 7:39 pm    Post subject: Reply with quote

The problem is that with the 17in powerbooks, the trackpad seems extra long, and thereby has some added functionality. To turn off these "features" you can use the patch that I pasted earlier. With "notap" in pbuttonsd.conf, all that successfully happened was the center portion no longer submitted tap events, but the outer portions kept on doing it. It was quite annoying.
Back to top
View user's profile Send private message
eisenack
n00b
n00b


Joined: 07 Apr 2004
Posts: 23

PostPosted: Tue Jul 27, 2004 1:43 pm    Post subject: Reply with quote

makia wrote:
Hooray!!! It worked. Here's the patch I used/modified:

:::<START PATCH>::::
Code:
diff -uNr linux-2.6.5-gentoo.orig/drivers/macintosh/.adbhid.o.cmd linux-2.6.5-gentoo/drivers/macintosh/.adbhid.o.cmd
--- linux-2.6.5-gentoo.orig/drivers/macintosh/.adbhid.o.cmd     2004-06-07 13:38
:55.000000000 -0700
+++ linux-2.6.5-gentoo/drivers/macintosh/.adbhid.o.cmd  2004-06-10



Nice patch.
I'm still trying to get it working.
First thing that puzzles me is, that the first file that should be patched is '.adbhid.o.cmd'. But this file is created during the 'make vmlinux' (or how you do it) kernel compilation process. I wonder if I have to apply the patch before AND after kernel compilation ???

However, the output I get (applying the patch after having compiled the kernel at least once before - and having a symlink 'linux-2.6.5-gentoo' to my 'linux-2.6.7-pegasos-r3' sources) is this:
Code:

root@lappi /usr/src # patch -p0 -i mousepatch.patch
patching file linux-2.6.5-gentoo/drivers/macintosh/.adbhid.o.cmd
patching file linux-2.6.5-gentoo/drivers/macintosh/Kconfig
Hunk #1 succeeded at 154 with fuzz 2.
patching file linux-2.6.5-gentoo/drivers/macintosh/adbhid.c
patch: **** malformed patch at line 146: oll)


What does that mean? Who are 'Hunk' and 'fuzz 2' ? - What is 'oll' ? - IS THIS RIGHT ?

I'm just asking because ignoring all this didn't help.

Thanks.

PS: I have a silly 'workaround' I'd like to present:
Just add
Code:
Option "Buttons" "1"
to your 'Section Input Device' in your X11 configuration file (/etc/X11/xorg.conf). There won't be accidentally invoked right or middle clicks any more. (But emulating right/middle clicks isn't possible any longer either.)
Back to top
View user's profile Send private message
makia
n00b
n00b


Joined: 03 Jun 2004
Posts: 9

PostPosted: Tue Jul 27, 2004 3:37 pm    Post subject: Reply with quote

Sorry about that... that file (.adbhid.o.cmd) doesn't actually matter (it was a result of a build that didn't get cleaned out correctly. In fact, you could remove the remnants of it from the patch alltogether. As for the fuzz, that's normal because you're patching a 2.6.7 kernel with a patch I made for 2.6.5 (some things were probably moved around just a bit). I'm not sure about the malformed patch line. You might want to make sure that:

+ adbhid[id]->input.relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL);

is all one line in your patch file (no extra new-line characters that sometimes happen from a cut and paste). As for patching. Instead of making a link, you can do the following:

# cd /usr/src/linux-2.6.7*
# patch -p1 < <path to patch>

This will strip off the path lines from the patch file and work in the current directory.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum