On Monday 13 November 2006 4:15 am, you wrote:
> It may be fine to also send it here for inclusion in mactel subversion
> patches for linux 2.6.18 (unless the patch is specific to 2.6.19).
> I will use linux 2.6.19 when it is ready but until then I use 2.6.18
> with mactel patches. Using a nice touchpad would be great for my
> 2.6.18 kernel.
>
Alright. I've attached the patch for a vanilla 2.6.18 (may also work on
mactel-patched 2.6.17). I've been using this for some time, and it doesn't
seem to have any issues.
jason
== Attachment ==
--- linux/drivers/usb/input/appletouch.c.orig 2006-10-22
14:41:51.000000000 -0400
+++ linux/drivers/usb/input/appletouch.c 2006-10-22 14:47:17.000000000
-0400
@@ -154,6 +154,13 @@
MODULE_DESCRIPTION("Apple PowerBooks USB touchpad driver");
MODULE_LICENSE("GPL");
+/*
+ * Make the threshold a module parameter
+ */
+static int threshold = ATP_THRESHOLD;
+module_param(threshold, int, 0644);
+MODULE_PARM_DESC(threshold, "Discards any change in data from a sensor
(trackpad has hundreds of these sensors) less than this value");
+
static int debug = 1;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Activate debugging output");
@@ -184,16 +191,49 @@
/* values to calculate mean */
int pcum = 0, psum = 0;
+ int is_increasing = 0;
+
*fingers = 0;
for (i = 0; i < nb_sensors; i++) {
- if (xy_sensors[i] < ATP_THRESHOLD)
+ if (xy_sensors[i] < threshold) {
+ if (is_increasing)
+ is_increasing = 0;
+
continue;
- if ((i - 1 < 0) || (xy_sensors[i - 1] < ATP_THRESHOLD))
+ }
+
+ /*
+ * Makes the finger detection more versatile. For example,
+ * two fingers with no gap will be detected. Also, my
+ * tests show it less likely to have intermittent loss
+ * of multiple finger readings while moving around (scrolling).
+ *
+ * Changes the multiple finger detection to counting humps on
+ * sensors (transitions from nonincreasing to increasing)
+ * instead of counting transitions from low sensors (no
+ * finger reading) to high sensors (finger above
+ * sensor)
+ *
+ * - Jason Parekh <[EMAIL PROTECTED]>
+ */
+ if ((i < 1) || (!is_increasing && (xy_sensors[i-1] <
xy_sensors[i]))) {
(*fingers)++;
- pcum += xy_sensors[i] * i;
- psum += xy_sensors[i];
- }
+ is_increasing = 1;
+ } else if ((i > 0) && (xy_sensors[i-1] >= xy_sensors[i])) {
+ is_increasing = 0;
+ }
+
+ /*
+ * Subtracts threshold so a high sensor that just passes the
threshold
+ * won't skew the calculated absolute coordinate. Fixes an
issue
+ * where slowly moving the mouse would occassionaly jump a
number of
+ * pixels (let me restate--slowly moving the mouse makes this
issue
+ * most apparent).
+ */
+ pcum += (xy_sensors[i]-threshold) * i;
+ psum += (xy_sensors[i]-threshold);
+ }
if (psum > 0) {
*z = psum;
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mactel-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mactel-linux-devel