From: Dave Ahlswede 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. Cc: Vojtech Pavlik Cc: Greg KH Signed-off-by: Andrew Morton --- drivers/usb/input/kbtab.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff -puN drivers/usb/input/kbtab.c~kbtab-tweaks-pen-tool-reporting drivers/usb/input/kbtab.c --- devel/drivers/usb/input/kbtab.c~kbtab-tweaks-pen-tool-reporting 2005-07-01 00:08:40.000000000 -0700 +++ devel-akpm/drivers/usb/input/kbtab.c 2005-07-01 00:08:40.000000000 -0700 @@ -1,3 +1,4 @@ +#include #include #include #include @@ -14,6 +15,9 @@ * v0.0.2 - Updated, works with 2.5.62 and 2.4.20; * - added pressure-threshold modules param code from * Alex Perry + * - Report pen tool not in use after ~1 second idle + * Tweak jitter and max pressure limit + * Dave Ahlswede */ #define DRIVER_VERSION "v0.0.2" @@ -26,6 +30,7 @@ MODULE_DESCRIPTION(DRIVER_DESC); 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 @@ struct kbtab { int x, y; int button; int pressure; + unsigned long pen_timeout; __u32 serial[2]; char phys[32]; }; @@ -71,7 +77,11 @@ static void kbtab_irq(struct urb *urb, s 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); @@ -154,10 +164,11 @@ static int kbtab_probe(struct usb_interf 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; _