Made it possible to disable the touchpad at runtime. (Patch

from "Jrg Bsner" <ich@joerg-boesner.de>.)
This commit is contained in:
Peter Osterlund
2003-09-14 21:46:28 +02:00
parent d1643a7d78
commit 0f0cee77f6
8 changed files with 36 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ Aopen Openbook 1545/1545D
ASUS A1000
ASUS L2400D
ASUS L3500D
ASUS L3500H
ASUS L3800C
ASUS L8400 series
ASUS M2400E

View File

@@ -21,3 +21,4 @@ taps for example):
- Multifinger taps: two finger for middle button and three finger for
right button events
- Online configuration through shared memory (Option: SHMConfig)
- Touchpad can be switched off temporarily

2
FILES
View File

@@ -5,3 +5,5 @@ synaptics.c Synaptics driver-module for xfree
synaptics.h see above
synclient.c Program for testing the shared-memory
shows the x, y-coordinates of the finger
script/usbmouse script for shutting the touchpad down if
an external USB-mouse is attached

View File

@@ -21,3 +21,5 @@ UpDownScrolling Bool If on, the up/down buttons generate button 4/5 events.
If off, the up button generates a double click and
the down button generates a button 2 event.
EmulateMidButtonTime Int max time (in milliseconds) for middle button emulation.
TouchpadOff Bool If on, the Touchpad is switched off (useful
if an external mouse is connected)

19
script/usbmouse Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
while true
do
if [ -e ~/.touchpad.on ]; then
synclient TouchpadOff=0
else
if [ -e ~/.touchpad.off ]; then
synclient TouchpadOff=1
else
if [ "`grep -e Mouse /proc/bus/usb/devices`" ]; then
synclient TouchpadOff=1
else
synclient TouchpadOff=0
fi
fi
fi
sleep 3
done

View File

@@ -1,4 +1,8 @@
/*
* 2003 Jörg Bösner <ich@joerg-boesner.de>
* patch for switching the touchpad off (for example, when a
* USB mouse is connected)
*
* 2003 Hartwig Felger <hgfelger@hgfelger.de>
* patch to make the horizontal-wheel-replacement-buttons work.
*
@@ -389,6 +393,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
priv->synpara->edge_motion_speed = xf86SetIntOption(local->options, "EdgeMotionSpeed", 40);
priv->synpara->repeater = xf86SetStrOption(local->options, "Repeater", NULL);
priv->synpara->updown_button_scrolling = xf86SetBoolOption(local->options, "UpDownScrolling", TRUE);
priv->synpara->touchpad_off = xf86SetBoolOption(local->options, "TouchpadOff", FALSE);
str_par = xf86FindOptionValue(local->options, "MinSpeed");
if((!str_par) || (xf86sscanf(str_par, "%lf", &priv->synpara->min_speed) != 1))
@@ -844,6 +849,10 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
long delay = 1000000000;
long timeleft;
/* If touchpad is switched off, we skip the whole thing and return delay */
if (para->touchpad_off == TRUE)
return delay;
edge = edge_detection(priv, hw->x, hw->y);
dx = dy = 0;

View File

@@ -36,6 +36,7 @@ typedef struct _SynapticsSHM
int edge_motion_speed; /* Edge motion speed when dragging */
char* repeater; /* Repeater on or off */
Bool updown_button_scrolling; /* Up/Down-Button scrolling or middle/double-click */
Bool touchpad_off; /* Switches the Touchpad off*/
} SynapticsSHM, *SynapticsSHMPtr;
#ifdef SYNAPTICS_PRIVATE

View File

@@ -61,6 +61,7 @@ static struct Parameter params[] = {
DEFINE_PAR("AccelFactor", accl, PT_DOUBLE, 0, 0.2),
DEFINE_PAR("EdgeMotionSpeed", edge_motion_speed, PT_INT, 0, 400),
DEFINE_PAR("UpDownScrolling", updown_button_scrolling, PT_BOOL, 0, 1),
DEFINE_PAR("TouchpadOff", touchpad_off, PT_BOOL, 0, 1),
{ 0, 0, 0, 0, 0 }
};