lkml.org 
[lkml]   [2005]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] kbtab tweaks, pen tool reporting
From
Date
This patch improves the kbtab behavior with regards to the pen tool a
little bit. I previously submitted a patch with the rather bad behavior
of reporting the pen tool as not-in-use when the device was opened, but
I've changed it around a little this time.

With this patch, the driver will report the pen tool as not-in-use if it
hasn't received input events for over a second-- given the somewhat
sloppy hardware, this seems to be the only way to get a sensible value
here. I hope this is acceptable.

There's also a few minor tweaks in the last block. I've turned off fuzz
compensation for the X and Y axes, as I found that these actually made
the jitter seem worse when drawing, causing sudden pixel-sized jumps
instead of the more gradual usually-subpixel jumps without the jitter.

Conversely, some small fuzz compensation seems good on the pressure axis
to help prevent stray click-and-release under low pressure.

Finally, as before, I've corrected the pressure limit to 127 instead of
255 (The upper limit as observed on two KBGear tablets)

Please CC me on any replies; I'm not subscribed to lkml. Thanks much!

Patch against 2.6.11.7 (seems to apply to .12-rc3 too) follows:

--- ../../../../linux-2.6.11.7/drivers/usb/input/kbtab.c 2005-04-07
14:57:08.000000000 -0400
+++ linux/drivers/usb/input/kbtab.c 2005-05-05 02:57:13.000000000 -0400
@@ -1,3 +1,4 @@
+#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/input.h>
@@ -13,6 +14,9 @@
* v0.0.2 - Updated, works with 2.5.62 and 2.4.20;
* - added pressure-threshold modules param code from
* Alex Perry <alex.perry@ieee.org>
+ * - Report pen tool not in use after ~1 second idle
+ * Tweak jitter and max pressure limit
+ * Dave Ahlswede <mightyquinn@letterboxes.org>
*/

#define DRIVER_VERSION "v0.0.2"
@@ -25,6 +29,7 @@
MODULE_LICENSE(DRIVER_LICENSE);

#define USB_VENDOR_ID_KBGEAR 0x084e
+#define KBTAB_PEN_TIMEOUT_DELAY 1000

static int kb_pressure_click = 0x10;
module_param(kb_pressure_click, int, 0);
@@ -40,6 +45,7 @@
int x, y;
int button;
int pressure;
+ unsigned long pen_timeout;
__u32 serial[2];
char phys[32];
};
@@ -71,7 +77,11 @@

kbtab->pressure = (data[5]);

- input_report_key(dev, BTN_TOOL_PEN, 1);
+ if (time_after(jiffies, kbtab->pen_timeout))
+ input_report_key(dev, BTN_TOOL_PEN, 0);
+ else
+ input_report_key(dev, BTN_TOOL_PEN, 1);
+ kbtab->pen_timeout = jiffies + KBTAB_PEN_TIMEOUT_DELAY;

input_report_abs(dev, ABS_X, kbtab->x);
input_report_abs(dev, ABS_Y, kbtab->y);
@@ -160,10 +170,11 @@

kbtab->dev.absmax[ABS_X] = 0x2000;
kbtab->dev.absmax[ABS_Y] = 0x1750;
- kbtab->dev.absmax[ABS_PRESSURE] = 0xff;
+ kbtab->dev.absmax[ABS_PRESSURE] = 0x7F;

- kbtab->dev.absfuzz[ABS_X] = 4;
- kbtab->dev.absfuzz[ABS_Y] = 4;
+ kbtab->dev.absfuzz[ABS_X] = 0;
+ kbtab->dev.absfuzz[ABS_Y] = 0;
+ kbtab->dev.absfuzz[ABS_PRESSURE] = 2;

kbtab->dev.private = kbtab;
kbtab->dev.open = kbtab_open;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-05-05 09:41    [W:0.158 / U:0.160 seconds]
©2003-2011 Jasper Spaans. Advertise on this site