[PATCH] Config options for hardware tapping on ALPS touchpad

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

 



This patch adds two options under the PS/2 mouse driver to control how
hardware tapping is enabled on ALPS touchpads. I have defined a new
static variable in alps.c to determine if we call alps_tap_mode() with
a 1 or a 0. The first new config option lets you select whether you
want hardware tapping or not by defining the default value for this
variable.

The second new option lets you add a module parameter to alps.c that
can change the tapping mode when the psmouse module is loaded. This
module parameter simply sets the same variable defined above and lets
you override your choice in the previous option. It also lets you
change the tapping mode without a recompile & reboot by reloading the
psmouse module.

See the Kconfig descriptions for more details.

Other internal changes to alps.c besides the new variable and module
parameter are:
- Added a new static function, alps_setup_tapping, to set the tapping
state using the new variable and handle printk statements.
- Replaced the two instances of alps_tap_mode and any nearby logic
that handles printk with alps_setup_tapping

This fairly simple patch is made to apply on top of 2.6.13-rc3. I have
tested it on my laptop with different combinations of the the new
config options with no problems. Of course any comments/feedback would
be appreciated :)

Signed-off-by: Robert Broglia <[email protected]>


diff -uprN -X dontdiff linux-2.6.13-rc3/drivers/input/mouse/Kconfig
linux-2.6.13-rc3-patched/drivers/input/mouse/Kconfig
--- linux-2.6.13-rc3/drivers/input/mouse/Kconfig	2005-07-14
01:34:11.000000000 -0400
+++ linux-2.6.13-rc3-patched/drivers/input/mouse/Kconfig	2005-07-14
01:58:48.712666493 -0400
@@ -37,6 +37,34 @@ config MOUSE_PS2
 	  To compile this driver as a module, choose M here: the
  	  module will be called psmouse.
 
+if MOUSE_PS2
+
+config MOUSE_PS2_ALPS_HARDWARE_TAPPING
+	bool "Hardware tapping for ALPS touchpads"
+	default y
+	help
+	Say Y here to enable hardware tapping on ALPS laptop touchpads,
+	such as the one found on the Dell Latitude D600. You should
+	say N here if you use the Synaptics X11 drivers to avoid
+	possible conflicts with software-based tapping.
+
+	If unsure, say Y. This option has no runtime effect unless using
+	an ALPS touchpad.
+
+config MOUSE_PS2_ALPS_HARDWARE_TAPPING_MODULE_PARAM
+	bool "Set ALPS tapping state via module parameter"
+	default y
+	help
+	Say Y here to set the hardware tapping on ALPS laptop touchpads
+	via the parameter "alpshardtap" when loading the psmouse module.
+	A value of 1 enables hardware tapping, and 0 disables it.
+	This overrides whatever the default tapping state is set to.
+
+	If unsure, say Y. This option has no runtime effect unless using
+	an ALPS touchpad.
+
+endif
+
  config MOUSE_SERIAL
  	tristate "Serial mouse"
  	select SERIO
diff -uprN -X dontdiff linux-2.6.13-rc3/drivers/input/mouse/alps.c
linux-2.6.13-rc3-patched/drivers/input/mouse/alps.c
--- linux-2.6.13-rc3/drivers/input/mouse/alps.c	2005-07-14
01:34:11.000000000 -0400
+++ linux-2.6.13-rc3-patched/drivers/input/mouse/alps.c	2005-07-14
01:58:08.358736438 -0400
@@ -75,6 +75,17 @@ static struct alps_model_info alps_model
  * on a dualpoint, etc.
  */
 
+#ifdef CONFIG_MOUSE_PS2_ALPS_HARDWARE_TAPPING
+static unsigned int alps_hardtap = 1;
+#else
+static unsigned int alps_hardtap = 0;
+#endif
+
+#ifdef CONFIG_MOUSE_PS2_ALPS_HARDWARE_TAPPING_MODULE_PARAM
+module_param_named(alpshardtap, alps_hardtap, bool, 0644);
+MODULE_PARM_DESC(alpshardtap, "ALPS hardware tapping, 1 = enabled, 0
= disabled.");
+#endif
+
  static void alps_process_packet(struct psmouse *psmouse, struct pt_regs *regs)
 {
  	struct alps_data *priv = psmouse->private;
@@ -347,6 +358,19 @@ static int alps_tap_mode(struct psmouse 
 	return 0;
 }
 
+static void alps_setup_tapping(struct psmouse *psmouse)
+{
+	if(alps_hardtap == 1) {
+		printk(KERN_INFO "alps.c: Enabling hardware tapping\n");
+		if (alps_tap_mode(psmouse, 1))
+			printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
+	} else {
+		printk(KERN_INFO "alps.c: Disabling hardware tapping\n");
+		if (alps_tap_mode(psmouse, 0))
+			printk(KERN_WARNING "alps.c: Failed to disable hardware tapping\n");
+	}
+}
+
  static int alps_reconnect(struct psmouse *psmouse)
 {
  	struct alps_data *priv = psmouse->private;
@@ -365,7 +389,7 @@ static int alps_reconnect(struct psmouse
 		return -1;
 
  	if (!(param[0] & 0x04))
-		alps_tap_mode(psmouse, 1);
+		alps_setup_tapping(psmouse);
 
  	if (alps_absolute_mode(psmouse)) {
  		printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
@@ -408,11 +432,8 @@ int alps_init(struct psmouse *psmouse)
  		goto init_fail;
 	}
 
-	if (param[0] & 0x04) {
-		printk(KERN_INFO "alps.c: Enabling hardware tapping\n");
-		if (alps_tap_mode(psmouse, 1))
-			printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
-	}
+	if (param[0] & 0x04)
+		alps_setup_tapping(psmouse);
 
  	if (alps_absolute_mode(psmouse)) {
  		printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux