All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kyle Evans <kevans@android-x86.org>
To: linux-input@vger.kernel.org
Cc: Kyle Evans <kevans@android-x86.org>
Subject: [PATCH] wacom: set physical limits for quirky tablet devices
Date: Wed, 30 Jan 2013 10:47:45 -0500	[thread overview]
Message-ID: <1359560865-12410-1-git-send-email-kevans@android-x86.org> (raw)

TPC93 has two tools, finger and pen. Pen reports it's limits correctly,
but finger reports limits a screen size too big. This patch will make
the tool usable by the vast majority of users and does not interfere
with users who may still wish to calibrate, or current calibration data.

Sample values were taken from different devices and combined with the
intent that the cursor can reach the edge of the screen for all devices.
---
 drivers/input/tablet/wacom.h     |    2 +-
 drivers/input/tablet/wacom_sys.c |    2 +-
 drivers/input/tablet/wacom_wac.c |   14 +++++++++++---
 drivers/input/tablet/wacom_wac.h |    2 ++
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index b79d451..2883c70 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -134,7 +134,7 @@ static inline void wacom_schedule_work(struct wacom_wac *wacom_wac)
 extern const struct usb_device_id wacom_ids[];
 
 void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
-void wacom_setup_device_quirks(struct wacom_features *features);
+void wacom_setup_device_quirks(struct wacom_features *features, int product_id);
 int wacom_setup_input_capabilities(struct input_dev *input_dev,
 				   struct wacom_wac *wacom_wac);
 #endif
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 858ad44..f52dbf4 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -1293,7 +1293,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
 		}
 	}
 
-	wacom_setup_device_quirks(features);
+	wacom_setup_device_quirks(features, id->idProduct);
 
 	strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
 
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index c2bfe92..b26f08c 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1397,7 +1397,7 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
 	input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0);
 }
 
-void wacom_setup_device_quirks(struct wacom_features *features)
+void wacom_setup_device_quirks(struct wacom_features *features, int product_id)
 {
 
 	/* touch device found but size is not defined. use default */
@@ -1422,6 +1422,14 @@ void wacom_setup_device_quirks(struct wacom_features *features)
 		features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES;
 	}
 
+	/* TPC93 is a 12" device, but the finger tool reports limits for a 13" screen */
+	if ( product_id == 0x93 && features->device_type == BTN_TOOL_FINGER) {
+		features->x_min = 176;
+		features->x_max = 3960;
+		features->y_min = 216;
+		features->y_max = 3900;
+	}
+
 	if (features->type == WIRELESS) {
 
 		/* monitor never has input and pen/touch have delayed create */
@@ -1450,9 +1458,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 
 	__set_bit(BTN_TOUCH, input_dev->keybit);
 
-	input_set_abs_params(input_dev, ABS_X, 0, features->x_max,
+	input_set_abs_params(input_dev, ABS_X, features->x_min, features->x_max,
 			     features->x_fuzz, 0);
-	input_set_abs_params(input_dev, ABS_Y, 0, features->y_max,
+	input_set_abs_params(input_dev, ABS_Y, features->y_min, features->y_max,
 			     features->y_fuzz, 0);
 
 	if (features->device_type == BTN_TOOL_PEN) {
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 345f1e7..77216e0 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -114,6 +114,8 @@ struct wacom_features {
 	unsigned touch_max;
 	int oVid;
 	int oPid;
+	int x_min;
+	int y_min;
 };
 
 struct wacom_shared {
-- 
1.7.8.6


             reply	other threads:[~2013-01-30 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30 15:47 Kyle Evans [this message]
2013-01-31 14:34 ` [PATCH --signoff] wacom: set physical limits for quirky tablet devices Kyle Evans

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=1359560865-12410-1-git-send-email-kevans@android-x86.org \
    --to=kevans@android-x86.org \
    --cc=linux-input@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.