* [PATCH 1/2] [hidp] Use the control socket for raw messages
@ 2010-01-20 12:00 Bastien Nocera
2010-01-26 0:47 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Bastien Nocera @ 2010-01-20 12:00 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input, BlueZ development, Jiri Kosina
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] [hidp] Use the control socket for raw messages
2010-01-20 12:00 [PATCH 1/2] [hidp] Use the control socket for raw messages Bastien Nocera
@ 2010-01-26 0:47 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2010-01-26 0:47 UTC (permalink / raw)
To: Bastien Nocera
Cc: Dmitry Torokhov, linux-input, BlueZ development, Marcel Holtmann
On Wed, 20 Jan 2010, Bastien Nocera wrote:
> 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(-)
Marcel, what is your take on this one please?
I'd like to merge the fixes to Sony and Wacom drivers that depend on this
patch into my tree, so it would be nice if you could either Ack/Sign-off
on it so that I could merge it through my tree, or take it for .34 through
your tree.
Thanks!
>
> 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
>
>
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-26 0:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-20 12:00 [PATCH 1/2] [hidp] Use the control socket for raw messages Bastien Nocera
2010-01-26 0:47 ` Jiri Kosina
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).