* [PATCH 5/5] input: wacom - retrieve maximum number of contacts
@ 2011-08-13 0:10 Ping Cheng
2011-08-15 3:37 ` Chris Bagwell
0 siblings, 1 reply; 3+ messages in thread
From: Ping Cheng @ 2011-08-13 0:10 UTC (permalink / raw)
To: linux-input; +Cc: dmitry.torokhov, Ping Cheng, Ping Cheng
Retrieve it from the HID descriptor when it is available
Signed-off-by: Ping Cheng <pingc@wacom.com>
---
drivers/input/tablet/wacom_sys.c | 23 ++++++++++++++++++++++-
drivers/input/tablet/wacom_wac.h | 1 +
2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 958b4eb..6fb292d 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -28,6 +28,7 @@
#define HID_USAGE_Y_TILT 0x3e
#define HID_USAGE_FINGER 0x22
#define HID_USAGE_STYLUS 0x20
+#define HID_MT_CONTACTMAX 0x55
#define HID_COLLECTION 0xc0
enum {
@@ -151,11 +152,16 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
int result = 0;
int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0;
unsigned char *report;
+ unsigned char *rep_data;
report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL);
if (!report)
return -ENOMEM;
+ rep_data = kmalloc(2, GFP_KERNEL);
+ if (!rep_data)
+ return -ENOMEM;
+
/* retrive report descriptors */
do {
result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
@@ -284,6 +290,19 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
pen = 1;
i++;
break;
+
+ case HID_MT_CONTACTMAX:
+ do {
+ rep_data[0] = 12;
+ result = usb_get_report(intf,
+ WAC_HID_FEATURE_REPORT, rep_data[0],
+ rep_data, 2);
+ } while ((result < 0) && (limit++ < WAC_MSG_RETRIES));
+
+ if ((result >= 0) && (rep_data[1] > 2))
+ features->touch_max = rep_data[1];
+ i++;
+ break;
}
break;
@@ -297,6 +316,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
out:
result = 0;
kfree(report);
+ kfree(rep_data);
return result;
}
@@ -505,7 +525,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
endpoint = &intf->cur_altsetting->endpoint[0].desc;
- /* Retrieve the physical and logical size for OEM devices */
+ /* Retrieve the physical and logical size for touch devices */
+ features->touch_max = 0;
error = wacom_retrieve_hid_descriptor(intf, features);
if (error)
goto fail3;
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 53eb71b..e19e435 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -86,6 +86,7 @@ struct wacom_features {
int pressure_fuzz;
int distance_fuzz;
unsigned quirks;
+ unsigned touch_max;
};
struct wacom_shared {
--
1.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 5/5] input: wacom - retrieve maximum number of contacts
2011-08-13 0:10 [PATCH 5/5] input: wacom - retrieve maximum number of contacts Ping Cheng
@ 2011-08-15 3:37 ` Chris Bagwell
[not found] ` <CAF8JNhLOQo_HdrXrjbDJqx_M6Mcb0puXJ80vNPaQeY1kOr-UNA@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Chris Bagwell @ 2011-08-15 3:37 UTC (permalink / raw)
To: Ping Cheng; +Cc: linux-input, dmitry.torokhov, Ping Cheng
On Fri, Aug 12, 2011 at 7:10 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> Retrieve it from the HID descriptor when it is available
Were you going to use touch_max for something (since its not referenced)?
Related to Bamboo's and pressure, does this happen to report 4 touches
on the newer Bamboo's that do not support pressure? I haven't looked
at my 0xd1 Bamboo but I suspect either contact count is not returned
or returns 2 (or maybe 3) contacts.
I'm hoping there is a way to detect differences in touch packet format
besides resorting to a quirks list.
Chris
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5/5] input: wacom - retrieve maximum number of contacts
[not found] ` <CAF8JNhLOQo_HdrXrjbDJqx_M6Mcb0puXJ80vNPaQeY1kOr-UNA@mail.gmail.com>
@ 2011-08-17 6:52 ` Dmitry Torokhov
0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2011-08-17 6:52 UTC (permalink / raw)
To: Ping Cheng; +Cc: Chris Bagwell, linux-input
On Mon, Aug 15, 2011 at 09:12:16PM -0700, Ping Cheng wrote:
> On Sun, Aug 14, 2011 at 8:37 PM, Chris Bagwell <chris@cnpbagwell.com> wrote:
>
> > On Fri, Aug 12, 2011 at 7:10 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> > > Retrieve it from the HID descriptor when it is available
> >
> > Were you going to use touch_max for something (since its not referenced)?
> >
>
> This set of patches is only a clean-up and preparation for the coming set of
> patches. The value will be used then.
OK, then I think it is best to submit this one with that set. I applied
the other 3 patches, but not the 'pressure' one.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-17 6:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-13 0:10 [PATCH 5/5] input: wacom - retrieve maximum number of contacts Ping Cheng
2011-08-15 3:37 ` Chris Bagwell
[not found] ` <CAF8JNhLOQo_HdrXrjbDJqx_M6Mcb0puXJ80vNPaQeY1kOr-UNA@mail.gmail.com>
2011-08-17 6:52 ` Dmitry Torokhov
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).