aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hidp/core.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-07-06 07:09:02 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-28 21:01:26 -0400
commit0a85b964e141a4b8db6eaf500ceace12f8f52f93 (patch)
tree8479bdc23230d7c1fa581af15199d7bef7268231 /net/bluetooth/hidp/core.c
parentb219e3ac66183fc9771b94af931fb5fd41d586ec (diff)
[Bluetooth] Integrate services into the driver model
This patch integrates the services of the Bluetooth protocols RFCOMM, BNEP and HIDP into the driver model. This makes it possible to assign the virtual TTY, network and input devices to a specific Bluetooth connection. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hidp/core.c')
-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);