* [PATCH 0/3] input: wacom: Initial support for Bamboo @ 2010-09-02 18:18 Henrik Rydberg 2010-09-02 18:18 ` [PATCH 1/3] input: wacom: Add fuzz and scale features Henrik Rydberg ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Henrik Rydberg @ 2010-09-02 18:18 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Ping Cheng, Chris Bagwell, linux-input, Henrik Rydberg What was initially one patch has now grown to three, to better accomodate the comments received on the initial patch. The first patch extends the feature struct to better deal with fuzz and devices of low resolution. The second patch brings in code from the wacom project, preparing for the whole Bamboo family (somebody else should be the author on that one). The third patch is the second revision of the Bamboo Touch patch, hopefully taking all the comments into account. Ideally, Chris should be able to build on this patchset, adding support for the rest of the Bamboo tablets. Cheers, Henrik Henrik Rydberg (3): input: wacom: Add fuzz and scale features input: wacom: Parse the Bamboo device family input: wacom: Add support for the Bamboo Touch trackpad (rev2) drivers/input/tablet/wacom_sys.c | 62 +++++++++++++++++++++---- drivers/input/tablet/wacom_wac.c | 92 ++++++++++++++++++++++++++++++++++++- drivers/input/tablet/wacom_wac.h | 11 +++++ 3 files changed, 152 insertions(+), 13 deletions(-) ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] input: wacom: Add fuzz and scale features 2010-09-02 18:18 [PATCH 0/3] input: wacom: Initial support for Bamboo Henrik Rydberg @ 2010-09-02 18:18 ` Henrik Rydberg 2010-09-02 20:26 ` Dmitry Torokhov 2010-09-02 18:18 ` [PATCH 2/3] input: wacom: Parse the Bamboo device family Henrik Rydberg 2010-09-02 18:18 ` [PATCH 3/3] input: wacom: Add support for the Bamboo Touch trackpad (rev2) Henrik Rydberg 2 siblings, 1 reply; 9+ messages in thread From: Henrik Rydberg @ 2010-09-02 18:18 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Ping Cheng, Chris Bagwell, linux-input, Henrik Rydberg The signal-to-noise ratio varies between devices, but currently all devices are treated the same way. In addition, some devices report very low resolution, which makes the fuzz algorithm ineffective. Add fuzz and scale 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 | 12 +++++++++++- drivers/input/tablet/wacom_wac.c | 9 ++++++--- drivers/input/tablet/wacom_wac.h | 6 ++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 42ba369..979170e 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -219,6 +219,8 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi features->pressure_max = 255; i += 4; } + features->x_max *= features->x_scale; + features->x_fuzz *= features->x_scale; break; case HID_USAGE_Y: @@ -251,6 +253,8 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi i += 4; } } + features->y_max *= features->y_scale; + features->y_fuzz *= features->y_scale; break; case HID_USAGE_FINGER: @@ -333,8 +337,14 @@ 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; + features->x_scale = 1; + features->y_scale = 1; /* 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..51fce64 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h @@ -73,6 +73,12 @@ struct wacom_features { int y_phy; unsigned char unit; unsigned char unitExpo; + int x_fuzz; + int y_fuzz; + int pressure_fuzz; + int distance_fuzz; + int x_scale; + int y_scale; }; struct wacom_shared { -- 1.7.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] input: wacom: Add fuzz and scale features 2010-09-02 18:18 ` [PATCH 1/3] input: wacom: Add fuzz and scale features Henrik Rydberg @ 2010-09-02 20:26 ` Dmitry Torokhov 2010-09-02 20:58 ` Henrik Rydberg 0 siblings, 1 reply; 9+ messages in thread From: Dmitry Torokhov @ 2010-09-02 20:26 UTC (permalink / raw) To: Henrik Rydberg; +Cc: Ping Cheng, Chris Bagwell, linux-input Hi Henrik, On Thu, Sep 02, 2010 at 08:18:35PM +0200, Henrik Rydberg wrote: > The signal-to-noise ratio varies between devices, but currently all > devices are treated the same way. In addition, some devices report > very low resolution, which makes the fuzz algorithm ineffective. > Add fuzz and scale parameters to the feature struct, allowing for > tailored treatment of devices. > While we may adjust fuzz depending on the resolution scaling of the data is not kernel's task and should be left to userspace. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] input: wacom: Add fuzz and scale features 2010-09-02 20:26 ` Dmitry Torokhov @ 2010-09-02 20:58 ` Henrik Rydberg 0 siblings, 0 replies; 9+ messages in thread From: Henrik Rydberg @ 2010-09-02 20:58 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Ping Cheng, Chris Bagwell, linux-input On 09/02/2010 10:26 PM, Dmitry Torokhov wrote: > Hi Henrik, > > On Thu, Sep 02, 2010 at 08:18:35PM +0200, Henrik Rydberg wrote: >> The signal-to-noise ratio varies between devices, but currently all >> devices are treated the same way. In addition, some devices report >> very low resolution, which makes the fuzz algorithm ineffective. >> Add fuzz and scale parameters to the feature struct, allowing for >> tailored treatment of devices. >> > > While we may adjust fuzz depending on the resolution scaling of the > data is not kernel's task and should be left to userspace. The scaling introduced here is for round-off errors in the EWMA filter. Maybe the Bamboo Touch is a one-in-a-million case, but any device reporting a resolution lower than the screen will exhibit very jerky motion without such a scaling. I put the scaling among the features in an attempt to reduce special code across the driver. Henrik ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] input: wacom: Parse the Bamboo device family 2010-09-02 18:18 [PATCH 0/3] input: wacom: Initial support for Bamboo Henrik Rydberg 2010-09-02 18:18 ` [PATCH 1/3] input: wacom: Add fuzz and scale features Henrik Rydberg @ 2010-09-02 18:18 ` Henrik Rydberg 2010-09-02 21:08 ` Ping Cheng 2010-09-02 18:18 ` [PATCH 3/3] input: wacom: Add support for the Bamboo Touch trackpad (rev2) Henrik Rydberg 2 siblings, 1 reply; 9+ messages in thread From: Henrik Rydberg @ 2010-09-02 18:18 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Ping Cheng, Chris Bagwell, linux-input, Henrik Rydberg The Bamboo devices have multiple interfaces which need to be setup separately. Use the HID parsing mechanism to achieve that. 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 979170e..76e15d7 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]); @@ -236,6 +249,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; @@ -247,6 +269,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]); @@ -347,7 +371,8 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, features->y_scale = 1; /* 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)) { @@ -505,7 +530,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 51fce64..ff22e34 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] 9+ messages in thread
* Re: [PATCH 2/3] input: wacom: Parse the Bamboo device family 2010-09-02 18:18 ` [PATCH 2/3] input: wacom: Parse the Bamboo device family Henrik Rydberg @ 2010-09-02 21:08 ` Ping Cheng 0 siblings, 0 replies; 9+ messages in thread From: Ping Cheng @ 2010-09-02 21:08 UTC (permalink / raw) To: Henrik Rydberg Cc: Dmitry Torokhov, Ping Cheng, Chris Bagwell, linux-input@vger.kernel.org Hi Henrik, Thank you for the patchset. More comments inline. Ping On Thursday, September 2, 2010, Henrik Rydberg <rydberg@euromail.se> wrote: > The Bamboo devices have multiple interfaces which need to be setup > separately. Use the HID parsing mechanism to achieve that. > > Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Ping Cheng <pinglinux@gmail.com> And I am the author of the code. > --- > 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 979170e..76e15d7 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]); > @@ -236,6 +249,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; > @@ -247,6 +269,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]); > @@ -347,7 +371,8 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, > features->y_scale = 1; > > /* 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)) { > @@ -505,7 +530,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 51fce64..ff22e34 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 > > -- > 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] 9+ messages in thread
* [PATCH 3/3] input: wacom: Add support for the Bamboo Touch trackpad (rev2) 2010-09-02 18:18 [PATCH 0/3] input: wacom: Initial support for Bamboo Henrik Rydberg 2010-09-02 18:18 ` [PATCH 1/3] input: wacom: Add fuzz and scale features Henrik Rydberg 2010-09-02 18:18 ` [PATCH 2/3] input: wacom: Parse the Bamboo device family Henrik Rydberg @ 2010-09-02 18:18 ` Henrik Rydberg 2010-09-02 21:02 ` Ping Cheng 2 siblings, 1 reply; 9+ messages in thread From: Henrik Rydberg @ 2010-09-02 18:18 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Ping Cheng, Chris Bagwell, linux-input, 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_sys.c | 6 +++ drivers/input/tablet/wacom_wac.c | 83 ++++++++++++++++++++++++++++++++++++++ drivers/input/tablet/wacom_wac.h | 3 + 3 files changed, 92 insertions(+), 0 deletions(-) diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 76e15d7..ccc2d93 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -203,6 +203,10 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi get_unaligned_le16(&report[i + 5]); features->x_max = get_unaligned_le16(&report[i + 8]); + if (features->x_max == 480) { + features->x_scale = 32; + features->pressure_fuzz = 16; + } i += 15; } else { features->x_max = @@ -257,6 +261,8 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi get_unaligned_le16(&report[i + 3]); features->y_max = get_unaligned_le16(&report[i + 6]); + if (features->y_max == 320) + features->y_scale = 32; i += 12; } else { features->y_max = diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index bfe5654..8f93358 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -855,6 +855,57 @@ 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 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; + 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; + x *= features->x_scale; + y *= features->y_scale; + 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 +951,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 +1134,31 @@ 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) + break; + + __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 +1296,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 +1362,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 ff22e34..d070417 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] 9+ messages in thread
* Re: [PATCH 3/3] input: wacom: Add support for the Bamboo Touch trackpad (rev2) 2010-09-02 18:18 ` [PATCH 3/3] input: wacom: Add support for the Bamboo Touch trackpad (rev2) Henrik Rydberg @ 2010-09-02 21:02 ` Ping Cheng 2010-09-02 21:08 ` Henrik Rydberg 0 siblings, 1 reply; 9+ messages in thread From: Ping Cheng @ 2010-09-02 21:02 UTC (permalink / raw) To: Henrik Rydberg Cc: Dmitry Torokhov, Ping Cheng, Chris Bagwell, linux-input@vger.kernel.org On Thursday, September 2, 2010, Henrik Rydberg <rydberg@euromail.se> wrote: > 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_sys.c | 6 +++ > drivers/input/tablet/wacom_wac.c | 83 ++++++++++++++++++++++++++++++++++++++ > drivers/input/tablet/wacom_wac.h | 3 + > 3 files changed, 92 insertions(+), 0 deletions(-) > > diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c > index 76e15d7..ccc2d93 100644 > --- a/drivers/input/tablet/wacom_sys.c > +++ b/drivers/input/tablet/wacom_sys.c > @@ -203,6 +203,10 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi > get_unaligned_le16(&report[i + 5]); > features->x_max = > get_unaligned_le16(&report[i + 8]); > + if (features->x_max == 480) { > + features->x_scale = 32; > + features->pressure_fuzz = 16; > + } > i += 15; > } else { > features->x_max = > @@ -257,6 +261,8 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi > get_unaligned_le16(&report[i + 3]); > features->y_max = > get_unaligned_le16(&report[i + 6]); > + if (features->y_max == 320) > + features->y_scale = 32; > i += 12; > } else { > features->y_max = > diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c > index bfe5654..8f93358 100644 > --- a/drivers/input/tablet/wacom_wac.c > +++ b/drivers/input/tablet/wacom_wac.c > @@ -855,6 +855,57 @@ 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 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; > + 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; > + x *= features->x_scale; > + y *= features->y_scale; > + 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 +951,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 +1134,31 @@ 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) > + break; > + > + __set_bit(BTN_LEFT, input_dev->keybit); > + __set_bit(BTN_MIDDLE, input_dev->keybit); > + __set_bit(BTN_RIGHT, input_dev->keybit); An if-else is needed here instead of the break since there is a pen-only bamboo model in the market. If you don't have time to update it, you can leave it to Chris. He can make the changes when he work on the other models. Ping > + __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 +1296,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 +1362,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 ff22e34..d070417 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 > > -- > 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 > -- 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] 9+ messages in thread
* Re: [PATCH 3/3] input: wacom: Add support for the Bamboo Touch trackpad (rev2) 2010-09-02 21:02 ` Ping Cheng @ 2010-09-02 21:08 ` Henrik Rydberg 0 siblings, 0 replies; 9+ messages in thread From: Henrik Rydberg @ 2010-09-02 21:08 UTC (permalink / raw) To: Ping Cheng Cc: Dmitry Torokhov, Ping Cheng, Chris Bagwell, linux-input@vger.kernel.org On 09/02/2010 11:02 PM, Ping Cheng wrote: [...] >> @@ -1079,6 +1134,31 @@ 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) >> + break; >> + >> + __set_bit(BTN_LEFT, input_dev->keybit); >> + __set_bit(BTN_MIDDLE, input_dev->keybit); >> + __set_bit(BTN_RIGHT, input_dev->keybit); > > An if-else is needed here instead of the break since there is a > pen-only bamboo model in the market. If you don't have time to update > it, you can leave it to Chris. He can make the changes when he work on > the other models. Thanks, I can see that will make subsequent patches nicer. There will most likely be another round of patches, I will update it then, and leave the rest to Chris. Cheers, Henrik ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-09-02 21:10 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-02 18:18 [PATCH 0/3] input: wacom: Initial support for Bamboo Henrik Rydberg 2010-09-02 18:18 ` [PATCH 1/3] input: wacom: Add fuzz and scale features Henrik Rydberg 2010-09-02 20:26 ` Dmitry Torokhov 2010-09-02 20:58 ` Henrik Rydberg 2010-09-02 18:18 ` [PATCH 2/3] input: wacom: Parse the Bamboo device family Henrik Rydberg 2010-09-02 21:08 ` Ping Cheng 2010-09-02 18:18 ` [PATCH 3/3] input: wacom: Add support for the Bamboo Touch trackpad (rev2) Henrik Rydberg 2010-09-02 21:02 ` Ping Cheng 2010-09-02 21:08 ` Henrik Rydberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).