PDA

View Full Version : Touchpad Control



Forester
03-17-2011, 11:28 PM
There are two drawbacks to using a laptop: the touchpad and the touchpad.

First, you are typing something and the touchpad decides you've tapped in the secret code for "destroy, destroy, frustration is irrelevant" and whatever it was you were doing is gone.

Second, this still happens even though you've plugged in an external mouse and aren't using the touchpad at all.

The route to solving the first problem is through syndaemon and the route to solving the second is through synclient. Both are command line apps already installed in Knoppix (6.4.4. at least).

To get the right settings automatically when Knoppix start-ups you need an additional script in /etc/X11/Xsession.d and to get the settings to change automagically when you plug-in or unplug a USB mouse, you need to add an extra pair of rules to /etc/udev/rules.d.

There are examples of how to do this out there but they usually start with someone complaining what used to work has stopped and could they crib a new solution from someone who has already done all the hard work.

Seems Knoppix is no exception and none of the solutions out there work. Seems xhost + is missing somewhere for sentimental reasons or perhaps Knoppix is just using a very new X server with new and improved security (the kind that got Windows Vista such a bad name).

Here's my take on this:


# /etc/udev/rules.d/75-touchpad.rules
# Disable touchpad when USB mouse is plugged in and reenable when USB mouse is removed

ACTION=="add", SUBSYSTEM=="input", ENV{ID_INPUT_MOUSE}=="1", RUN+="/etc/X11/Xsession.d/50touchpad 1"
ACTION=="remove", SUBSYSTEM=="input", ENV{ID_INPUT_MOUSE}=="1", RUN+="/etc/X11/Xsession.d/50touchpad 0"

# EOF
and



#!/bin/sh
# /etc/X11/Xsession.d/50touchpad

if pidof X >/dev/null; then

# Turn touchpad off when a USB mouse is present

pidfile=/var/run/syndaemon.pid;

if [ -n "${XAUTHORITY}" ]; then
# Xsession initialisation

if lsusb -v 2>/dev/null | grep -qF Mouse; then
synclient TouchpadOff=1;
else
syndaemon -d -t -k -p $pidfile;
fi
else
# udev hotplug event

DISPLAY=":0";
USER=$(who | awk "/ $DISPLAY /"'{print $1}');
XAUTHORITY=/home/$USER/.Xauthority;
export DISPLAY XAUTHORITY;

synclient TouchpadOff=$1;

if [ "$1" -eq 1 ]; then
[ -f $pidfile ] && kill $(cat $pidfile);
[ -f $pidfile ] && sync;
else
[ ! -f $pidfile ] && syndaemon -d -t -k -p $pidfile;
[ ! -f $pidfile ] && sync;
fi
fi

fi

# EOF
The second must be executable as it is called by the rules in the first.

Enjoy.

utu
03-18-2011, 03:24 AM
I was wondering if your 6.4.4 DVD version of gconf-editor was like my CD version.
The CD version does NOT having a nice touchpad_enable choice to finagle.
Ubuntu 10.10 does.

Your solution is nice. Could it play an appropriate Irish tune, do you suppose.

utu
03-20-2011, 07:23 PM
@ Forester

I was surprised to find how much built-in (meaning man synaptics)
control and info exists for the synaptics touchpad.
In so doing I ran across the following interesting tidbits:

controls GuestMouseOff(Boolean) and SynapticsOff(Values 0,1,2).

Perhaps you are already aware of these; if not maybe they offer some
refinements for your keypad/mouse amendments. The ff gives even more
details than the man pages.

http://www.x.org/archive/X11R7.5/doc/man/man4/synaptics.4.html

Forester
03-21-2011, 10:02 PM
@ Forester

I was surprised to find how much built-in (meaning man synaptics)
control and info exists for the synaptics touchpad.


I'm not. I've just never used a laptop consistently enough to have had an interest in studying what I could do with the touchpad. Handy for scrolling in long documents both in and out of a browser. Best discovery yet is a gentle tap with two fingers is equivalent of clicking the middle button on a mouse.




controls GuestMouseOff(Boolean) and SynapticsOff(Values 0,1,2).

Perhaps you are already aware of these.


I believe (read the man page again) SynapticsOff is equivalent to TouchpadOff you are already using. I believe in the current X server the default has been changed from 0 to 2 but I'm none the wiser.

Remember IBM ThinkPads ? I think they had Guest Mice. We called them nipples.



The ff gives even more details than the man pages.

http://www.x.org/archive/X11R7.5/doc/man/man4/synaptics.4.html

This is just an html representation of what you get when you type


man 4 synapticsunder Knoppix. No surprise there.

wspc
03-05-2012, 01:55 PM
I actually want to enable the touchpad. How do you do it?

I have given up trying to modify xorg.conf. Yeah, I delete the line that says it has to be deleted to save changes, but what do I do next?

Perhaps someone out there can write a guide for dummies to enable touchpads.

I have written a script that contains the required synclient options. At the moment I click it after booting and it enables the touchpad.
This is a clumsy solution. So how, keep it simple guys, can I make the script boot automatically, like the batch files of old.

So this post asks two separate questions. Any takers?

Peter Perros, Brisbane Australia.

klaus2008
03-06-2012, 08:48 PM
Did you read the thread "How do I enable touchpad-tapping? (http://knoppix.net/forum/threads/28774-How-do-I-enable-touchpad-tapping?highlight=synclient)"?

wspc
03-07-2012, 12:23 PM
Hello Klaus2008.
Yes I have read the thread countless times. I have written a simple script file with the synclient options I need (eg., HorizonalEdgeScroll) but this script file only works if I click on it with the mouse using button1.
I understand how to edit the xorg.conf file by logging on as root in terminal, and I know vi from my unix days in the 70's, but to date have been unable to work out what lines/code to add to xorg.conf to get the touchpad working automatically from boot.
Is it as simple as copying code from a ubuntu distro xorg.conf file?
I would be happy just to have my script file executed at boot up. Any tips appreciated.
Peter Perros, Brisbane Australia.

klaus2008
03-07-2012, 08:53 PM
Hello Peter Perros.

I think that you should create the configuration file /etc/X11/Xsession.d/15x11-synaptics using your favourite text editor. The content of that file could be
#
synclient TapButton1=1 TapButton2=3 TapButton3=2 HorizEdgeScroll=1

The file should end with a single blank line.

I hope that helps.

wspc
03-07-2012, 11:16 PM
thank you, I will give it a try.

wspc
03-08-2012, 01:41 PM
Dear Klaus2008,
I created the file as instructed but sadly it didn't do the trick.
At least I have a script that does what I want it to do.
Thank you klaus2008 for offering to help, but I feel that knoppix is unintuitive and well beyond my limited computing expertise.
Peter Perros

utu
03-08-2012, 10:36 PM
g'day, Peter.
You probably know this, but:
Just to make sure, 15x11-snaptics properties may need to be root:root.
Mine are.

utu
03-08-2012, 10:50 PM
ps
.
It may be that quotes are necessary for the statements.
Here's mine:


# $Id: 15x11-synaptics $
# This file is sourced by Xsession(5), not executed.
# Disable built-in Touchpad.
#
synclient "TouchpadOff=1"
#

utu
03-09-2012, 09:59 PM
I have written a script that contains the required synclient options. At the moment I click it after booting and it enables the touchpad.
This is a clumsy solution. So how, keep it simple guys, can I make the script boot automatically, like the batch files of old.


Another approach would be to take your script and add it to /etc/rc.local.
This file should also be root:root AND executable.

But I am surprised the Xsession.d approach doesn't work for you.

Let us know how it goes in any event.

utu
03-09-2012, 10:02 PM
I have written a script that contains the required synclient options. At the moment I click it after booting and it enables the touchpad.
This is a clumsy solution. So how, keep it simple guys, can I make the script boot automatically, like the batch files of old.


Another approach might be to take your script and add it to /etc/rc.local.
This file should also be root:root AND executable. We really should see your script
before you do this.

But I am surprised the Xsession.d approach doesn't work for you.

Let us know how it goes in any event.

kl522
03-09-2012, 11:25 PM
Another approach might be to take your script and add it to /etc/rc.local.
This file should also be root:root AND executable. We really should see your script
before you do this.

But I am surprised the Xsession.d approach doesn't work for you.

Let us know how it goes in any event.

Can't really put that in /etc/rc.local because the program synclient need to contact the X server.

OK there is some further details need to take note about the script synclient, there must be no spaces between the equal sign, the quotes are optional however :-

synclient TouchpadOff=1 - works
synclient TouchpadOff =1 - does not work
synclient TouchpadOff = 1 - does not work
synclient "TouchpadOff=1" - works

utu
03-10-2012, 06:00 AM
synclient "TouchpadOff=1" - works
Then, I think what wspc wants is
synclient "TouchpadOff=0" , with or w/o the quotes,
with properties root:root, not executable.
He wants to ENABLE the touchpad.

utu
03-10-2012, 09:42 PM
Can't really put that in /etc/rc.local because the program synclient need to contact the X server.
I was really surprised rc.local was NOT an alternative, since the same material entered into an xterminal works just fine.

I'd still like to see what 'script' does the job.

kl522
03-10-2012, 11:03 PM
I was really surprised rc.local was NOT an alternative, since the same material entered into an xterminal works just fine.

I'd still like to see what 'script' does the job.

Because when you open an xterminal, there is an environment variable called DISPLAY.

$ echo $DISPLAY
:0
$ set | grep DISPLAY
DISPLAY=:0

However, when you run it in rc, the DISPLAY is not set, so synclient does not know which Xserver DISPLAY you are talking about.

$ unset DISPLAY
$ synclient -l
Failed to connect to X server

wspc
03-13-2012, 07:12 AM
Hey fellas, this is the script I wrote, saved as the executable file called touchpad on my system at /home/knoppix
#!/bin/bash
synclient TapButton1=1
synclient TapButton2=2
synclient TapButton3=3
synclient HorizEdgeScroll=1
synclient VertEdgeScroll=1
sorry, the formatting is scrambling the message, hence at carriage return Also the reference to root:root - is that sudo su? thanks, Peter Perros

--------------
I formatted it for you; please use the "Go Advanced" button and then the icon to insert code. Greetings Werner

wspc
03-13-2012, 07:50 AM
Hey guys,
I think life would be a lot easier if Knoppix could emulate the touchpad support of Linux Mint 12 LXDE.
I really can't spend more time on this. I really want something that is easy to use. Love the eye candy though...
Thanks guys.
Peter Perros.

Karibu
03-23-2012, 01:40 AM
@ Forester:

Not sure if it is of any interest but I have to tell you, your
...take on this...works on my HP Pavilion g6-1b67ca with knoppix 6.7.1 running from an USB stick flawless like a gem...
Thank you for sharing your solution with the Knoppix World!
:D

wspc
06-15-2012, 12:20 PM
Has 7.02 solved the lack of support for touchpads?

utu
06-15-2012, 01:13 PM
It has for me.