From: Bastien Nocera <hadess-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org>
To: Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-input <linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
BlueZ development
<linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: bgunn-2XggCk4BHTRBDgjK7y7TUQ@public.gmane.org,
Ping <pinglinux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel
Date: Mon, 18 Jan 2010 16:49:59 +0000 [thread overview]
Message-ID: <1263833399.20565.2905.camel@localhost.localdomain> (raw)
[-- 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
next reply other threads:[~2010-01-18 16:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-18 16:49 Bastien Nocera [this message]
[not found] ` <167e8a331001181144u54cefd15m65a5a63ca8c4c4b6@mail.gmail.com>
2010-01-18 21:35 ` [PATCHes] Implement Bluetooth Wacom tablet's mode change in the kernel 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
-- 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=1263833399.20565.2905.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).