aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hidp
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/hidp')
-rw-r--r--net/bluetooth/hidp/core.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index c6e3a2c27c6e..03b5dadb4951 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -40,6 +40,7 @@
40#include <linux/input.h> 40#include <linux/input.h>
41 41
42#include <net/bluetooth/bluetooth.h> 42#include <net/bluetooth/bluetooth.h>
43#include <net/bluetooth/hci_core.h>
43#include <net/bluetooth/l2cap.h> 44#include <net/bluetooth/l2cap.h>
44 45
45#include "hidp.h" 46#include "hidp.h"
@@ -528,6 +529,26 @@ static int hidp_session(void *arg)
528 return 0; 529 return 0;
529} 530}
530 531
532static struct device *hidp_get_device(struct hidp_session *session)
533{
534 bdaddr_t *src = &bt_sk(session->ctrl_sock->sk)->src;
535 bdaddr_t *dst = &bt_sk(session->ctrl_sock->sk)->dst;
536 struct hci_dev *hdev;
537 struct hci_conn *conn;
538
539 hdev = hci_get_route(dst, src);
540 if (!hdev)
541 return NULL;
542
543 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
544 if (!conn)
545 return NULL;
546
547 hci_dev_put(hdev);
548
549 return &conn->dev;
550}
551
531static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req) 552static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req)
532{ 553{
533 struct input_dev *input = session->input; 554 struct input_dev *input = session->input;
@@ -566,6 +587,8 @@ static inline void hidp_setup_input(struct hidp_session *session, struct hidp_co
566 input->relbit[0] |= BIT(REL_WHEEL); 587 input->relbit[0] |= BIT(REL_WHEEL);
567 } 588 }
568 589
590 input->cdev.dev = hidp_get_device(session);
591
569 input->event = hidp_input_event; 592 input->event = hidp_input_event;
570 593
571 input_register_device(input); 594 input_register_device(input);