linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
@ 2010-01-18 16:49 Bastien Nocera
       [not found] ` <167e8a331001181144u54cefd15m65a5a63ca8c4c4b6@mail.gmail.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Bastien Nocera @ 2010-01-18 16:49 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input, BlueZ development
  Cc: bgunn-2XggCk4BHTRBDgjK7y7TUQ, Ping

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

Heya,

Here's a patch to do the Bluetooth Wacom tablet's mode setting in the
kernel. In the past, it was done in a patch in bluetootd.

The first patch is probably completely wrong. Right now,
hid_output_raw_report is done on the intr socket, instead of the ctrl
socket. If it's correct to do it on the intr socket, we'd need to add
some API as a way to select the ctrl socket instead for use in that
driver.

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?

Cheers

[-- Attachment #2: 0001-hidp-Use-the-control-socket-for-raw-messages.patch --]
[-- Type: text/x-patch, Size: 3237 bytes --]

>From 024b4ebd722ddb18f5f455c4db4a3f5ff41caa38 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org>
Date: Mon, 18 Jan 2010 16:11:33 +0000
Subject: [PATCH 1/2] [hidp] Use the control socket for raw messages

In commit 2da31939a42f7a676a0bc5155d6a0a39ed8451f2, support
for Bluetooth hid_output_raw_report was added, but it pushes
the data to the intr socket instead of the ctrl one.

This patch makes hid_output_raw_report use the control socket
instead.

Signed-off-by: Bastien Nocera <hadess-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org>
---
 net/bluetooth/hidp/core.c |   70 +++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 5697500..8866582 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -243,6 +243,39 @@ static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb)
 	input_sync(dev);
 }
 
+static int __hidp_send_ctrl_message(struct hidp_session *session,
+			unsigned char hdr, unsigned char *data, int size)
+{
+	struct sk_buff *skb;
+
+	BT_DBG("session %p data %p size %d", session, data, size);
+
+	if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
+		BT_ERR("Can't allocate memory for new frame");
+		return -ENOMEM;
+	}
+
+	*skb_put(skb, 1) = hdr;
+	if (data && size > 0)
+		memcpy(skb_put(skb, size), data, size);
+
+	skb_queue_tail(&session->ctrl_transmit, skb);
+
+	return 0;
+}
+
+static inline int hidp_send_ctrl_message(struct hidp_session *session,
+			unsigned char hdr, unsigned char *data, int size)
+{
+	int err;
+
+	err = __hidp_send_ctrl_message(session, hdr, data, size);
+
+	hidp_schedule(session);
+
+	return err;
+}
+
 static int hidp_queue_report(struct hidp_session *session,
 				unsigned char *data, int size)
 {
@@ -282,7 +315,9 @@ static int hidp_send_report(struct hidp_session *session, struct hid_report *rep
 
 static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count)
 {
-	if (hidp_queue_report(hid->driver_data, data, count))
+	if (count <= 1)
+		return -EINVAL;
+	if (hidp_send_ctrl_message(hid->driver_data, data[0], data + 1, count - 1))
 		return -ENOMEM;
 	return count;
 }
@@ -307,39 +342,6 @@ static inline void hidp_del_timer(struct hidp_session *session)
 		del_timer(&session->timer);
 }
 
-static int __hidp_send_ctrl_message(struct hidp_session *session,
-			unsigned char hdr, unsigned char *data, int size)
-{
-	struct sk_buff *skb;
-
-	BT_DBG("session %p data %p size %d", session, data, size);
-
-	if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
-		BT_ERR("Can't allocate memory for new frame");
-		return -ENOMEM;
-	}
-
-	*skb_put(skb, 1) = hdr;
-	if (data && size > 0)
-		memcpy(skb_put(skb, size), data, size);
-
-	skb_queue_tail(&session->ctrl_transmit, skb);
-
-	return 0;
-}
-
-static inline int hidp_send_ctrl_message(struct hidp_session *session,
-			unsigned char hdr, unsigned char *data, int size)
-{
-	int err;
-
-	err = __hidp_send_ctrl_message(session, hdr, data, size);
-
-	hidp_schedule(session);
-
-	return err;
-}
-
 static void hidp_process_handshake(struct hidp_session *session,
 					unsigned char param)
 {
-- 
1.6.5.2


[-- Attachment #3: 0002-hid-Implement-Wacom-quirk-in-the-kernel.patch --]
[-- Type: text/x-patch, Size: 1733 bytes --]

>From 6f83c0d084631033db9cb9b9452f5cf2e2bf67c2 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 2/2] [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 |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index 7475421..4030824 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -155,6 +155,7 @@ 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;
 
 	wdata = kzalloc(sizeof(*wdata), GFP_KERNEL);
@@ -177,6 +178,18 @@ static int wacom_probe(struct hid_device *hdev,
 		goto err_free;
 	}
 
+	rep_data[0] = 0x53; /* HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE */
+	rep_data[1] = 0x03; rep_data[2] = 0x00;
+	ret = hdev->hid_output_raw_report (hdev, rep_data, 3);
+	if (ret < 0)
+		dev_err(&hdev->dev, "failed to poke device #1, %d\n", ret);
+
+	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;
+	ret = hdev->hid_output_raw_report (hdev, rep_data, 3);
+		dev_err(&hdev->dev, "failed to poke device #2, %d\n", ret);
+
 	hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
 	input = hidinput->input;
 
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
       [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>
  0 siblings, 1 reply; 21+ messages in thread
From: Bastien Nocera @ 2010-01-18 21:35 UTC (permalink / raw)
  To: Ping Cheng; +Cc: Dmitry Torokhov, linux-input, BlueZ development, bgunn

On Mon, 2010-01-18 at 11:44 -0800, Ping Cheng wrote:
> On Mon, Jan 18, 2010 at 8:49 AM, Bastien Nocera <hadess@hadess.net>
> wrote:
>         Heya,
>         
>         Here's a patch to do the Bluetooth Wacom tablet's mode setting
>         in the
>         kernel. In the past, it was done in a patch in bluetootd.
>         
>         The first patch is probably completely wrong. Right now,
>         hid_output_raw_report is done on the intr socket, instead of
>         the ctrl
>         socket. If it's correct to do it on the intr socket, we'd need
>         to add
>         some API as a way to select the ctrl socket instead for use in
>         that
>         driver.
> 
> I can not make a comment on the above patch since I know nothing about
> Bluetooth.

I'll let Marcel and Jiri be the judges of the value of this patch. In
the worst case, it'll need a change of API for hid-core.

>         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.

> 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 ;)

Cheers



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
       [not found] ` <1263833399.20565.2905.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2010-01-18 22:01   ` Przemysław Firszt
  0 siblings, 0 replies; 21+ messages in thread
From: Przemysław Firszt @ 2010-01-18 22:01 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Dmitry Torokhov, linux-input, BlueZ development,
	bgunn-2XggCk4BHTRBDgjK7y7TUQ, Ping

Dnia 2010-01-18, pon o godzinie 16:49 +0000, Bastien Nocera pisze:
[..]
My tablet has a really big lag when I'm using hi speed (patch 0002*).
Does it work fine for you?
My laptop is rather slow, but I'm not sure if that's the bottleneck.

[przemo@pldmachine Desktop]$ uname -a
Linux pldmachine 2.6.33-rc4-00209-gd63f9cd-dirty #7 Mon Jan 18 20:45:27
GMT 2010 i686 Intel(R)_Pentium(R)_M_processor_1.86GHz PLD Linux

--
Cheers,
Przemo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
       [not found]     ` <1263850557.20565.3204.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2010-01-19  0:19       ` Bastien Nocera
  0 siblings, 0 replies; 21+ messages in thread
From: Bastien Nocera @ 2010-01-19  0:19 UTC (permalink / raw)
  To: Ping Cheng
  Cc: Dmitry Torokhov, linux-input, BlueZ development,
	bgunn-2XggCk4BHTRBDgjK7y7TUQ

[-- 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  2010-01-18 16:49 [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel Bastien Nocera
       [not found] ` <167e8a331001181144u54cefd15m65a5a63ca8c4c4b6@mail.gmail.com>
       [not found] ` <1263833399.20565.2905.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2010-01-19  7:29 ` Marcel Holtmann
  2010-01-19 10:30   ` Bastien Nocera
  2 siblings, 1 reply; 21+ messages in thread
From: Marcel Holtmann @ 2010-01-19  7:29 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Dmitry Torokhov, linux-input, BlueZ development, bgunn, Ping

Hi Bastien,

> Here's a patch to do the Bluetooth Wacom tablet's mode setting in the
> kernel. In the past, it was done in a patch in bluetootd.
> 
> The first patch is probably completely wrong. Right now,
> hid_output_raw_report is done on the intr socket, instead of the ctrl
> socket. If it's correct to do it on the intr socket, we'd need to add
> some API as a way to select the ctrl socket instead for use in that
> driver.

actually the interrupt should be incoming only. So moving the raw output
to the control channel seems fine to. Any reason why it is on the
interrupt channel in the first place?

Regards

Marcel



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  2010-01-19  7:29 ` Marcel Holtmann
@ 2010-01-19 10:30   ` Bastien Nocera
  2010-01-19 14:20     ` Jiri Kosina
                       ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Bastien Nocera @ 2010-01-19 10:30 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Dmitry Torokhov, linux-input, BlueZ development, bgunn, Ping,
	Jiri Kosina

On Mon, 2010-01-18 at 23:29 -0800, Marcel Holtmann wrote:
> Hi Bastien,
> 
> > Here's a patch to do the Bluetooth Wacom tablet's mode setting in the
> > kernel. In the past, it was done in a patch in bluetootd.
> > 
> > The first patch is probably completely wrong. Right now,
> > hid_output_raw_report is done on the intr socket, instead of the ctrl
> > socket. If it's correct to do it on the intr socket, we'd need to add
> > some API as a way to select the ctrl socket instead for use in that
> > driver.
> 
> actually the interrupt should be incoming only. So moving the raw output
> to the control channel seems fine to. Any reason why it is on the
> interrupt channel in the first place?

The patch was written by Jiri and tested by Brian. Not sure what sort of
device Brian tested this with...


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  2010-01-19 10:30   ` Bastien Nocera
@ 2010-01-19 14:20     ` Jiri Kosina
  2010-01-19 16:36     ` Gunn, Brian
  2010-01-21  1:08     ` Gunn, Brian
  2 siblings, 0 replies; 21+ messages in thread
From: Jiri Kosina @ 2010-01-19 14:20 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Marcel Holtmann, Dmitry Torokhov, linux-input, BlueZ development,
	bgunn, Ping

On Tue, 19 Jan 2010, Bastien Nocera wrote:

> On Mon, 2010-01-18 at 23:29 -0800, Marcel Holtmann wrote:
> > Hi Bastien,
> > 
> > > Here's a patch to do the Bluetooth Wacom tablet's mode setting in the
> > > kernel. In the past, it was done in a patch in bluetootd.
> > > 
> > > The first patch is probably completely wrong. Right now,
> > > hid_output_raw_report is done on the intr socket, instead of the ctrl
> > > socket. If it's correct to do it on the intr socket, we'd need to add
> > > some API as a way to select the ctrl socket instead for use in that
> > > driver.
> > 
> > actually the interrupt should be incoming only. So moving the raw output
> > to the control channel seems fine to. Any reason why it is on the
> > interrupt channel in the first place?
> 
> The patch was written by Jiri and tested by Brian. Not sure what sort of
> device Brian tested this with...

Hmm, that's right, ctrl pipe would make much more sense (and this is what 
we do in USB driver as well). I used intr pipe by mistake, but it seems 
that it made things work for Brian anyway, which is quite puzzling.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  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-21  1:08     ` Gunn, Brian
  2 siblings, 1 reply; 21+ messages in thread
From: Gunn, Brian @ 2010-01-19 16:36 UTC (permalink / raw)
  To: Bastien Nocera, Marcel Holtmann
  Cc: Dmitry Torokhov, linux-input, BlueZ development, Ping, Jiri Kosina

I tested this with a Bluetooth remote control.  As I understand, reports can be written to either the interrupt or control sockets.  I'm happy to test other changes to let this be selectable.

Brian

________________________________________
From: Bastien Nocera [hadess@hadess.net]
Sent: Tuesday, January 19, 2010 2:30 AM
To: Marcel Holtmann
Cc: Dmitry Torokhov; linux-input; BlueZ development; Gunn, Brian; Ping; Jiri Kosina
Subject: Re: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel

On Mon, 2010-01-18 at 23:29 -0800, Marcel Holtmann wrote:
> Hi Bastien,
>
> > Here's a patch to do the Bluetooth Wacom tablet's mode setting in the
> > kernel. In the past, it was done in a patch in bluetootd.
> >
> > The first patch is probably completely wrong. Right now,
> > hid_output_raw_report is done on the intr socket, instead of the ctrl
> > socket. If it's correct to do it on the intr socket, we'd need to add
> > some API as a way to select the ctrl socket instead for use in that
> > driver.
>
> actually the interrupt should be incoming only. So moving the raw output
> to the control channel seems fine to. Any reason why it is on the
> interrupt channel in the first place?

The patch was written by Jiri and tested by Brian. Not sure what sort of
device Brian tested this with...

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
       [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>
  0 siblings, 1 reply; 21+ messages in thread
From: Bastien Nocera @ 2010-01-19 17:03 UTC (permalink / raw)
  To: Gunn, Brian
  Cc: Marcel Holtmann, Dmitry Torokhov, linux-input, BlueZ development,
	Ping, Jiri Kosina

On Tue, 2010-01-19 at 08:36 -0800, Gunn, Brian wrote:
> I tested this with a Bluetooth remote control.  As I understand,
> reports can be written to either the interrupt or control sockets.
> I'm happy to test other changes to let this be selectable.

Could you expand slightly on that? What make/model? What sort of tests
did you do on it?

Cheers

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
       [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
  0 siblings, 1 reply; 21+ messages in thread
From: Gunn, Brian @ 2010-01-19 17:05 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Marcel Holtmann, Dmitry Torokhov, linux-input, BlueZ development,
	Ping, Jiri Kosina

> Bastien Nocera wrote:
>On Tue, 2010-01-19 at 08:36 -0800, Gunn, Brian wrote:
>> I tested this with a Bluetooth remote control.  As I understand,
>> reports can be written to either the interrupt or control sockets.
>> I'm happy to test other changes to let this be selectable.

>Could you expand slightly on that? What make/model? What sort of tests
>did you do on it?

I used a custom remote control under development by the company I'm contracted to.  We have custom HID output reports that trigger actions on the remote.  I was able to send the output reports and get the behavior I expected on the remote.  I have no faith that the company developing the remote implemented their side correctly and would like to try it with the control socket instead.

Brian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  2010-01-19 17:05             ` Gunn, Brian
@ 2010-01-19 20:47               ` Gunn, Brian
  0 siblings, 0 replies; 21+ messages in thread
From: Gunn, Brian @ 2010-01-19 20:47 UTC (permalink / raw)
  To: Gunn, Brian, Bastien Nocera
  Cc: Marcel Holtmann, Dmitry Torokhov, linux-input, BlueZ development,
	Ping, Jiri Kosina

Brian Gunn wrote:

>I used a custom remote control under development by the company I'm contracted to.
>We have custom HID output reports that trigger actions on the remote.
>I was able to send the output reports and get the behavior I expected on the remote.
>I have no faith that the company developing the remote implemented their side
>correctly and would like to try it with the control socket instead.

BTW:  The Sony PS3 controller requires sending of HID reports as well.  I just checked the one implementation of this I've seen (input/device.c in the BlueZ source) and I see that it uses the control socket.

Once we get implementation of sending HID reports to the control socket implemented elsewhere, this kludge can be removed from the BlueZ source.

Brian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  2010-01-19 10:30   ` Bastien Nocera
  2010-01-19 14:20     ` Jiri Kosina
  2010-01-19 16:36     ` Gunn, Brian
@ 2010-01-21  1:08     ` Gunn, Brian
  2010-01-21  1:35       ` Bastien Nocera
  2 siblings, 1 reply; 21+ messages in thread
From: Gunn, Brian @ 2010-01-21  1:08 UTC (permalink / raw)
  To: Bastien Nocera, Marcel Holtmann
  Cc: Dmitry Torokhov, linux-input, BlueZ development, Ping, Jiri Kosina

Bastien Nocera wrote:
> The patch was written by Jiri and tested by Brian. Not sure what sort of
> device Brian tested this with...

I just tested this patch with my device and it does work.  I had to slightly alter the data I send (had to add 0xA2 to the front of it), but then it does work.

In my initial attempts, it does seem to work a little worse, but that is probably because of the device I'm using, which is still under development.

Brian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  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>
  0 siblings, 1 reply; 21+ messages in thread
From: Bastien Nocera @ 2010-01-21  1:35 UTC (permalink / raw)
  To: Gunn, Brian
  Cc: Marcel Holtmann, Dmitry Torokhov, linux-input, BlueZ development,
	Ping, Jiri Kosina

On Wed, 2010-01-20 at 17:08 -0800, Gunn, Brian wrote:
> Bastien Nocera wrote:
> > The patch was written by Jiri and tested by Brian. Not sure what sort of
> > device Brian tested this with...
> 
> I just tested this patch with my device and it does work.  I had to
> slightly alter the data I send (had to add 0xA2 to the front of it),
> but then it does work.
> 
> In my initial attempts, it does seem to work a little worse, but that
> is probably because of the device I'm using, which is still under
> development.

I sent a new version of the patch, which uses "HIDP_TRANS_SET_REPORT |
HIDP_DATA_RTYPE_FEATURE" for the first byte. Would that work?


^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
       [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>
  0 siblings, 1 reply; 21+ messages in thread
From: Gunn, Brian @ 2010-01-28 22:33 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Marcel Holtmann, Dmitry Torokhov, linux-input, BlueZ development,
	Ping, Jiri Kosina

> > I just tested this patch with my device and it does work.  I had to
> > slightly alter the data I send (had to add 0xA2 to the front of it),
> > but then it does work.
>
> I sent a new version of the patch, which uses "HIDP_TRANS_SET_REPORT |
> HIDP_DATA_RTYPE_FEATURE" for the first byte. Would that work?

Actually for my application it doesn't.  I use HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUTPUT.

Perhaps allowing the user the choice of what do to here is more flexible.

Brian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
       [not found]             ` <FE57175CCE23E5419899C1B0CFA26FAD12CDF72C0F-qt6i7J1wJoTyaV9iOGU/das+acoFTUjB@public.gmane.org>
@ 2010-01-28 22:53               ` Bastien Nocera
  2010-01-28 22:57                 ` Gunn, Brian
  0 siblings, 1 reply; 21+ messages in thread
From: Bastien Nocera @ 2010-01-28 22:53 UTC (permalink / raw)
  To: Gunn, Brian
  Cc: Marcel Holtmann, Dmitry Torokhov, linux-input, BlueZ development,
	Ping, Jiri Kosina

On Thu, 2010-01-28 at 14:33 -0800, Gunn, Brian wrote:
> > > I just tested this patch with my device and it does work.  I had to
> > > slightly alter the data I send (had to add 0xA2 to the front of it),
> > > but then it does work.
> >
> > I sent a new version of the patch, which uses "HIDP_TRANS_SET_REPORT |
> > HIDP_DATA_RTYPE_FEATURE" for the first byte. Would that work?
> 
> Actually for my application it doesn't.  I use HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUTPUT.
> 
> Perhaps allowing the user the choice of what do to here is more flexible.

Except that it would mean different code for USB and Bluetooth
versions...

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  2010-01-28 22:53               ` Bastien Nocera
@ 2010-01-28 22:57                 ` Gunn, Brian
  2010-01-29  9:39                   ` Jiri Kosina
  0 siblings, 1 reply; 21+ messages in thread
From: Gunn, Brian @ 2010-01-28 22:57 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Marcel Holtmann, Dmitry Torokhov, linux-input, BlueZ development,
	Ping, Jiri Kosina

> > > I sent a new version of the patch, which uses "HIDP_TRANS_SET_REPORT |
> > > HIDP_DATA_RTYPE_FEATURE" for the first byte. Would that work?
> >
> > Actually for my application it doesn't.  I use HIDP_TRANS_DATA |
> HIDP_DATA_RTYPE_OUTPUT.
> >
> > Perhaps allowing the user the choice of what do to here is more flexible.
>
> Except that it would mean different code for USB and Bluetooth
> versions...

So do we need a method of setting which device reports we're sending before writing them?

Brian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  2010-01-28 22:57                 ` Gunn, Brian
@ 2010-01-29  9:39                   ` Jiri Kosina
  2010-01-29 13:45                     ` Bastien Nocera
  0 siblings, 1 reply; 21+ messages in thread
From: Jiri Kosina @ 2010-01-29  9:39 UTC (permalink / raw)
  To: Gunn, Brian
  Cc: Bastien Nocera, Marcel Holtmann, Dmitry Torokhov, linux-input,
	BlueZ development, Ping

On Thu, 28 Jan 2010, Gunn, Brian wrote:

> > > > I sent a new version of the patch, which uses "HIDP_TRANS_SET_REPORT |
> > > > HIDP_DATA_RTYPE_FEATURE" for the first byte. Would that work?
> > >
> > > Actually for my application it doesn't.  I use HIDP_TRANS_DATA |
> > HIDP_DATA_RTYPE_OUTPUT.
> > >
> > > Perhaps allowing the user the choice of what do to here is more flexible.
> >
> > Except that it would mean different code for USB and Bluetooth
> > versions...
> 
> So do we need a method of setting which device reports we're sending before writing them?

Having separate methods for feature and output reports should be 
sufficient and general enough, right?

-- 
Jiri Kosina
SUSE Labs, Novell Inc.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  2010-01-29  9:39                   ` Jiri Kosina
@ 2010-01-29 13:45                     ` Bastien Nocera
  2010-01-29 13:53                       ` Jiri Kosina
  0 siblings, 1 reply; 21+ messages in thread
From: Bastien Nocera @ 2010-01-29 13:45 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Gunn, Brian, Marcel Holtmann, Dmitry Torokhov, linux-input,
	BlueZ development, Ping

On Fri, 2010-01-29 at 10:39 +0100, Jiri Kosina wrote:
> On Thu, 28 Jan 2010, Gunn, Brian wrote:
> 
> > > > > I sent a new version of the patch, which uses "HIDP_TRANS_SET_REPORT |
> > > > > HIDP_DATA_RTYPE_FEATURE" for the first byte. Would that work?
> > > >
> > > > Actually for my application it doesn't.  I use HIDP_TRANS_DATA |
> > > HIDP_DATA_RTYPE_OUTPUT.
> > > >
> > > > Perhaps allowing the user the choice of what do to here is more flexible.
> > >
> > > Except that it would mean different code for USB and Bluetooth
> > > versions...
> > 
> > So do we need a method of setting which device reports we're sending before writing them?
> 
> Having separate methods for feature and output reports should be 
> sufficient and general enough, right?

Most likely, yes. Feature is enough for the 2 devices I provided patches
for. Could you please comment on what you'd like the implementation of
this to look like? This simple bug fix is turning into a lot more
to-and-fro than I would have anticipated.

Cheers


^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
  2010-01-29 13:45                     ` Bastien Nocera
@ 2010-01-29 13:53                       ` Jiri Kosina
  0 siblings, 0 replies; 21+ messages in thread
From: Jiri Kosina @ 2010-01-29 13:53 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Gunn, Brian, Marcel Holtmann, Dmitry Torokhov, linux-input,
	BlueZ development, Ping

On Fri, 29 Jan 2010, Bastien Nocera wrote:

> > Having separate methods for feature and output reports should be 
> > sufficient and general enough, right?
> 
> Most likely, yes. Feature is enough for the 2 devices I provided patches
> for. Could you please comment on what you'd like the implementation of
> this to look like? 

I think that we should probably introduce flag parameter into 
hid_output_raw_report(), which would indicate whether OUTPUT or FEATURE 
report should be sent.

This makes sense both for Bluetooth and HID.

I will send out patches later today for you guys to test (and for Marcel 
to Ack the Bluetooth part).

> This simple bug fix is turning into a lot more to-and-fro than I would 
> have anticipated.

It's nice example of evolution, isn't it? :)

Thanks,

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
       [not found] ` <1263988051.1735.2474.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2010-01-20 11:52   ` Marcel Holtmann
  0 siblings, 0 replies; 21+ messages in thread
From: Marcel Holtmann @ 2010-01-20 11:52 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Dmitry Torokhov, linux-input, BlueZ development, Jiri Kosina

Hi Bastien,

> Here's a patch to do the Bluetooth Wacom tablet's mode setting in the
> kernel. In the past, it was done in a patch in bluetootd.
> 
> - 0001-hidp-Use-the-control-socket-for-raw-messages.patch
> 
> As discussed, now uses the ctrl channel for sending raw reports to the device.
> 
> - 0002-hid-wacom-Implement-Wacom-quirk-in-the-kernel.patch
> 
> Uses the above to poke at the device and turn it into mode2
> 
> - 0001-hid-sony-Fix-typo-in-error-message.patch
> 
> Small typo, for the input tree
> 
> - 0001-hid-Enable-Sixaxis-controller-over-Bluetooth-as-well.patch
> 
> Use the hidp patch above to enable the sixaxis controller

please send them one patch per email and send them inline. In case of
troubles just use git send-email.

Regards

Marcel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
@ 2010-01-20 11:47 Bastien Nocera
       [not found] ` <1263988051.1735.2474.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 21+ messages in thread
From: Bastien Nocera @ 2010-01-20 11:47 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input, BlueZ development, Jiri Kosina

[-- Attachment #1: Type: text/plain, Size: 611 bytes --]

Heya,

Here's a patch to do the Bluetooth Wacom tablet's mode setting in the
kernel. In the past, it was done in a patch in bluetootd.

- 0001-hidp-Use-the-control-socket-for-raw-messages.patch

As discussed, now uses the ctrl channel for sending raw reports to the device.

- 0002-hid-wacom-Implement-Wacom-quirk-in-the-kernel.patch

Uses the above to poke at the device and turn it into mode2

- 0001-hid-sony-Fix-typo-in-error-message.patch

Small typo, for the input tree

- 0001-hid-Enable-Sixaxis-controller-over-Bluetooth-as-well.patch

Use the hidp patch above to enable the sixaxis controller

Cheers


[-- Attachment #2: 0001-hid-Enable-Sixaxis-controller-over-Bluetooth-as-well.patch --]
[-- Type: text/x-patch, Size: 2595 bytes --]

>From 54d987380685cf69d3f9037ef007c73861bf5eff Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 20 Jan 2010 11:31:04 +0000
Subject: [PATCH] [hid] Enable Sixaxis controller over Bluetooth as well

Now that hid_output_raw_report works, port the PS3 Sixaxis
Bluetooth quirk from user-space, into kernel-space.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
---
 drivers/hid/hid-core.c |    1 +
 drivers/hid/hid-sony.c |   15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 3773f69..d88bebf 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1337,6 +1337,7 @@ static const struct hid_device_id hid_blacklist[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 96d723e..d69ac22 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -73,6 +73,12 @@ static int sony_set_operational(struct hid_device *hdev)
 	return ret;
 }
 
+static int sony_set_operational_bt(struct hid_device *hdev)
+{
+	unsigned char buf[] = { 0x53, 0xf4,  0x42, 0x03, 0x00, 0x00 };
+	return hdev->hid_output_raw_report(hdev, buf, sizeof(buf));
+}
+
 static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 {
 	int ret;
@@ -101,7 +107,13 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		goto err_free;
 	}
 
-	ret = sony_set_operational(hdev);
+	if (hdev->bus == BUS_USB)
+		ret = sony_set_operational(hdev);
+	else if (hdev->bus == BUS_BLUETOOTH)
+		ret = sony_set_operational_bt(hdev);
+	else
+		ret = 0;
+
 	if (ret < 0)
 		goto err_stop;
 
@@ -121,6 +133,7 @@ static void sony_remove(struct hid_device *hdev)
 
 static const struct hid_device_id sony_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE),
 		.driver_data = VAIO_RDESC_CONSTANT },
 	{ }
-- 
1.6.5.2


[-- Attachment #3: 0001-hidp-Use-the-control-socket-for-raw-messages.patch --]
[-- Type: text/x-patch, Size: 3182 bytes --]

>From e7438e866e4281806393ab6de276d31cb955bfe6 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 18 Jan 2010 16:11:33 +0000
Subject: [PATCH 1/2] [hidp] Use the control socket for raw messages

In commit 2da31939a42f7a676a0bc5155d6a0a39ed8451f2, support
for Bluetooth hid_output_raw_report was added, but it pushes
the data to the intr socket instead of the ctrl one.

This patch makes hid_output_raw_report use the control socket
instead.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
---
 net/bluetooth/hidp/core.c |   70 +++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 5697500..40879ed 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -243,6 +243,39 @@ static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb)
 	input_sync(dev);
 }
 
+static int __hidp_send_ctrl_message(struct hidp_session *session,
+			unsigned char hdr, unsigned char *data, int size)
+{
+	struct sk_buff *skb;
+
+	BT_DBG("session %p data %p size %d", session, data, size);
+
+	if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
+		BT_ERR("Can't allocate memory for new frame");
+		return -ENOMEM;
+	}
+
+	*skb_put(skb, 1) = hdr;
+	if (data && size > 0)
+		memcpy(skb_put(skb, size), data, size);
+
+	skb_queue_tail(&session->ctrl_transmit, skb);
+
+	return 0;
+}
+
+static inline int hidp_send_ctrl_message(struct hidp_session *session,
+			unsigned char hdr, unsigned char *data, int size)
+{
+	int err;
+
+	err = __hidp_send_ctrl_message(session, hdr, data, size);
+
+	hidp_schedule(session);
+
+	return err;
+}
+
 static int hidp_queue_report(struct hidp_session *session,
 				unsigned char *data, int size)
 {
@@ -282,7 +315,9 @@ static int hidp_send_report(struct hidp_session *session, struct hid_report *rep
 
 static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count)
 {
-	if (hidp_queue_report(hid->driver_data, data, count))
+	if (hidp_send_ctrl_message(hid->driver_data,
+			HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE,
+			data, count))
 		return -ENOMEM;
 	return count;
 }
@@ -307,39 +342,6 @@ static inline void hidp_del_timer(struct hidp_session *session)
 		del_timer(&session->timer);
 }
 
-static int __hidp_send_ctrl_message(struct hidp_session *session,
-			unsigned char hdr, unsigned char *data, int size)
-{
-	struct sk_buff *skb;
-
-	BT_DBG("session %p data %p size %d", session, data, size);
-
-	if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
-		BT_ERR("Can't allocate memory for new frame");
-		return -ENOMEM;
-	}
-
-	*skb_put(skb, 1) = hdr;
-	if (data && size > 0)
-		memcpy(skb_put(skb, size), data, size);
-
-	skb_queue_tail(&session->ctrl_transmit, skb);
-
-	return 0;
-}
-
-static inline int hidp_send_ctrl_message(struct hidp_session *session,
-			unsigned char hdr, unsigned char *data, int size)
-{
-	int err;
-
-	err = __hidp_send_ctrl_message(session, hdr, data, size);
-
-	hidp_schedule(session);
-
-	return err;
-}
-
 static void hidp_process_handshake(struct hidp_session *session,
 					unsigned char param)
 {
-- 
1.6.5.2


[-- Attachment #4: 0001-hid-sony-Fix-typo-in-error-message.patch --]
[-- Type: text/x-patch, Size: 761 bytes --]

>From 3b7f54ec73ca8966934100e136ebfe0749882e03 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 20 Jan 2010 01:16:22 +0000
Subject: [PATCH 1/2] [hid-sony] Fix typo in error message

---
 drivers/hid/hid-sony.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 4e84502..96d723e 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -81,7 +81,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
 	sc = kzalloc(sizeof(*sc), GFP_KERNEL);
 	if (sc == NULL) {
-		dev_err(&hdev->dev, "can't alloc apple descriptor\n");
+		dev_err(&hdev->dev, "can't alloc sony descriptor\n");
 		return -ENOMEM;
 	}
 
-- 
1.6.5.2


[-- Attachment #5: 0002-hid-wacom-Implement-Wacom-quirk-in-the-kernel.patch --]
[-- Type: text/x-patch, Size: 1992 bytes --]

>From cebe11030bd6b26d92f4f541d3f109f54be4ad70 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 18 Jan 2010 16:13:41 +0000
Subject: [PATCH 2/2] [hid-wacom] 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@hadess.net>
---
 drivers/hid/hid-wacom.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index 7475421..e55ed3f 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[2];
 	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,28 @@ static int wacom_probe(struct hid_device *hdev,
 		goto err_free;
 	}
 
+	/* Set Wacom mode2 */
+	rep_data[0] = 0x03; rep_data[1] = 0x00;
+	limit =3;
+	do {
+		ret = hdev->hid_output_raw_report(hdev, rep_data, 2);
+	} while (ret < 0 && limit-- > 0);
+	if (ret < 0) {
+		dev_err(&hdev->dev, "failed to poke device #1, %d\n", ret);
+		goto err_free;
+	}
+
+	/* 0x06 - high reporting speed, 0x05 - low speed */
+	rep_data[0] = 0x06; rep_data[1] = 0x00;
+	limit = 3;
+	do {
+		ret = hdev->hid_output_raw_report(hdev, rep_data, 2);
+	} while (ret < 0 && limit-- > 0);
+	if (ret < 0) {
+		dev_err(&hdev->dev, "failed to poke device #2, %d\n", ret);
+		goto err_free;
+	}
+
 	hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
 	input = hidinput->input;
 
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2010-01-29 13:53 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
     [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
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

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).