mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Ahlswede <mightyquinn@letterboxes.org>
To: linux-kernel@vger.kernel.org
Cc: vojtech@suse.cz
Subject: [PATCH] kbtab tweaks, pen tool reporting
Date: Thu, 05 May 2005 03:37:29 -0400	[thread overview]
Message-ID: <1115278649.31630.22.camel@localhost.localdomain> (raw)

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;



                 reply	other threads:[~2005-05-05  7:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1115278649.31630.22.camel@localhost.localdomain \
    --to=mightyquinn@letterboxes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®