From: Bastien Nocera <hadess-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org>
To: Ping Cheng <pinglinux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-input <linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
BlueZ development
<linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
bgunn-2XggCk4BHTRBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
Date: Tue, 19 Jan 2010 00:19:35 +0000 [thread overview]
Message-ID: <1263860375.20565.3374.camel@localhost.localdomain> (raw)
In-Reply-To: <1263850557.20565.3204.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]
On Mon, 2010-01-18 at 21:35 +0000, Bastien Nocera wrote:
<snip>
> > I still have the exact same problems as with the user-space
> > patch in
> > that an error occurs sending the second blob of data to the
> > tablet, the
> > first time the driver is initialised. Ping, any ideas about
> > that?
> >
> > I am not sure if your issue is similar to what we see with USB devices
> > or not. In order to properly set the device to Wacom mode, we had to
> > call usb_set_report more than once (up to 5 times for older kernels,
> > and up to 3 times for newer kernels) to get it right. Please call:
> >
> > hdev->hid_output_raw_report again when ret is less than 0. Try up to
> > three times to see what you get.
>
> That's pretty straight forward, I'll try and do that.
My brain must have started turning to mush.
It's hid_parse() failing, and calling it multiple times doesn't have any
effects (unlike on USB where it would poke the device repeatedly).
Marcel, any ideas about that?
Adding a few loops for the mode2 switching fixed very unfrequent
failures. All that's left is the hid_parse() failure the first time the
device connects.
> > You need to check if (ret < 0) before calling dev_err() with the
> > second hid_output_raw_report() call, right?
>
> Copy/paste stupidness all around there (as you can see, it's indented
> properly already ;)
Fixed in the attached patch. Obviously still requires the first patch to
be reviewed.
Cheers
[-- Attachment #2: 0001-hid-Implement-Wacom-quirk-in-the-kernel.patch --]
[-- Type: text/x-patch, Size: 2304 bytes --]
>From 15fd982367e4e8f5ceeec3b8f802fb0f43da4ef9 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org>
Date: Mon, 18 Jan 2010 16:13:41 +0000
Subject: [PATCH] [hid] Implement Wacom quirk in the kernel
The hid-wacom driver required user-space to poke at the tablet
to make it send data about the cursor location.
This patch makes it do the same thing but in the kernel.
Signed-off-by: Bastien Nocera <hadess-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org>
---
drivers/hid/hid-wacom.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index 7475421..ad71a85 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -155,7 +155,9 @@ static int wacom_probe(struct hid_device *hdev,
struct hid_input *hidinput;
struct input_dev *input;
struct wacom_data *wdata;
+ char rep_data[3];
int ret;
+ int limit;
wdata = kzalloc(sizeof(*wdata), GFP_KERNEL);
if (wdata == NULL) {
@@ -165,6 +167,7 @@ static int wacom_probe(struct hid_device *hdev,
hid_set_drvdata(hdev, wdata);
+ /* Parse the HID report now */
ret = hid_parse(hdev);
if (ret) {
dev_err(&hdev->dev, "parse failed\n");
@@ -177,6 +180,36 @@ static int wacom_probe(struct hid_device *hdev,
goto err_free;
}
+ /* Set Wacom mode2 */
+ rep_data[0] = 0x53; /* HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE */
+ rep_data[1] = 0x03; rep_data[2] = 0x00;
+ limit =3;
+ do {
+ ret = hdev->hid_output_raw_report(hdev, rep_data, 3);
+ } while (ret < 0 && limit-- > 0);
+ if (ret < 0) {
+ dev_err(&hdev->dev, "failed to poke device #1, %d\n", ret);
+ goto err_free;
+ }
+
+ rep_data[0] = 0x71; /* HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE */
+ /* 0x06 - high reporting speed, 0x05 - low speed */
+ rep_data[1] = 0x06; rep_data[2] = 0x00;
+ limit = 3;
+ do {
+ ret = hdev->hid_output_raw_report(hdev, rep_data, 3);
+ } while (ret < 0 && limit-- > 0);
+ if (ret < 0) {
+ dev_err(&hdev->dev, "failed to poke device #2, %d\n", ret);
+ goto err_free;
+ }
+
+ ret = hid_parse(hdev);
+ if (ret) {
+ dev_err(&hdev->dev, "parse failed\n");
+ goto err_free;
+ }
+
hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
input = hidinput->input;
--
1.6.5.2
next prev parent reply other threads:[~2010-01-19 0:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-18 16:49 [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel Bastien Nocera
[not found] ` <167e8a331001181144u54cefd15m65a5a63ca8c4c4b6@mail.gmail.com>
2010-01-18 21:35 ` Bastien Nocera
[not found] ` <1263850557.20565.3204.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-19 0:19 ` Bastien Nocera [this message]
[not found] ` <1263833399.20565.2905.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-18 22:01 ` Przemysław Firszt
2010-01-19 7:29 ` Marcel Holtmann
2010-01-19 10:30 ` Bastien Nocera
2010-01-19 14:20 ` Jiri Kosina
2010-01-19 16:36 ` Gunn, Brian
[not found] ` <FE57175CCE23E5419899C1B0CFA26FAD101B5F8B9D-qt6i7J1wJoTyaV9iOGU/das+acoFTUjB@public.gmane.org>
2010-01-19 17:03 ` Bastien Nocera
[not found] ` <1263920596.1816.56.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-19 17:05 ` Gunn, Brian
2010-01-19 20:47 ` Gunn, Brian
2010-01-21 1:08 ` Gunn, Brian
2010-01-21 1:35 ` Bastien Nocera
[not found] ` <1264037759.1735.5008.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-28 22:33 ` Gunn, Brian
[not found] ` <FE57175CCE23E5419899C1B0CFA26FAD12CDF72C0F-qt6i7J1wJoTyaV9iOGU/das+acoFTUjB@public.gmane.org>
2010-01-28 22:53 ` Bastien Nocera
2010-01-28 22:57 ` Gunn, Brian
2010-01-29 9:39 ` Jiri Kosina
2010-01-29 13:45 ` Bastien Nocera
2010-01-29 13:53 ` Jiri Kosina
-- strict thread matches above, loose matches on Subject: below --
2010-01-20 11:47 Bastien Nocera
[not found] ` <1263988051.1735.2474.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-20 11:52 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1263860375.20565.3374.camel@localhost.localdomain \
--to=hadess-0meiytkfxgostnjn9+bgxg@public.gmane.org \
--cc=bgunn-2XggCk4BHTRBDgjK7y7TUQ@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pinglinux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is 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).