diff options
author | Bastien Nocera <hadess@hadess.net> | 2010-01-20 07:00:42 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-01-30 08:57:39 -0500 |
commit | 6bf8268f9a91f1065c99503161ebd061492bebe3 (patch) | |
tree | cb8ed2df7d52e63346d52bf7b0b5008987d1d86e | |
parent | 9670d80a9a6e24725c4111bef5d6cc7786ad0dc5 (diff) |
Bluetooth: Use the control channel for raw HID reports
In commit 2da31939a42f7a676a0bc5155d6a0a39ed8451f2, support
for Bluetooth hid_output_raw_report was added, but it pushes
the data to the interrupt channel instead of the contol one.
This patch makes hid_output_raw_report use the control channel
instead. Using the interrupt channel was a mistake.
Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | 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 18e7f5a43dc4..6cf526d06e21 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) | |||
243 | input_sync(dev); | 243 | input_sync(dev); |
244 | } | 244 | } |
245 | 245 | ||
246 | static int __hidp_send_ctrl_message(struct hidp_session *session, | ||
247 | unsigned char hdr, unsigned char *data, int size) | ||
248 | { | ||
249 | struct sk_buff *skb; | ||
250 | |||
251 | BT_DBG("session %p data %p size %d", session, data, size); | ||
252 | |||
253 | if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) { | ||
254 | BT_ERR("Can't allocate memory for new frame"); | ||
255 | return -ENOMEM; | ||
256 | } | ||
257 | |||
258 | *skb_put(skb, 1) = hdr; | ||
259 | if (data && size > 0) | ||
260 | memcpy(skb_put(skb, size), data, size); | ||
261 | |||
262 | skb_queue_tail(&session->ctrl_transmit, skb); | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | static inline int hidp_send_ctrl_message(struct hidp_session *session, | ||
268 | unsigned char hdr, unsigned char *data, int size) | ||
269 | { | ||
270 | int err; | ||
271 | |||
272 | err = __hidp_send_ctrl_message(session, hdr, data, size); | ||
273 | |||
274 | hidp_schedule(session); | ||
275 | |||
276 | return err; | ||
277 | } | ||
278 | |||
246 | static int hidp_queue_report(struct hidp_session *session, | 279 | static int hidp_queue_report(struct hidp_session *session, |
247 | unsigned char *data, int size) | 280 | unsigned char *data, int size) |
248 | { | 281 | { |
@@ -282,7 +315,9 @@ static int hidp_send_report(struct hidp_session *session, struct hid_report *rep | |||
282 | 315 | ||
283 | static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count) | 316 | static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count) |
284 | { | 317 | { |
285 | if (hidp_queue_report(hid->driver_data, data, count)) | 318 | if (hidp_send_ctrl_message(hid->driver_data, |
319 | HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE, | ||
320 | data, count)) | ||
286 | return -ENOMEM; | 321 | return -ENOMEM; |
287 | return count; | 322 | return count; |
288 | } | 323 | } |
@@ -307,39 +342,6 @@ static inline void hidp_del_timer(struct hidp_session *session) | |||
307 | del_timer(&session->timer); | 342 | del_timer(&session->timer); |
308 | } | 343 | } |
309 | 344 | ||
310 | static int __hidp_send_ctrl_message(struct hidp_session *session, | ||
311 | unsigned char hdr, unsigned char *data, int size) | ||
312 | { | ||
313 | struct sk_buff *skb; | ||
314 | |||
315 | BT_DBG("session %p data %p size %d", session, data, size); | ||
316 | |||
317 | if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) { | ||
318 | BT_ERR("Can't allocate memory for new frame"); | ||
319 | return -ENOMEM; | ||
320 | } | ||
321 | |||
322 | *skb_put(skb, 1) = hdr; | ||
323 | if (data && size > 0) | ||
324 | memcpy(skb_put(skb, size), data, size); | ||
325 | |||
326 | skb_queue_tail(&session->ctrl_transmit, skb); | ||
327 | |||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static inline int hidp_send_ctrl_message(struct hidp_session *session, | ||
332 | unsigned char hdr, unsigned char *data, int size) | ||
333 | { | ||
334 | int err; | ||
335 | |||
336 | err = __hidp_send_ctrl_message(session, hdr, data, size); | ||
337 | |||
338 | hidp_schedule(session); | ||
339 | |||
340 | return err; | ||
341 | } | ||
342 | |||
343 | static void hidp_process_handshake(struct hidp_session *session, | 345 | static void hidp_process_handshake(struct hidp_session *session, |
344 | unsigned char param) | 346 | unsigned char param) |
345 | { | 347 | { |