Advertisement
Guest User

Untitled

a guest
Apr 10th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1.  
  2. net/bluetooth/hidp/core.c | 16 ++++++++++++++--
  3. net/bluetooth/hidp/hidp.h | 4 ++++
  4. 2 files changed, 18 insertions(+), 2 deletions(-)
  5.  
  6. diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
  7. index 292e619..d9fb934 100644
  8. --- a/net/bluetooth/hidp/core.c
  9. +++ b/net/bluetooth/hidp/core.c
  10. @@ -430,6 +430,16 @@ static void hidp_del_timer(struct hidp_session *session)
  11. del_timer(&session->timer);
  12. }
  13.  
  14. +static void hidp_process_report(struct hidp_session *session,
  15. + int type, const u8 *data, int len, int intr)
  16. +{
  17. + if (len > HID_MAX_BUFFER_SIZE)
  18. + len = HID_MAX_BUFFER_SIZE;
  19. +
  20. + memcpy(session->input_buf, data, len);
  21. + hid_input_report(session->hid, type, session->input_buf, len, intr);
  22. +}
  23. +
  24. static void hidp_process_handshake(struct hidp_session *session,
  25. unsigned char param)
  26. {
  27. @@ -502,7 +512,8 @@ static int hidp_process_data(struct hidp_session *session, struct sk_buff *skb,
  28. hidp_input_report(session, skb);
  29.  
  30. if (session->hid)
  31. - hid_input_report(session->hid, HID_INPUT_REPORT, skb->data, skb->len, 0);
  32. + hidp_process_report(session, HID_INPUT_REPORT,
  33. + skb->data, skb->len, 0);
  34. break;
  35.  
  36. case HIDP_DATA_RTYPE_OTHER:
  37. @@ -584,7 +595,8 @@ static void hidp_recv_intr_frame(struct hidp_session *session,
  38. hidp_input_report(session, skb);
  39.  
  40. if (session->hid) {
  41. - hid_input_report(session->hid, HID_INPUT_REPORT, skb->data, skb->len, 1);
  42. + hidp_process_report(session, HID_INPUT_REPORT,
  43. + skb->data, skb->len, 1);
  44. BT_DBG("report len %d", skb->len);
  45. }
  46. } else {
  47. diff --git a/net/bluetooth/hidp/hidp.h b/net/bluetooth/hidp/hidp.h
  48. index ab52414..8798492 100644
  49. --- a/net/bluetooth/hidp/hidp.h
  50. +++ b/net/bluetooth/hidp/hidp.h
  51. @@ -24,6 +24,7 @@
  52. #define __HIDP_H
  53.  
  54. #include <linux/types.h>
  55. +#include <linux/hid.h>
  56. #include <linux/kref.h>
  57. #include <net/bluetooth/bluetooth.h>
  58. #include <net/bluetooth/l2cap.h>
  59. @@ -179,6 +180,9 @@ struct hidp_session {
  60.  
  61. /* Used in hidp_output_raw_report() */
  62. int output_report_success; /* boolean */
  63. +
  64. + /* temporary input buffer */
  65. + u8 input_buf[HID_MAX_BUFFER_SIZE];
  66. };
  67.  
  68. /* HIDP init defines */
  69. --
  70. 1.8.5.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement