* [PATCH 1/5] input: wacom: Add fuzz parameters to features
2010-09-03 12:17 [PATCH 0/5] input: wacom: Initial support for Bamboo (rev2) Henrik Rydberg
@ 2010-09-03 12:17 ` Henrik Rydberg
2010-09-03 12:17 ` [PATCH 2/5] input: wacom: Parse the Bamboo device family Henrik Rydberg
` (3 subsequent siblings)
4 siblings, 0 replies; 17+ messages in thread
From: Henrik Rydberg @ 2010-09-03 12:17 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ping Cheng, Chris Bagwell, linux-input, linux-kernel, Henrik Rydberg
The signal-to-noise ratio varies between devices, but currently all
devices are treated the same way. Add fuzz parameters to the feature
struct, allowing for tailored treatment of devices.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/input/tablet/wacom_sys.c | 6 +++++-
drivers/input/tablet/wacom_wac.c | 9 ++++++---
drivers/input/tablet/wacom_wac.h | 4 ++++
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 42ba369..e510e4f 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -333,8 +333,12 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
struct usb_host_interface *interface = intf->cur_altsetting;
struct hid_descriptor *hid_desc;
- /* default device to penabled */
+ /* default features */
features->device_type = BTN_TOOL_PEN;
+ features->x_fuzz = 4;
+ features->y_fuzz = 4;
+ features->pressure_fuzz = 0;
+ features->distance_fuzz = 0;
/* only Tablet PCs need to retrieve the info */
if ((features->type != TABLETPC) && (features->type != TABLETPC2FG))
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 40d77ba..bfe5654 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -951,9 +951,12 @@ void 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, 4, 0);
- input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, 4, 0);
- input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, 0, 0);
+ input_set_abs_params(input_dev, ABS_X, 0, features->x_max,
+ features->x_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_Y, 0, features->y_max,
+ features->y_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max,
+ features->pressure_fuzz, 0);
__set_bit(ABS_MISC, input_dev->absbit);
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 99e1a54..d769e9a 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -73,6 +73,10 @@ struct wacom_features {
int y_phy;
unsigned char unit;
unsigned char unitExpo;
+ int x_fuzz;
+ int y_fuzz;
+ int pressure_fuzz;
+ int distance_fuzz;
};
struct wacom_shared {
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/5] input: wacom: Parse the Bamboo device family
2010-09-03 12:17 [PATCH 0/5] input: wacom: Initial support for Bamboo (rev2) Henrik Rydberg
2010-09-03 12:17 ` [PATCH 1/5] input: wacom: Add fuzz parameters to features Henrik Rydberg
@ 2010-09-03 12:17 ` Henrik Rydberg
2010-09-03 12:17 ` [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3) Henrik Rydberg
` (2 subsequent siblings)
4 siblings, 0 replies; 17+ messages in thread
From: Henrik Rydberg @ 2010-09-03 12:17 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ping Cheng, Chris Bagwell, linux-input, linux-kernel, Ping Cheng,
Henrik Rydberg
From: Ping Cheng <pinglinux@gmail.com>
The Bamboo devices have multiple interfaces which need to be setup
separately. Use the HID parsing mechanism to achieve that.
Signed-off-by: Ping Cheng <pinglinux@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/input/tablet/wacom_sys.c | 44 ++++++++++++++++++++++++++++++-------
drivers/input/tablet/wacom_wac.h | 2 +
2 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index e510e4f..98cba08 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -195,17 +195,30 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
features->pktlen = WACOM_PKGLEN_TPC2FG;
features->device_type = BTN_TOOL_TRIPLETAP;
}
- features->x_max =
- get_unaligned_le16(&report[i + 3]);
- features->x_phy =
- get_unaligned_le16(&report[i + 6]);
- features->unit = report[i + 9];
- features->unitExpo = report[i + 11];
- i += 12;
+ if (features->type == BAMBOO_PT) {
+ /* need to reset back */
+ features->pktlen = WACOM_PKGLEN_BBTOUCH;
+ features->device_type = BTN_TOOL_TRIPLETAP;
+ features->x_phy =
+ get_unaligned_le16(&report[i + 5]);
+ features->x_max =
+ get_unaligned_le16(&report[i + 8]);
+ i += 15;
+ } else {
+ features->x_max =
+ get_unaligned_le16(&report[i + 3]);
+ features->x_phy =
+ get_unaligned_le16(&report[i + 6]);
+ features->unit = report[i + 9];
+ features->unitExpo = report[i + 11];
+ i += 12;
+ }
} else if (pen) {
/* penabled only accepts exact bytes of data */
if (features->type == TABLETPC2FG)
features->pktlen = WACOM_PKGLEN_GRAPHIRE;
+ if (features->type == BAMBOO_PT)
+ features->pktlen = WACOM_PKGLEN_BBFUN;
features->device_type = BTN_TOOL_PEN;
features->x_max =
get_unaligned_le16(&report[i + 3]);
@@ -234,6 +247,15 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
features->y_phy =
get_unaligned_le16(&report[i + 6]);
i += 7;
+ } else if (features->type == BAMBOO_PT) {
+ /* need to reset back */
+ features->pktlen = WACOM_PKGLEN_BBTOUCH;
+ features->device_type = BTN_TOOL_TRIPLETAP;
+ features->y_phy =
+ get_unaligned_le16(&report[i + 3]);
+ features->y_max =
+ get_unaligned_le16(&report[i + 6]);
+ i += 12;
} else {
features->y_max =
features->x_max;
@@ -245,6 +267,8 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
/* penabled only accepts exact bytes of data */
if (features->type == TABLETPC2FG)
features->pktlen = WACOM_PKGLEN_GRAPHIRE;
+ if (features->type == BAMBOO_PT)
+ features->pktlen = WACOM_PKGLEN_BBFUN;
features->device_type = BTN_TOOL_PEN;
features->y_max =
get_unaligned_le16(&report[i + 3]);
@@ -341,7 +365,8 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
features->distance_fuzz = 0;
/* only Tablet PCs need to retrieve the info */
- if ((features->type != TABLETPC) && (features->type != TABLETPC2FG))
+ if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) &&
+ (features->type != BAMBOO_PT))
goto out;
if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) {
@@ -499,7 +524,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
- if (features->type == TABLETPC || features->type == TABLETPC2FG) {
+ if (features->type == TABLETPC || features->type == TABLETPC2FG ||
+ features->type == BAMBOO_PT) {
/* Append the device type to the name */
strlcat(wacom_wac->name,
features->device_type == BTN_TOOL_PEN ?
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index d769e9a..fb30895 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -21,6 +21,7 @@
#define WACOM_PKGLEN_INTUOS 10
#define WACOM_PKGLEN_TPC1FG 5
#define WACOM_PKGLEN_TPC2FG 14
+#define WACOM_PKGLEN_BBTOUCH 20
/* device IDs */
#define STYLUS_DEVICE_ID 0x02
@@ -44,6 +45,7 @@ enum {
PTU,
PL,
DTU,
+ BAMBOO_PT,
INTUOS,
INTUOS3S,
INTUOS3,
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3)
2010-09-03 12:17 [PATCH 0/5] input: wacom: Initial support for Bamboo (rev2) Henrik Rydberg
2010-09-03 12:17 ` [PATCH 1/5] input: wacom: Add fuzz parameters to features Henrik Rydberg
2010-09-03 12:17 ` [PATCH 2/5] input: wacom: Parse the Bamboo device family Henrik Rydberg
@ 2010-09-03 12:17 ` Henrik Rydberg
2010-09-03 13:01 ` Ping Cheng
2010-09-03 18:24 ` Diego Calleja
2010-09-03 12:17 ` [PATCH 4/5] input: wacom: Collect device quirks into single function Henrik Rydberg
2010-09-03 12:17 ` [PATCH 5/5] input: wacom: Add a quirk for lowres Bamboo devices Henrik Rydberg
4 siblings, 2 replies; 17+ messages in thread
From: Henrik Rydberg @ 2010-09-03 12:17 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ping Cheng, Chris Bagwell, linux-input, linux-kernel, Henrik Rydberg
Add support for the Bamboo Touch trackpad, and make it work well with
both the Synaptics X Driver and the Multitouch X Driver. The device
uses MT slots internally, so the choice of protocol is a given.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/input/tablet/wacom_wac.c | 82 ++++++++++++++++++++++++++++++++++++++
drivers/input/tablet/wacom_wac.h | 3 +
2 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index bfe5654..a980306 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -855,6 +855,54 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
return retval;
}
+static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
+{
+ static int trkid;
+ struct input_dev *input = wacom->input;
+ unsigned char *data = wacom->data;
+ int sp = 0, sx = 0, sy = 0, count = 0;
+ int i;
+
+ if (len != WACOM_PKGLEN_BBTOUCH)
+ return 0;
+
+ for (i = 0; i < 2; i++) {
+ int p = data[9 * i + 2];
+ input_mt_slot(input, i);
+ if (p) {
+ int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
+ int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
+ input_report_abs(input, ABS_MT_PRESSURE, p);
+ input_report_abs(input, ABS_MT_POSITION_X, x);
+ input_report_abs(input, ABS_MT_POSITION_Y, y);
+ if (wacom->id[i] < 0)
+ wacom->id[i] = trkid++ & MAX_TRACKING_ID;
+ if (!count++)
+ sp = p, sx = x, sy = y;
+ } else {
+ wacom->id[i] = -1;
+ }
+ input_report_abs(input, ABS_MT_TRACKING_ID, wacom->id[i]);
+ }
+
+ input_report_key(input, BTN_TOUCH, count > 0);
+ input_report_key(input, BTN_TOOL_FINGER, count == 1);
+ input_report_key(input, BTN_TOOL_DOUBLETAP, count == 2);
+
+ input_report_abs(input, ABS_PRESSURE, sp);
+ input_report_abs(input, ABS_X, sx);
+ input_report_abs(input, ABS_Y, sy);
+
+ input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
+ input_report_key(input, BTN_MIDDLE, (data[1] & 0x04) != 0);
+ input_report_key(input, BTN_4, (data[1] & 0x02) != 0);
+ input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
+
+ input_sync(input);
+
+ return 0;
+}
+
void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
{
bool sync;
@@ -900,6 +948,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
sync = wacom_tpc_irq(wacom_wac, len);
break;
+ case BAMBOO_PT:
+ sync = wacom_bpt_irq(wacom_wac, len);
+ break;
+
default:
sync = false;
break;
@@ -1079,6 +1131,33 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
case PENPARTNER:
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
break;
+
+ case BAMBOO_PT:
+ __clear_bit(ABS_MISC, input_dev->absbit);
+
+ if (features->device_type == BTN_TOOL_TRIPLETAP) {
+ __set_bit(BTN_LEFT, input_dev->keybit);
+ __set_bit(BTN_MIDDLE, input_dev->keybit);
+ __set_bit(BTN_RIGHT, input_dev->keybit);
+ __set_bit(BTN_4, input_dev->keybit);
+
+ __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
+ __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
+
+ input_mt_create_slots(input_dev, 2);
+ input_set_abs_params(input_dev, ABS_MT_POSITION_X,
+ 0, features->x_max,
+ features->x_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
+ 0, features->y_max,
+ features->y_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_MT_PRESSURE,
+ 0, features->pressure_max,
+ features->pressure_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0,
+ MAX_TRACKING_ID, 0, 0);
+ }
+ break;
}
}
@@ -1216,6 +1295,8 @@ static const struct wacom_features wacom_features_0xE3 =
{ "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
static const struct wacom_features wacom_features_0x47 =
{ "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
+static struct wacom_features wacom_features_0xD0 =
+ { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
#define USB_DEVICE_WACOM(prod) \
USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
@@ -1280,6 +1361,7 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0xC6) },
{ USB_DEVICE_WACOM(0xC7) },
{ USB_DEVICE_WACOM(0xCE) },
+ { USB_DEVICE_WACOM(0xD0) },
{ USB_DEVICE_WACOM(0xF0) },
{ USB_DEVICE_WACOM(0xCC) },
{ USB_DEVICE_WACOM(0x90) },
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index fb30895..7717285 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -38,6 +38,9 @@
#define WACOM_REPORT_TPC1FG 6
#define WACOM_REPORT_TPC2FG 13
+/* largest reported tracking id */
+#define MAX_TRACKING_ID 0xfff
+
enum {
PENPARTNER = 0,
GRAPHIRE,
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* RE: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3)
2010-09-03 12:17 ` [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3) Henrik Rydberg
@ 2010-09-03 13:01 ` Ping Cheng
2010-09-03 18:24 ` Diego Calleja
1 sibling, 0 replies; 17+ messages in thread
From: Ping Cheng @ 2010-09-03 13:01 UTC (permalink / raw)
To: Henrik Rydberg, Dmitry Torokhov; +Cc: Chris Bagwell, linux-input, linux-kernel
-----Original Message-----
From: Henrik Rydberg [mailto:rydberg@euromail.se]
Sent: Friday, September 03, 2010 2:17 PM
To: Dmitry Torokhov
Cc: Ping Cheng; Chris Bagwell; linux-input@vger.kernel.org;
linux-kernel@vger.kernel.org; Henrik Rydberg
Subject: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch
trackpad (rev3)
Add support for the Bamboo Touch trackpad, and make it work well with
both the Synaptics X Driver and the Multitouch X Driver. The device
uses MT slots internally, so the choice of protocol is a given.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/input/tablet/wacom_wac.c | 82
++++++++++++++++++++++++++++++++++++++
drivers/input/tablet/wacom_wac.h | 3 +
2 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c
b/drivers/input/tablet/wacom_wac.c
index bfe5654..a980306 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -855,6 +855,54 @@ static int wacom_tpc_irq(struct wacom_wac *wacom,
size_t len)
return retval;
}
+static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
+{
+ static int trkid;
+ struct input_dev *input = wacom->input;
+ unsigned char *data = wacom->data;
+ int sp = 0, sx = 0, sy = 0, count = 0;
+ int i;
+
+ if (len != WACOM_PKGLEN_BBTOUCH)
+ return 0;
+
+ for (i = 0; i < 2; i++) {
+ int p = data[9 * i + 2];
+ input_mt_slot(input, i);
+ if (p) {
+ int x = get_unaligned_be16(&data[9 * i + 3]) &
0x7ff;
+ int y = get_unaligned_be16(&data[9 * i + 5]) &
0x7ff;
+ input_report_abs(input, ABS_MT_PRESSURE, p);
+ input_report_abs(input, ABS_MT_POSITION_X, x);
+ input_report_abs(input, ABS_MT_POSITION_Y, y);
+ if (wacom->id[i] < 0)
+ wacom->id[i] = trkid++ &
MAX_TRACKING_ID;
+ if (!count++)
+ sp = p, sx = x, sy = y;
+ } else {
+ wacom->id[i] = -1;
+ }
+ input_report_abs(input, ABS_MT_TRACKING_ID,
wacom->id[i]);
+ }
+
+ input_report_key(input, BTN_TOUCH, count > 0);
+ input_report_key(input, BTN_TOOL_FINGER, count == 1);
+ input_report_key(input, BTN_TOOL_DOUBLETAP, count == 2);
+
+ input_report_abs(input, ABS_PRESSURE, sp);
+ input_report_abs(input, ABS_X, sx);
+ input_report_abs(input, ABS_Y, sy);
+
+ input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
+ input_report_key(input, BTN_MIDDLE, (data[1] & 0x04) != 0);
+ input_report_key(input, BTN_4, (data[1] & 0x02) != 0);
+ input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
Since you are assigning meaningful defaults to three of the tablet
buttons instead of using BTN_#, can we move one more step to make the
fourth button useful out-of-box too? I am thinking of something like
BTN_FORWARD and BTN_BACK while getting rid of the BTN_MIDDLE. So, it
would be:
input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
Does this make sense to you?
Ping
+ input_sync(input);
+
+ return 0;
+}
+
void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
{
bool sync;
@@ -900,6 +948,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac,
size_t len)
sync = wacom_tpc_irq(wacom_wac, len);
break;
+ case BAMBOO_PT:
+ sync = wacom_bpt_irq(wacom_wac, len);
+ break;
+
default:
sync = false;
break;
@@ -1079,6 +1131,33 @@ void wacom_setup_input_capabilities(struct
input_dev *input_dev,
case PENPARTNER:
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
break;
+
+ case BAMBOO_PT:
+ __clear_bit(ABS_MISC, input_dev->absbit);
+
+ if (features->device_type == BTN_TOOL_TRIPLETAP) {
+ __set_bit(BTN_LEFT, input_dev->keybit);
+ __set_bit(BTN_MIDDLE, input_dev->keybit);
+ __set_bit(BTN_RIGHT, input_dev->keybit);
+ __set_bit(BTN_4, input_dev->keybit);
+
+ __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
+ __set_bit(BTN_TOOL_DOUBLETAP,
input_dev->keybit);
+
+ input_mt_create_slots(input_dev, 2);
+ input_set_abs_params(input_dev,
ABS_MT_POSITION_X,
+ 0, features->x_max,
+ features->x_fuzz, 0);
+ input_set_abs_params(input_dev,
ABS_MT_POSITION_Y,
+ 0, features->y_max,
+ features->y_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_MT_PRESSURE,
+ 0, features->pressure_max,
+ features->pressure_fuzz,
0);
+ input_set_abs_params(input_dev,
ABS_MT_TRACKING_ID, 0,
+ MAX_TRACKING_ID, 0, 0);
+ }
+ break;
}
}
@@ -1216,6 +1295,8 @@ static const struct wacom_features
wacom_features_0xE3 =
{ "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325,
255, 0, TABLETPC2FG };
static const struct wacom_features wacom_features_0x47 =
{ "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240,
1023, 31, INTUOS };
+static struct wacom_features wacom_features_0xD0 =
+ { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200,
1023, 63, BAMBOO_PT };
#define USB_DEVICE_WACOM(prod) \
USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
@@ -1280,6 +1361,7 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0xC6) },
{ USB_DEVICE_WACOM(0xC7) },
{ USB_DEVICE_WACOM(0xCE) },
+ { USB_DEVICE_WACOM(0xD0) },
{ USB_DEVICE_WACOM(0xF0) },
{ USB_DEVICE_WACOM(0xCC) },
{ USB_DEVICE_WACOM(0x90) },
diff --git a/drivers/input/tablet/wacom_wac.h
b/drivers/input/tablet/wacom_wac.h
index fb30895..7717285 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -38,6 +38,9 @@
#define WACOM_REPORT_TPC1FG 6
#define WACOM_REPORT_TPC2FG 13
+/* largest reported tracking id */
+#define MAX_TRACKING_ID 0xfff
+
enum {
PENPARTNER = 0,
GRAPHIRE,
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* RE: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3)
@ 2010-09-03 13:01 ` Ping Cheng
0 siblings, 0 replies; 17+ messages in thread
From: Ping Cheng @ 2010-09-03 13:01 UTC (permalink / raw)
To: Henrik Rydberg, Dmitry Torokhov; +Cc: Chris Bagwell, linux-input, linux-kernel
-----Original Message-----
From: Henrik Rydberg [mailto:rydberg@euromail.se]
Sent: Friday, September 03, 2010 2:17 PM
To: Dmitry Torokhov
Cc: Ping Cheng; Chris Bagwell; linux-input@vger.kernel.org;
linux-kernel@vger.kernel.org; Henrik Rydberg
Subject: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch
trackpad (rev3)
Add support for the Bamboo Touch trackpad, and make it work well with
both the Synaptics X Driver and the Multitouch X Driver. The device
uses MT slots internally, so the choice of protocol is a given.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/input/tablet/wacom_wac.c | 82
++++++++++++++++++++++++++++++++++++++
drivers/input/tablet/wacom_wac.h | 3 +
2 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c
b/drivers/input/tablet/wacom_wac.c
index bfe5654..a980306 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -855,6 +855,54 @@ static int wacom_tpc_irq(struct wacom_wac *wacom,
size_t len)
return retval;
}
+static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
+{
+ static int trkid;
+ struct input_dev *input = wacom->input;
+ unsigned char *data = wacom->data;
+ int sp = 0, sx = 0, sy = 0, count = 0;
+ int i;
+
+ if (len != WACOM_PKGLEN_BBTOUCH)
+ return 0;
+
+ for (i = 0; i < 2; i++) {
+ int p = data[9 * i + 2];
+ input_mt_slot(input, i);
+ if (p) {
+ int x = get_unaligned_be16(&data[9 * i + 3]) &
0x7ff;
+ int y = get_unaligned_be16(&data[9 * i + 5]) &
0x7ff;
+ input_report_abs(input, ABS_MT_PRESSURE, p);
+ input_report_abs(input, ABS_MT_POSITION_X, x);
+ input_report_abs(input, ABS_MT_POSITION_Y, y);
+ if (wacom->id[i] < 0)
+ wacom->id[i] = trkid++ &
MAX_TRACKING_ID;
+ if (!count++)
+ sp = p, sx = x, sy = y;
+ } else {
+ wacom->id[i] = -1;
+ }
+ input_report_abs(input, ABS_MT_TRACKING_ID,
wacom->id[i]);
+ }
+
+ input_report_key(input, BTN_TOUCH, count > 0);
+ input_report_key(input, BTN_TOOL_FINGER, count == 1);
+ input_report_key(input, BTN_TOOL_DOUBLETAP, count == 2);
+
+ input_report_abs(input, ABS_PRESSURE, sp);
+ input_report_abs(input, ABS_X, sx);
+ input_report_abs(input, ABS_Y, sy);
+
+ input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
+ input_report_key(input, BTN_MIDDLE, (data[1] & 0x04) != 0);
+ input_report_key(input, BTN_4, (data[1] & 0x02) != 0);
+ input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
Since you are assigning meaningful defaults to three of the tablet
buttons instead of using BTN_#, can we move one more step to make the
fourth button useful out-of-box too? I am thinking of something like
BTN_FORWARD and BTN_BACK while getting rid of the BTN_MIDDLE. So, it
would be:
input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
Does this make sense to you?
Ping
+ input_sync(input);
+
+ return 0;
+}
+
void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
{
bool sync;
@@ -900,6 +948,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac,
size_t len)
sync = wacom_tpc_irq(wacom_wac, len);
break;
+ case BAMBOO_PT:
+ sync = wacom_bpt_irq(wacom_wac, len);
+ break;
+
default:
sync = false;
break;
@@ -1079,6 +1131,33 @@ void wacom_setup_input_capabilities(struct
input_dev *input_dev,
case PENPARTNER:
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
break;
+
+ case BAMBOO_PT:
+ __clear_bit(ABS_MISC, input_dev->absbit);
+
+ if (features->device_type == BTN_TOOL_TRIPLETAP) {
+ __set_bit(BTN_LEFT, input_dev->keybit);
+ __set_bit(BTN_MIDDLE, input_dev->keybit);
+ __set_bit(BTN_RIGHT, input_dev->keybit);
+ __set_bit(BTN_4, input_dev->keybit);
+
+ __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
+ __set_bit(BTN_TOOL_DOUBLETAP,
input_dev->keybit);
+
+ input_mt_create_slots(input_dev, 2);
+ input_set_abs_params(input_dev,
ABS_MT_POSITION_X,
+ 0, features->x_max,
+ features->x_fuzz, 0);
+ input_set_abs_params(input_dev,
ABS_MT_POSITION_Y,
+ 0, features->y_max,
+ features->y_fuzz, 0);
+ input_set_abs_params(input_dev, ABS_MT_PRESSURE,
+ 0, features->pressure_max,
+ features->pressure_fuzz,
0);
+ input_set_abs_params(input_dev,
ABS_MT_TRACKING_ID, 0,
+ MAX_TRACKING_ID, 0, 0);
+ }
+ break;
}
}
@@ -1216,6 +1295,8 @@ static const struct wacom_features
wacom_features_0xE3 =
{ "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325,
255, 0, TABLETPC2FG };
static const struct wacom_features wacom_features_0x47 =
{ "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240,
1023, 31, INTUOS };
+static struct wacom_features wacom_features_0xD0 =
+ { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200,
1023, 63, BAMBOO_PT };
#define USB_DEVICE_WACOM(prod) \
USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
@@ -1280,6 +1361,7 @@ const struct usb_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0xC6) },
{ USB_DEVICE_WACOM(0xC7) },
{ USB_DEVICE_WACOM(0xCE) },
+ { USB_DEVICE_WACOM(0xD0) },
{ USB_DEVICE_WACOM(0xF0) },
{ USB_DEVICE_WACOM(0xCC) },
{ USB_DEVICE_WACOM(0x90) },
diff --git a/drivers/input/tablet/wacom_wac.h
b/drivers/input/tablet/wacom_wac.h
index fb30895..7717285 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -38,6 +38,9 @@
#define WACOM_REPORT_TPC1FG 6
#define WACOM_REPORT_TPC2FG 13
+/* largest reported tracking id */
+#define MAX_TRACKING_ID 0xfff
+
enum {
PENPARTNER = 0,
GRAPHIRE,
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3)
2010-09-03 13:01 ` Ping Cheng
(?)
@ 2010-09-03 13:06 ` Henrik Rydberg
2010-09-03 15:30 ` Ping Cheng
-1 siblings, 1 reply; 17+ messages in thread
From: Henrik Rydberg @ 2010-09-03 13:06 UTC (permalink / raw)
To: Ping Cheng; +Cc: Dmitry Torokhov, Chris Bagwell, linux-input, linux-kernel
On 09/03/2010 03:01 PM, Ping Cheng wrote:
[...]
> + input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
> + input_report_key(input, BTN_MIDDLE, (data[1] & 0x04) != 0);
> + input_report_key(input, BTN_4, (data[1] & 0x02) != 0);
> + input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
>
> Since you are assigning meaningful defaults to three of the tablet
> buttons instead of using BTN_#, can we move one more step to make the
> fourth button useful out-of-box too? I am thinking of something like
> BTN_FORWARD and BTN_BACK while getting rid of the BTN_MIDDLE. So, it
> would be:
>
> input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
> input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
> input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
> input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
>
> Does this make sense to you?
Well, this is all a matter of taste, isn't it. If middle-button emulation works
out of the box, for the benefit of us old X users who seem unwilling to ever let
go of the click-to-paste functionality, then I would not mind terribly.
Henrik
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3)
2010-09-03 13:06 ` Henrik Rydberg
@ 2010-09-03 15:30 ` Ping Cheng
2010-09-03 16:26 ` Dmitry Torokhov
0 siblings, 1 reply; 17+ messages in thread
From: Ping Cheng @ 2010-09-03 15:30 UTC (permalink / raw)
To: Henrik Rydberg
Cc: Ping Cheng, Dmitry Torokhov, Chris Bagwell, linux-input, linux-kernel
On Fri, Sep 3, 2010 at 3:06 PM, Henrik Rydberg <rydberg@euromail.se> wrote:
> On 09/03/2010 03:01 PM, Ping Cheng wrote:
> [...]
>
>> + input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
>> + input_report_key(input, BTN_MIDDLE, (data[1] & 0x04) != 0);
>> + input_report_key(input, BTN_4, (data[1] & 0x02) != 0);
>> + input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
>>
>> Since you are assigning meaningful defaults to three of the tablet
>> buttons instead of using BTN_#, can we move one more step to make the
>> fourth button useful out-of-box too? I am thinking of something like
>> BTN_FORWARD and BTN_BACK while getting rid of the BTN_MIDDLE. So, it
>> would be:
>>
>> input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
>> input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
>> input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
>> input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
>>
>> Does this make sense to you?
>
>
> Well, this is all a matter of taste, isn't it. If middle-button emulation works
> out of the box, for the benefit of us old X users who seem unwilling to ever let
> go of the click-to-paste functionality, then I would not mind terribly.
I agree and I use middle click more than right click myself ;). I just
wanted to give BTN_4 a life. If no one has a good suggestion for that,
I can live with it.
Ping
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3)
2010-09-03 15:30 ` Ping Cheng
@ 2010-09-03 16:26 ` Dmitry Torokhov
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry Torokhov @ 2010-09-03 16:26 UTC (permalink / raw)
To: Ping Cheng
Cc: Henrik Rydberg, Ping Cheng, Chris Bagwell, linux-input, linux-kernel
On Fri, Sep 03, 2010 at 05:30:27PM +0200, Ping Cheng wrote:
> On Fri, Sep 3, 2010 at 3:06 PM, Henrik Rydberg <rydberg@euromail.se> wrote:
> > On 09/03/2010 03:01 PM, Ping Cheng wrote:
> > [...]
> >
> >> + input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
> >> + input_report_key(input, BTN_MIDDLE, (data[1] & 0x04) != 0);
> >> + input_report_key(input, BTN_4, (data[1] & 0x02) != 0);
> >> + input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
> >>
> >> Since you are assigning meaningful defaults to three of the tablet
> >> buttons instead of using BTN_#, can we move one more step to make the
> >> fourth button useful out-of-box too? I am thinking of something like
> >> BTN_FORWARD and BTN_BACK while getting rid of the BTN_MIDDLE. So, it
> >> would be:
> >>
> >> input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
> >> input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
> >> input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
> >> input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
> >>
> >> Does this make sense to you?
> >
> >
> > Well, this is all a matter of taste, isn't it. If middle-button emulation works
> > out of the box, for the benefit of us old X users who seem unwilling to ever let
> > go of the click-to-paste functionality, then I would not mind terribly.
>
> I agree and I use middle click more than right click myself ;). I just
> wanted to give BTN_4 a life. If no one has a good suggestion for that,
> I can live with it.
>
Another option could be allowing usirs to remap buttons via EVIOGSKEYCODE.
--
Dmitry
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3)
@ 2010-09-03 16:26 ` Dmitry Torokhov
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry Torokhov @ 2010-09-03 16:26 UTC (permalink / raw)
To: Ping Cheng
Cc: Henrik Rydberg, Ping Cheng, Chris Bagwell, linux-input, linux-kernel
On Fri, Sep 03, 2010 at 05:30:27PM +0200, Ping Cheng wrote:
> On Fri, Sep 3, 2010 at 3:06 PM, Henrik Rydberg <rydberg@euromail.se> wrote:
> > On 09/03/2010 03:01 PM, Ping Cheng wrote:
> > [...]
> >
> >> + input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
> >> + input_report_key(input, BTN_MIDDLE, (data[1] & 0x04) != 0);
> >> + input_report_key(input, BTN_4, (data[1] & 0x02) != 0);
> >> + input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
> >>
> >> Since you are assigning meaningful defaults to three of the tablet
> >> buttons instead of using BTN_#, can we move one more step to make the
> >> fourth button useful out-of-box too? I am thinking of something like
> >> BTN_FORWARD and BTN_BACK while getting rid of the BTN_MIDDLE. So, it
> >> would be:
> >>
> >> input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
> >> input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
> >> input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
> >> input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
> >>
> >> Does this make sense to you?
> >
> >
> > Well, this is all a matter of taste, isn't it. If middle-button emulation works
> > out of the box, for the benefit of us old X users who seem unwilling to ever let
> > go of the click-to-paste functionality, then I would not mind terribly.
>
> I agree and I use middle click more than right click myself ;). I just
> wanted to give BTN_4 a life. If no one has a good suggestion for that,
> I can live with it.
>
Another option could be allowing usirs to remap buttons via EVIOGSKEYCODE.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3)
2010-09-03 12:17 ` [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3) Henrik Rydberg
@ 2010-09-03 18:24 ` Diego Calleja
2010-09-03 18:24 ` Diego Calleja
1 sibling, 0 replies; 17+ messages in thread
From: Diego Calleja @ 2010-09-03 18:24 UTC (permalink / raw)
To: Henrik Rydberg
Cc: Dmitry Torokhov, Ping Cheng, Chris Bagwell, linux-input, linux-kernel
On Viernes, 3 de Septiembre de 2010 14:17:25 Henrik Rydberg escribió:
> @@ -1280,6 +1361,7 @@ const struct usb_device_id wacom_ids[] = {
> { USB_DEVICE_WACOM(0xC6) },
> { USB_DEVICE_WACOM(0xC7) },
> { USB_DEVICE_WACOM(0xCE) },
> + { USB_DEVICE_WACOM(0xD0) },
> { USB_DEVICE_WACOM(0xF0) },
> { USB_DEVICE_WACOM(0xCC) },
> { USB_DEVICE_WACOM(0x90) },
I have a wacom bamboo touch & pen (CTH-461) with a 0xD2 id. Can I do
something to help to get it supported in these patches?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3)
@ 2010-09-03 18:24 ` Diego Calleja
0 siblings, 0 replies; 17+ messages in thread
From: Diego Calleja @ 2010-09-03 18:24 UTC (permalink / raw)
To: Henrik Rydberg
Cc: Dmitry Torokhov, Ping Cheng, Chris Bagwell, linux-input, linux-kernel
On Viernes, 3 de Septiembre de 2010 14:17:25 Henrik Rydberg escribió:
> @@ -1280,6 +1361,7 @@ const struct usb_device_id wacom_ids[] = {
> { USB_DEVICE_WACOM(0xC6) },
> { USB_DEVICE_WACOM(0xC7) },
> { USB_DEVICE_WACOM(0xCE) },
> + { USB_DEVICE_WACOM(0xD0) },
> { USB_DEVICE_WACOM(0xF0) },
> { USB_DEVICE_WACOM(0xCC) },
> { USB_DEVICE_WACOM(0x90) },
I have a wacom bamboo touch & pen (CTH-461) with a 0xD2 id. Can I do
something to help to get it supported in these patches?
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/5] input: wacom: Collect device quirks into single function
2010-09-03 12:17 [PATCH 0/5] input: wacom: Initial support for Bamboo (rev2) Henrik Rydberg
` (2 preceding siblings ...)
2010-09-03 12:17 ` [PATCH 3/5] input: wacom: Add support for the Bamboo Touch trackpad (rev3) Henrik Rydberg
@ 2010-09-03 12:17 ` Henrik Rydberg
2010-09-03 12:17 ` [PATCH 5/5] input: wacom: Add a quirk for lowres Bamboo devices Henrik Rydberg
4 siblings, 0 replies; 17+ messages in thread
From: Henrik Rydberg @ 2010-09-03 12:17 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ping Cheng, Chris Bagwell, linux-input, linux-kernel, Henrik Rydberg
Collect device-specific code into a single function, and use quirks to
flag specific behavior instead.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/input/tablet/wacom.h | 1 +
drivers/input/tablet/wacom_sys.c | 11 +++--------
drivers/input/tablet/wacom_wac.c | 16 ++++++++++++++++
drivers/input/tablet/wacom_wac.h | 4 ++++
4 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index 284dfaa..de5adb1 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -118,6 +118,7 @@ struct wacom {
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_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 98cba08..fc6fd53 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -381,12 +381,6 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
if (error)
goto out;
- /* touch device found but size is not defined. use default */
- if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) {
- features->x_max = 1023;
- features->y_max = 1023;
- }
-
out:
return error;
}
@@ -522,10 +516,11 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
if (error)
goto fail2;
+ wacom_setup_device_quirks(features);
+
strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
- if (features->type == TABLETPC || features->type == TABLETPC2FG ||
- features->type == BAMBOO_PT) {
+ if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
/* Append the device type to the name */
strlcat(wacom_wac->name,
features->device_type == BTN_TOOL_PEN ?
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index a980306..78e5345 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -993,6 +993,22 @@ 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)
+{
+
+ /* touch device found but size is not defined. use default */
+ if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) {
+ features->x_max = 1023;
+ features->y_max = 1023;
+ }
+
+ /* these device have multiple inputs */
+ if (features->type == TABLETPC || features->type == TABLETPC2FG ||
+ features->type == BAMBOO_PT)
+ features->quirks |= WACOM_QUIRK_MULTI_INPUT;
+}
+
void wacom_setup_input_capabilities(struct input_dev *input_dev,
struct wacom_wac *wacom_wac)
{
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 7717285..1284f33 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -41,6 +41,9 @@
/* largest reported tracking id */
#define MAX_TRACKING_ID 0xfff
+/* device quirks */
+#define WACOM_QUIRK_MULTI_INPUT 0x0001
+
enum {
PENPARTNER = 0,
GRAPHIRE,
@@ -82,6 +85,7 @@ struct wacom_features {
int y_fuzz;
int pressure_fuzz;
int distance_fuzz;
+ unsigned quirks;
};
struct wacom_shared {
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 5/5] input: wacom: Add a quirk for lowres Bamboo devices
2010-09-03 12:17 [PATCH 0/5] input: wacom: Initial support for Bamboo (rev2) Henrik Rydberg
` (3 preceding siblings ...)
2010-09-03 12:17 ` [PATCH 4/5] input: wacom: Collect device quirks into single function Henrik Rydberg
@ 2010-09-03 12:17 ` Henrik Rydberg
2010-09-03 12:47 ` Ping Cheng
4 siblings, 1 reply; 17+ messages in thread
From: Henrik Rydberg @ 2010-09-03 12:17 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Ping Cheng, Chris Bagwell, linux-input, linux-kernel, Henrik Rydberg
The Bamboo Touch reports a sub-screen resolution of 480x320.
The signal-to-noise ratio is only about 100, so filtering is
needed in order to reduce the jitter to a usable level. However,
the low resolution leads to round-off errors in the EWMA filter,
resulting in extremely jerky pointer motion. This patch explicitly
sets a higher resolution for those devices, and tells this to
the completion handler via a low-resolution quirk.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/input/tablet/wacom_wac.c | 15 +++++++++++++++
drivers/input/tablet/wacom_wac.h | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 78e5345..fd2d46a 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -858,6 +858,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
{
static int trkid;
+ struct wacom_features *features = &wacom->features;
struct input_dev *input = wacom->input;
unsigned char *data = wacom->data;
int sp = 0, sx = 0, sy = 0, count = 0;
@@ -872,6 +873,10 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
if (p) {
int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
+ if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
+ x <<= 5;
+ y <<= 5;
+ }
input_report_abs(input, ABS_MT_PRESSURE, p);
input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y);
@@ -1007,6 +1012,16 @@ void wacom_setup_device_quirks(struct wacom_features *features)
if (features->type == TABLETPC || features->type == TABLETPC2FG ||
features->type == BAMBOO_PT)
features->quirks |= WACOM_QUIRK_MULTI_INPUT;
+
+ /* quirks for bamboo touch */
+ if (features->x_max == 480 && features->y_max == 320) {
+ features->x_max = 15360;
+ features->y_max = 10240;
+ features->x_fuzz = 128;
+ features->y_fuzz = 128;
+ features->pressure_fuzz = 16;
+ features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES;
+ }
}
void wacom_setup_input_capabilities(struct input_dev *input_dev,
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 1284f33..b9de134 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -43,6 +43,7 @@
/* device quirks */
#define WACOM_QUIRK_MULTI_INPUT 0x0001
+#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002
enum {
PENPARTNER = 0,
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* RE: [PATCH 5/5] input: wacom: Add a quirk for lowres Bamboo devices
2010-09-03 12:17 ` [PATCH 5/5] input: wacom: Add a quirk for lowres Bamboo devices Henrik Rydberg
@ 2010-09-03 12:47 ` Ping Cheng
0 siblings, 0 replies; 17+ messages in thread
From: Ping Cheng @ 2010-09-03 12:47 UTC (permalink / raw)
To: Henrik Rydberg, Dmitry Torokhov; +Cc: Chris Bagwell, linux-input, linux-kernel
-----Original Message-----
From: Henrik Rydberg [mailto:rydberg@euromail.se]
Sent: Friday, September 03, 2010 2:17 PM
To: Dmitry Torokhov
Cc: Ping Cheng; Chris Bagwell; linux-input@vger.kernel.org;
linux-kernel@vger.kernel.org; Henrik Rydberg
Subject: [PATCH 5/5] input: wacom: Add a quirk for lowres Bamboo devices
The Bamboo Touch reports a sub-screen resolution of 480x320.
The signal-to-noise ratio is only about 100, so filtering is
needed in order to reduce the jitter to a usable level. However,
the low resolution leads to round-off errors in the EWMA filter,
resulting in extremely jerky pointer motion. This patch explicitly
sets a higher resolution for those devices, and tells this to
the completion handler via a low-resolution quirk.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/input/tablet/wacom_wac.c | 15 +++++++++++++++
drivers/input/tablet/wacom_wac.h | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c
b/drivers/input/tablet/wacom_wac.c
index 78e5345..fd2d46a 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -858,6 +858,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom,
size_t len)
static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
{
static int trkid;
+ struct wacom_features *features = &wacom->features;
struct input_dev *input = wacom->input;
unsigned char *data = wacom->data;
int sp = 0, sx = 0, sy = 0, count = 0;
@@ -872,6 +873,10 @@ static int wacom_bpt_irq(struct wacom_wac *wacom,
size_t len)
if (p) {
int x = get_unaligned_be16(&data[9 * i + 3]) &
0x7ff;
int y = get_unaligned_be16(&data[9 * i + 5]) &
0x7ff;
+ if (features->quirks &
WACOM_QUIRK_BBTOUCH_LOWRES) {
+ x <<= 5;
+ y <<= 5;
+ }
input_report_abs(input, ABS_MT_PRESSURE, p);
input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y);
@@ -1007,6 +1012,16 @@ void wacom_setup_device_quirks(struct
wacom_features *features)
if (features->type == TABLETPC || features->type == TABLETPC2FG
||
features->type == BAMBOO_PT)
features->quirks |= WACOM_QUIRK_MULTI_INPUT;
+
+ /* quirks for bamboo touch */
+ if (features->x_max == 480 && features->y_max == 320) {
A check on all Bamboo touch devices can be a generic way to cover all
Bamboos with touch feature (4 models). This check can be based on the
product id or features->type (== BAMBOO_PT) in combination with the
actual type (pen/touch) of the device. All Bamboo touch devices use the
same protocol.
+ features->x_max = 15360;
+ features->y_max = 10240;
I guess these two numbers rely on the original maxes: (480, 320). If so,
can we also make them generic by accessing features->x_max/y_max
directly?
+ features->x_fuzz = 128;
+ features->y_fuzz = 128;
+ features->pressure_fuzz = 16;
+ features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES;
+ }
}
void wacom_setup_input_capabilities(struct input_dev *input_dev,
diff --git a/drivers/input/tablet/wacom_wac.h
b/drivers/input/tablet/wacom_wac.h
index 1284f33..b9de134 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -43,6 +43,7 @@
/* device quirks */
#define WACOM_QUIRK_MULTI_INPUT 0x0001
+#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002
enum {
PENPARTNER = 0,
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* RE: [PATCH 5/5] input: wacom: Add a quirk for lowres Bamboo devices
@ 2010-09-03 12:47 ` Ping Cheng
0 siblings, 0 replies; 17+ messages in thread
From: Ping Cheng @ 2010-09-03 12:47 UTC (permalink / raw)
To: Henrik Rydberg, Dmitry Torokhov; +Cc: Chris Bagwell, linux-input, linux-kernel
-----Original Message-----
From: Henrik Rydberg [mailto:rydberg@euromail.se]
Sent: Friday, September 03, 2010 2:17 PM
To: Dmitry Torokhov
Cc: Ping Cheng; Chris Bagwell; linux-input@vger.kernel.org;
linux-kernel@vger.kernel.org; Henrik Rydberg
Subject: [PATCH 5/5] input: wacom: Add a quirk for lowres Bamboo devices
The Bamboo Touch reports a sub-screen resolution of 480x320.
The signal-to-noise ratio is only about 100, so filtering is
needed in order to reduce the jitter to a usable level. However,
the low resolution leads to round-off errors in the EWMA filter,
resulting in extremely jerky pointer motion. This patch explicitly
sets a higher resolution for those devices, and tells this to
the completion handler via a low-resolution quirk.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
drivers/input/tablet/wacom_wac.c | 15 +++++++++++++++
drivers/input/tablet/wacom_wac.h | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c
b/drivers/input/tablet/wacom_wac.c
index 78e5345..fd2d46a 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -858,6 +858,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom,
size_t len)
static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
{
static int trkid;
+ struct wacom_features *features = &wacom->features;
struct input_dev *input = wacom->input;
unsigned char *data = wacom->data;
int sp = 0, sx = 0, sy = 0, count = 0;
@@ -872,6 +873,10 @@ static int wacom_bpt_irq(struct wacom_wac *wacom,
size_t len)
if (p) {
int x = get_unaligned_be16(&data[9 * i + 3]) &
0x7ff;
int y = get_unaligned_be16(&data[9 * i + 5]) &
0x7ff;
+ if (features->quirks &
WACOM_QUIRK_BBTOUCH_LOWRES) {
+ x <<= 5;
+ y <<= 5;
+ }
input_report_abs(input, ABS_MT_PRESSURE, p);
input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y);
@@ -1007,6 +1012,16 @@ void wacom_setup_device_quirks(struct
wacom_features *features)
if (features->type == TABLETPC || features->type == TABLETPC2FG
||
features->type == BAMBOO_PT)
features->quirks |= WACOM_QUIRK_MULTI_INPUT;
+
+ /* quirks for bamboo touch */
+ if (features->x_max == 480 && features->y_max == 320) {
A check on all Bamboo touch devices can be a generic way to cover all
Bamboos with touch feature (4 models). This check can be based on the
product id or features->type (== BAMBOO_PT) in combination with the
actual type (pen/touch) of the device. All Bamboo touch devices use the
same protocol.
+ features->x_max = 15360;
+ features->y_max = 10240;
I guess these two numbers rely on the original maxes: (480, 320). If so,
can we also make them generic by accessing features->x_max/y_max
directly?
+ features->x_fuzz = 128;
+ features->y_fuzz = 128;
+ features->pressure_fuzz = 16;
+ features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES;
+ }
}
void wacom_setup_input_capabilities(struct input_dev *input_dev,
diff --git a/drivers/input/tablet/wacom_wac.h
b/drivers/input/tablet/wacom_wac.h
index 1284f33..b9de134 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -43,6 +43,7 @@
/* device quirks */
#define WACOM_QUIRK_MULTI_INPUT 0x0001
+#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002
enum {
PENPARTNER = 0,
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 5/5] input: wacom: Add a quirk for lowres Bamboo devices
2010-09-03 12:47 ` Ping Cheng
(?)
@ 2010-09-03 12:59 ` Henrik Rydberg
-1 siblings, 0 replies; 17+ messages in thread
From: Henrik Rydberg @ 2010-09-03 12:59 UTC (permalink / raw)
To: Ping Cheng; +Cc: Dmitry Torokhov, Chris Bagwell, linux-input, linux-kernel
On 09/03/2010 02:47 PM, Ping Cheng wrote:
[...]
> + /* quirks for bamboo touch */
> + if (features->x_max == 480 && features->y_max == 320) {
>
> A check on all Bamboo touch devices can be a generic way to cover all
> Bamboos with touch feature (4 models). This check can be based on the
> product id or features->type (== BAMBOO_PT) in combination with the
> actual type (pen/touch) of the device. All Bamboo touch devices use the
> same protocol.
I guess the only one who knows if there will be other resolutions reported for
BAMBOO_PT is you. :-) I wanted to not break any eventual resolution improvements
in the BAMBOO_PT family, but if you say there aren't any, using the BAMBOO_PT
check will be better, as you say.
> + features->x_max = 15360;
> + features->y_max = 10240;
>
> I guess these two numbers rely on the original maxes: (480, 320). If so,
> can we also make them generic by accessing features->x_max/y_max
> directly?
If you mean something like "features->x_max <<= 5", absolutely. Again, this all
depends on what resolutions are to be anticipated, and which ones should be
scaled this way.
Henrik
^ permalink raw reply [flat|nested] 17+ messages in thread