* [PATCH 0/6] Add support for new (3rd generation) Bamboo P&T's. @ 2011-10-17 1:29 chris 2011-10-17 1:29 ` [PATCH 1/6] Input: wacom - cleanup feature report for bamboos chris ` (5 more replies) 0 siblings, 6 replies; 11+ messages in thread From: chris @ 2011-10-17 1:29 UTC (permalink / raw) To: linux-input, dmitry.torokhov, pinglinux; +Cc: Chris Bagwell From: Chris Bagwell <chris@cnpbagwell.com> [ resending to correct mailing list. Sorry for duplat linux-kernel. ] Wacom has released in the last month a 3rd generation of their Bamboo Pen and Touch line and this patch series adds support for them all. There are 3 new models. 2 include stylus and touch support and can track up to 16 touches. 1 is a stylus only tablet. A squashed version of this patch series has been tested by 1 user for each tablet type over at linuxwacom-discuss mailing list. Chris Bagwell (6): Input: wacom - cleanup feature report for bamboos Input: wacom - remove unused bamboo HID parsing Input: wacom - add some comments to wacom_parse_hid Input: wacom - relax Bamboo stylus ID check Input: wacom - read 3rd gen Bamboo Touch HID data Input: wacom - 3rd gen Bamboo P&Touch packet support drivers/input/tablet/wacom_sys.c | 94 ++++++++++++++++++++++++++++++++--- drivers/input/tablet/wacom_wac.c | 101 ++++++++++++++++++++++++++++++++++---- drivers/input/tablet/wacom_wac.h | 4 +- 3 files changed, 179 insertions(+), 20 deletions(-) -- 1.7.6.4 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/6] Input: wacom - cleanup feature report for bamboos 2011-10-17 1:29 [PATCH 0/6] Add support for new (3rd generation) Bamboo P&T's chris @ 2011-10-17 1:29 ` chris 2011-10-17 1:29 ` [PATCH 2/6] Input: wacom - remove unused bamboo HID parsing chris ` (4 subsequent siblings) 5 siblings, 0 replies; 11+ messages in thread From: chris @ 2011-10-17 1:29 UTC (permalink / raw) To: linux-input, dmitry.torokhov, pinglinux; +Cc: Chris Bagwell From: Chris Bagwell <chris@cnpbagwell.com> Only the stylus interface on Bamboo's has a feature report that can be used to set to wacom mode. The touch interface only has 1 report mode and will return errors for those get/sets requests. The get request was always erroring out because it was not marked as an input request. Only down side of error was needlessly resending the set request 5 times. Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> --- drivers/input/tablet/wacom_sys.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index a205055..4f35473 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -66,7 +66,8 @@ static int wacom_get_report(struct usb_interface *intf, u8 type, u8 id, do { retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_REPORT, - USB_TYPE_CLASS | USB_RECIP_INTERFACE, + USB_DIR_IN | USB_TYPE_CLASS | + USB_RECIP_INTERFACE, (type << 8) + id, intf->altsetting[0].desc.bInterfaceNumber, buf, size, 100); @@ -362,7 +363,8 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat WAC_HID_FEATURE_REPORT, report_id, rep_data, 4, 1); } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); - } else if (features->type != TABLETPC) { + } else if (features->type != TABLETPC && + features->device_type == BTN_TOOL_PEN) { do { rep_data[0] = 2; rep_data[1] = 2; -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/6] Input: wacom - remove unused bamboo HID parsing 2011-10-17 1:29 [PATCH 0/6] Add support for new (3rd generation) Bamboo P&T's chris 2011-10-17 1:29 ` [PATCH 1/6] Input: wacom - cleanup feature report for bamboos chris @ 2011-10-17 1:29 ` chris 2011-10-20 21:17 ` Ping Cheng 2011-10-17 1:29 ` [PATCH 3/6] Input: wacom - add some comments to wacom_parse_hid chris ` (3 subsequent siblings) 5 siblings, 1 reply; 11+ messages in thread From: chris @ 2011-10-17 1:29 UTC (permalink / raw) To: linux-input, dmitry.torokhov, pinglinux; +Cc: Chris Bagwell From: Chris Bagwell <chris@cnpbagwell.com> Bamboo's do not declared a Digitizer-Stylus so the if() was never executed. wacom_features already contains correct stylus packet length. Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> --- drivers/input/tablet/wacom_sys.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 4f35473..620f0c3 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -245,8 +245,6 @@ 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->x_max = get_unaligned_le16(&report[i + 3]); @@ -295,8 +293,6 @@ 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]); -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/6] Input: wacom - remove unused bamboo HID parsing 2011-10-17 1:29 ` [PATCH 2/6] Input: wacom - remove unused bamboo HID parsing chris @ 2011-10-20 21:17 ` Ping Cheng 2011-10-21 17:26 ` Chris Bagwell 0 siblings, 1 reply; 11+ messages in thread From: Ping Cheng @ 2011-10-20 21:17 UTC (permalink / raw) To: chris; +Cc: linux-input, dmitry.torokhov On Sun, Oct 16, 2011 at 6:29 PM, <chris@cnpbagwell.com> wrote: > From: Chris Bagwell <chris@cnpbagwell.com> > > Bamboo's do not declared a Digitizer-Stylus so the if() was > never executed. wacom_features already contains correct stylus > packet length. Since this change affects all Bamboo series, I assume you have tested it with your old Bamboo pen and touch. If so, > Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> Acked-by: Ping Cheng <pingc@wacom.com> for the whole set. Ping > --- > drivers/input/tablet/wacom_sys.c | 4 ---- > 1 files changed, 0 insertions(+), 4 deletions(-) > > diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c > index 4f35473..620f0c3 100644 > --- a/drivers/input/tablet/wacom_sys.c > +++ b/drivers/input/tablet/wacom_sys.c > @@ -245,8 +245,6 @@ 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->x_max = > get_unaligned_le16(&report[i + 3]); > @@ -295,8 +293,6 @@ 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]); > -- > 1.7.6.4 > > -- 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] 11+ messages in thread
* Re: [PATCH 2/6] Input: wacom - remove unused bamboo HID parsing 2011-10-20 21:17 ` Ping Cheng @ 2011-10-21 17:26 ` Chris Bagwell 0 siblings, 0 replies; 11+ messages in thread From: Chris Bagwell @ 2011-10-21 17:26 UTC (permalink / raw) To: Ping Cheng; +Cc: linux-input, dmitry.torokhov On Thu, Oct 20, 2011 at 4:17 PM, Ping Cheng <pinglinux@gmail.com> wrote: > On Sun, Oct 16, 2011 at 6:29 PM, <chris@cnpbagwell.com> wrote: >> From: Chris Bagwell <chris@cnpbagwell.com> >> >> Bamboo's do not declared a Digitizer-Stylus so the if() was >> never executed. wacom_features already contains correct stylus >> packet length. > > Since this change affects all Bamboo series, I assume you have tested > it with your old Bamboo pen and touch. If so, Yes, been tested with 1st gen Bamboo as well. > >> Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> > > Acked-by: Ping Cheng <pingc@wacom.com> for the whole set. Thanks, Chris > > Ping > >> --- >> drivers/input/tablet/wacom_sys.c | 4 ---- >> 1 files changed, 0 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c >> index 4f35473..620f0c3 100644 >> --- a/drivers/input/tablet/wacom_sys.c >> +++ b/drivers/input/tablet/wacom_sys.c >> @@ -245,8 +245,6 @@ 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->x_max = >> get_unaligned_le16(&report[i + 3]); >> @@ -295,8 +293,6 @@ 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]); >> -- >> 1.7.6.4 >> >> > -- 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] 11+ messages in thread
* [PATCH 3/6] Input: wacom - add some comments to wacom_parse_hid 2011-10-17 1:29 [PATCH 0/6] Add support for new (3rd generation) Bamboo P&T's chris 2011-10-17 1:29 ` [PATCH 1/6] Input: wacom - cleanup feature report for bamboos chris 2011-10-17 1:29 ` [PATCH 2/6] Input: wacom - remove unused bamboo HID parsing chris @ 2011-10-17 1:29 ` chris 2011-10-17 1:29 ` [PATCH 4/6] Input: wacom - relax Bamboo stylus ID check chris ` (2 subsequent siblings) 5 siblings, 0 replies; 11+ messages in thread From: chris @ 2011-10-17 1:29 UTC (permalink / raw) To: linux-input, dmitry.torokhov, pinglinux; +Cc: Chris Bagwell From: Chris Bagwell <chris@cnpbagwell.com> Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> --- drivers/input/tablet/wacom_sys.c | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 620f0c3..5e1539c 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -165,7 +165,36 @@ static void wacom_close(struct input_dev *dev) usb_autopm_put_interface(wacom->intf); } -static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, +/* Interface Descriptor of wacom devices can be incomplete and + * inconsistent so wacom_features table is used to store stylus + * device's packet lengths, various maximum values, and tablet + * resolution based on product ID's. + * + * For devices that contain 2 interfaces, wacom_features table is + * inaccurate for the touch interface. Since the Interface Descriptor + * for touch interfaces has pretty complete data, this function exists + * to query tablet for this missing information instead of hard coding in + * an additional table. + * + * A typical Interface Descriptor for a stylus will contain a + * boot mouse application collection that is not of interest and this + * function will ignore it. + * + * It also contains a digitizer application collection that also is not + * of interest since any information it contains would be duplicate + * of what is in wacom_features. Usually it defines a report of an array + * of bytes that could be used as max length of the stylus packet returned. + * If it happens to define a Digitizer-Stylus Physical Collection then + * the X and Y logical values contain valid data but it is ignored. + * + * A typical Interface Descriptor for a touch interface will contain a + * Digitizer-Finger Physical Collection which will define both logical + * X/Y maximum as well as the physical size of tablet. Since touch + * interfaces haven't supported pressure or distance, this is enough + * information to override invalid values in the wacom_features table. + */ +static int wacom_parse_hid(struct usb_interface *intf, + struct hid_descriptor *hid_desc, struct wacom_features *features) { struct usb_device *dev = interface_to_usbdev(intf); @@ -306,6 +335,11 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi i++; break; + /* + * Requiring Stylus Usage will ignore boot mouse + * X/Y values and some cases of invalid Digitizer X/Y + * values commonly reported. + */ case HID_USAGE_STYLUS: pen = 1; i++; -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/6] Input: wacom - relax Bamboo stylus ID check 2011-10-17 1:29 [PATCH 0/6] Add support for new (3rd generation) Bamboo P&T's chris ` (2 preceding siblings ...) 2011-10-17 1:29 ` [PATCH 3/6] Input: wacom - add some comments to wacom_parse_hid chris @ 2011-10-17 1:29 ` chris 2011-10-17 1:29 ` [PATCH 5/6] Input: wacom - read 3rd gen Bamboo Touch HID data chris 2011-10-17 1:29 ` [PATCH 6/6] Input: wacom - 3rd gen Bamboo P&Touch packet support chris 5 siblings, 0 replies; 11+ messages in thread From: chris @ 2011-10-17 1:29 UTC (permalink / raw) To: linux-input, dmitry.torokhov, pinglinux; +Cc: Chris Bagwell From: Chris Bagwell <chris@cnpbagwell.com> Bit 0x02 always means tip versus eraser. Bit 0x01 is something related to version of stylus and different values are starting to be used. Relaxing proximity check is required to be used with 3rd generation Bamboo Pen and Touch tablets. Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> --- drivers/input/tablet/wacom_wac.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 7fefd93..d1ced32 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -842,12 +842,7 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) unsigned char *data = wacom->data; int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; - /* - * Similar to Graphire protocol, data[1] & 0x20 is proximity and - * data[1] & 0x18 is tool ID. 0x30 is safety check to ignore - * 2 unused tool ID's. - */ - prox = (data[1] & 0x30) == 0x30; + prox = (data[1] & 0x20) == 0x20; /* * All reports shared between PEN and RUBBER tool must be -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/6] Input: wacom - read 3rd gen Bamboo Touch HID data 2011-10-17 1:29 [PATCH 0/6] Add support for new (3rd generation) Bamboo P&T's chris ` (3 preceding siblings ...) 2011-10-17 1:29 ` [PATCH 4/6] Input: wacom - relax Bamboo stylus ID check chris @ 2011-10-17 1:29 ` chris 2011-10-21 2:53 ` Dmitry Torokhov 2011-10-17 1:29 ` [PATCH 6/6] Input: wacom - 3rd gen Bamboo P&Touch packet support chris 5 siblings, 1 reply; 11+ messages in thread From: chris @ 2011-10-17 1:29 UTC (permalink / raw) To: linux-input, dmitry.torokhov, pinglinux; +Cc: Chris Bagwell From: Chris Bagwell <chris@cnpbagwell.com> Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> --- drivers/input/tablet/wacom_sys.c | 48 ++++++++++++++++++++++++++++++++++++- 1 files changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 5e1539c..d19886a 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -28,7 +28,9 @@ #define HID_USAGE_Y_TILT 0x3e #define HID_USAGE_FINGER 0x22 #define HID_USAGE_STYLUS 0x20 -#define HID_COLLECTION 0xc0 +#define HID_COLLECTION 0xa1 +#define HID_COLLECTION_LOGICAL 0x02 +#define HID_COLLECTION_END 0xc0 enum { WCM_UNDEFINED = 0, @@ -165,6 +167,34 @@ static void wacom_close(struct input_dev *dev) usb_autopm_put_interface(wacom->intf); } +static int wacom_parse_logical_collection(unsigned char *report, + struct wacom_features *features) +{ + int length = 0; + + if (features->type == BAMBOO_PT) { + + /* Logical collection is only used by 3rd gen Bamboo Touch */ + features->pktlen = WACOM_PKGLEN_BBTOUCH3; + features->device_type = BTN_TOOL_DOUBLETAP; + + /* + * Stylus and Touch have same active area + * so compute physical size based on stylus + * data before its overwritten. + */ + features->x_phy = (features->x_max * features->x_resolution) + / 100; + features->y_phy = (features->y_max * features->y_resolution) + / 100; + + features->x_max = features->y_max = + get_unaligned_le16(&report[10]); + length = 11; + } + return length; +} + /* Interface Descriptor of wacom devices can be incomplete and * inconsistent so wacom_features table is used to store stylus * device's packet lengths, various maximum values, and tablet @@ -192,6 +222,10 @@ static void wacom_close(struct input_dev *dev) * X/Y maximum as well as the physical size of tablet. Since touch * interfaces haven't supported pressure or distance, this is enough * information to override invalid values in the wacom_features table. + * + * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical + * Collection. Instead they define a Logical Collection with a single + * Logical Maximum for both X and Y. */ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, @@ -354,10 +388,20 @@ static int wacom_parse_hid(struct usb_interface *intf, } break; - case HID_COLLECTION: + case HID_COLLECTION_END: /* reset UsagePage and Finger */ finger = usage = 0; break; + + case HID_COLLECTION: + i++; + switch (report[i]) { + case HID_COLLECTION_LOGICAL: + i += wacom_parse_logical_collection(&report[i], + features); + break; + } + break; } } -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 5/6] Input: wacom - read 3rd gen Bamboo Touch HID data 2011-10-17 1:29 ` [PATCH 5/6] Input: wacom - read 3rd gen Bamboo Touch HID data chris @ 2011-10-21 2:53 ` Dmitry Torokhov 2011-10-21 17:29 ` Chris Bagwell 0 siblings, 1 reply; 11+ messages in thread From: Dmitry Torokhov @ 2011-10-21 2:53 UTC (permalink / raw) To: chris; +Cc: linux-input, pinglinux On Sunday, October 16, 2011 06:29:40 PM chris@cnpbagwell.com wrote: > From: Chris Bagwell <chris@cnpbagwell.com> > > Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> > --- > drivers/input/tablet/wacom_sys.c | 48 > ++++++++++++++++++++++++++++++++++++- 1 files changed, 46 > insertions(+), 2 deletions(-) > > diff --git a/drivers/input/tablet/wacom_sys.c > b/drivers/input/tablet/wacom_sys.c index 5e1539c..d19886a 100644 > --- a/drivers/input/tablet/wacom_sys.c > +++ b/drivers/input/tablet/wacom_sys.c > @@ -28,7 +28,9 @@ > #define HID_USAGE_Y_TILT 0x3e > #define HID_USAGE_FINGER 0x22 > #define HID_USAGE_STYLUS 0x20 > -#define HID_COLLECTION 0xc0 > +#define HID_COLLECTION 0xa1 > +#define HID_COLLECTION_LOGICAL 0x02 > +#define HID_COLLECTION_END 0xc0 > > enum { > WCM_UNDEFINED = 0, > @@ -165,6 +167,34 @@ static void wacom_close(struct input_dev *dev) > usb_autopm_put_interface(wacom->intf); > } > > +static int wacom_parse_logical_collection(unsigned char *report, > + struct wacom_features *features) > +{ > + int length = 0; > + > + if (features->type == BAMBOO_PT) { > + > + /* Logical collection is only used by 3rd gen Bamboo Touch */ > + features->pktlen = WACOM_PKGLEN_BBTOUCH3; Compile dies here because WACOM_PKGLEN_BBTOUCH3 is defined in the next patch. Please make sure the series is bisectable. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/6] Input: wacom - read 3rd gen Bamboo Touch HID data 2011-10-21 2:53 ` Dmitry Torokhov @ 2011-10-21 17:29 ` Chris Bagwell 0 siblings, 0 replies; 11+ messages in thread From: Chris Bagwell @ 2011-10-21 17:29 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input, pinglinux On Thu, Oct 20, 2011 at 9:53 PM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > On Sunday, October 16, 2011 06:29:40 PM chris@cnpbagwell.com wrote: >> From: Chris Bagwell <chris@cnpbagwell.com> >> >> Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> >> --- >> drivers/input/tablet/wacom_sys.c | 48 >> ++++++++++++++++++++++++++++++++++++- 1 files changed, 46 >> insertions(+), 2 deletions(-) >> >> diff --git a/drivers/input/tablet/wacom_sys.c >> b/drivers/input/tablet/wacom_sys.c index 5e1539c..d19886a 100644 >> --- a/drivers/input/tablet/wacom_sys.c >> +++ b/drivers/input/tablet/wacom_sys.c >> @@ -28,7 +28,9 @@ >> #define HID_USAGE_Y_TILT 0x3e >> #define HID_USAGE_FINGER 0x22 >> #define HID_USAGE_STYLUS 0x20 >> -#define HID_COLLECTION 0xc0 >> +#define HID_COLLECTION 0xa1 >> +#define HID_COLLECTION_LOGICAL 0x02 >> +#define HID_COLLECTION_END 0xc0 >> >> enum { >> WCM_UNDEFINED = 0, >> @@ -165,6 +167,34 @@ static void wacom_close(struct input_dev *dev) >> usb_autopm_put_interface(wacom->intf); >> } >> >> +static int wacom_parse_logical_collection(unsigned char *report, >> + struct wacom_features *features) >> +{ >> + int length = 0; >> + >> + if (features->type == BAMBOO_PT) { >> + >> + /* Logical collection is only used by 3rd gen Bamboo Touch */ >> + features->pktlen = WACOM_PKGLEN_BBTOUCH3; > > Compile dies here because WACOM_PKGLEN_BBTOUCH3 is defined in the > next patch. > > Please make sure the series is bisectable. Ah, yes. I will resend. I reordered this one patch right before submitting. I should have compiled each patch after that. Thank you for feedback, Chris > > Thanks. > > -- > 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] 11+ messages in thread
* [PATCH 6/6] Input: wacom - 3rd gen Bamboo P&Touch packet support 2011-10-17 1:29 [PATCH 0/6] Add support for new (3rd generation) Bamboo P&T's chris ` (4 preceding siblings ...) 2011-10-17 1:29 ` [PATCH 5/6] Input: wacom - read 3rd gen Bamboo Touch HID data chris @ 2011-10-17 1:29 ` chris 5 siblings, 0 replies; 11+ messages in thread From: chris @ 2011-10-17 1:29 UTC (permalink / raw) To: linux-input, dmitry.torokhov, pinglinux; +Cc: Chris Bagwell From: Chris Bagwell <chris@cnpbagwell.com> 3rd generation Bamboo Pen and Touch tablets reuse the older stylus packet but add an extra fixed zero pad byte to end. The touch packets are quite different since it supports tracking of up to 16 touches. The packet is 64-byte fixed size but contains up to 15 smaller messages indicating data for a single touch or for tablet button presses. Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> --- drivers/input/tablet/wacom_wac.c | 94 ++++++++++++++++++++++++++++++++++++-- drivers/input/tablet/wacom_wac.h | 4 +- 2 files changed, 93 insertions(+), 5 deletions(-) diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index d1ced32..d142023 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -836,6 +836,64 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) return 0; } +static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) +{ + struct input_dev *input = wacom->input; + int slot_id = data[0] - 2; + bool touch = data[1] & 0x80; + + touch = touch && !wacom->shared->stylus_in_proximity; + + input_mt_slot(input, slot_id); + input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); + + if (touch) { + int x = (data[2] << 4) | (data[4] >> 4); + int y = (data[3] << 4) | (data[4] & 0x0f); + int w = data[6]; + + input_report_abs(input, ABS_MT_POSITION_X, x); + input_report_abs(input, ABS_MT_POSITION_Y, y); + input_report_abs(input, ABS_MT_TOUCH_MAJOR, w); + } +} + +static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) +{ + struct input_dev *input = wacom->input; + + 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); +} + +static int wacom_bpt3_touch(struct wacom_wac *wacom) +{ + struct input_dev *input = wacom->input; + unsigned char *data = wacom->data; + int count = data[1] & 0x03; + int i; + + /* data has up to 7 fixed sized 8-byte messages starting at data[2] */ + for (i = 0; i < count && i < 8; i++) { + int offset = (8 * i)+2; + int msg_id = data[offset]; + + if (msg_id >= 2 && msg_id <= 17) + wacom_bpt3_touch_msg(wacom, data+offset); + else if (msg_id == 128) + wacom_bpt3_button_msg(wacom, data+offset); + + } + + input_mt_report_pointer_emulation(input, true); + + input_sync(input); + + return 0; +} + static int wacom_bpt_pen(struct wacom_wac *wacom) { struct input_dev *input = wacom->input; @@ -906,7 +964,9 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) { if (len == WACOM_PKGLEN_BBTOUCH) return wacom_bpt_touch(wacom); - else if (len == WACOM_PKGLEN_BBFUN) + else if (len == WACOM_PKGLEN_BBTOUCH3) + return wacom_bpt3_touch(wacom); + else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN) return wacom_bpt_pen(wacom); return 0; @@ -1025,9 +1085,9 @@ void wacom_setup_device_quirks(struct wacom_features *features) features->type == BAMBOO_PT) features->quirks |= WACOM_QUIRK_MULTI_INPUT; - /* quirks for bamboo touch */ + /* quirk for bamboo touch with 2 low res touches */ if (features->type == BAMBOO_PT && - features->device_type == BTN_TOOL_DOUBLETAP) { + features->pktlen == WACOM_PKGLEN_BBTOUCH) { features->x_max <<= 5; features->y_max <<= 5; features->x_fuzz <<= 5; @@ -1213,7 +1273,21 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, __set_bit(BTN_TOOL_FINGER, input_dev->keybit); __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); - input_mt_init_slots(input_dev, 2); + if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { + __set_bit(BTN_TOOL_TRIPLETAP, + input_dev->keybit); + __set_bit(BTN_TOOL_QUADTAP, + input_dev->keybit); + + input_mt_init_slots(input_dev, 16); + + input_set_abs_params(input_dev, + ABS_MT_TOUCH_MAJOR, + 0, 255, 0, 0); + } else { + input_mt_init_slots(input_dev, 2); + } + input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, features->x_max, features->x_fuzz, 0); @@ -1479,6 +1553,15 @@ static const struct wacom_features wacom_features_0xDA = static struct wacom_features wacom_features_0xDB = { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +static const struct wacom_features wacom_features_0xDD = + { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +static const struct wacom_features wacom_features_0xDE = + { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +static const struct wacom_features wacom_features_0xDF = + { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023, + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; static const struct wacom_features wacom_features_0x6004 = { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; @@ -1574,6 +1657,9 @@ const struct usb_device_id wacom_ids[] = { { USB_DEVICE_WACOM(0xD8) }, { USB_DEVICE_WACOM(0xDA) }, { USB_DEVICE_WACOM(0xDB) }, + { USB_DEVICE_WACOM(0xDD) }, + { USB_DEVICE_WACOM(0xDE) }, + { USB_DEVICE_WACOM(0xDF) }, { 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 53eb71b..d54ffcb 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h @@ -12,7 +12,7 @@ #include <linux/types.h> /* maximum packet length for USB devices */ -#define WACOM_PKGLEN_MAX 32 +#define WACOM_PKGLEN_MAX 64 /* packet length for individual models */ #define WACOM_PKGLEN_PENPRTN 7 @@ -22,6 +22,8 @@ #define WACOM_PKGLEN_TPC1FG 5 #define WACOM_PKGLEN_TPC2FG 14 #define WACOM_PKGLEN_BBTOUCH 20 +#define WACOM_PKGLEN_BBPEN 10 +#define WACOM_PKGLEN_BBTOUCH3 64 /* device IDs */ #define STYLUS_DEVICE_ID 0x02 -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-10-21 17:29 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-10-17 1:29 [PATCH 0/6] Add support for new (3rd generation) Bamboo P&T's chris 2011-10-17 1:29 ` [PATCH 1/6] Input: wacom - cleanup feature report for bamboos chris 2011-10-17 1:29 ` [PATCH 2/6] Input: wacom - remove unused bamboo HID parsing chris 2011-10-20 21:17 ` Ping Cheng 2011-10-21 17:26 ` Chris Bagwell 2011-10-17 1:29 ` [PATCH 3/6] Input: wacom - add some comments to wacom_parse_hid chris 2011-10-17 1:29 ` [PATCH 4/6] Input: wacom - relax Bamboo stylus ID check chris 2011-10-17 1:29 ` [PATCH 5/6] Input: wacom - read 3rd gen Bamboo Touch HID data chris 2011-10-21 2:53 ` Dmitry Torokhov 2011-10-21 17:29 ` Chris Bagwell 2011-10-17 1:29 ` [PATCH 6/6] Input: wacom - 3rd gen Bamboo P&Touch packet support chris
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).