diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-07-06 07:09:02 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-28 21:01:26 -0400 |
commit | 0a85b964e141a4b8db6eaf500ceace12f8f52f93 (patch) | |
tree | 8479bdc23230d7c1fa581af15199d7bef7268231 /net/bluetooth/rfcomm | |
parent | b219e3ac66183fc9771b94af931fb5fd41d586ec (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/rfcomm')
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index bd8d671a0ba6..26f322737db0 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/skbuff.h> | 38 | #include <linux/skbuff.h> |
39 | 39 | ||
40 | #include <net/bluetooth/bluetooth.h> | 40 | #include <net/bluetooth/bluetooth.h> |
41 | #include <net/bluetooth/hci_core.h> | ||
41 | #include <net/bluetooth/rfcomm.h> | 42 | #include <net/bluetooth/rfcomm.h> |
42 | 43 | ||
43 | #ifndef CONFIG_BT_RFCOMM_DEBUG | 44 | #ifndef CONFIG_BT_RFCOMM_DEBUG |
@@ -161,6 +162,24 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id) | |||
161 | return dev; | 162 | return dev; |
162 | } | 163 | } |
163 | 164 | ||
165 | static struct device *rfcomm_get_device(struct rfcomm_dev *dev) | ||
166 | { | ||
167 | struct hci_dev *hdev; | ||
168 | struct hci_conn *conn; | ||
169 | |||
170 | hdev = hci_get_route(&dev->dst, &dev->src); | ||
171 | if (!hdev) | ||
172 | return NULL; | ||
173 | |||
174 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); | ||
175 | if (!conn) | ||
176 | return NULL; | ||
177 | |||
178 | hci_dev_put(hdev); | ||
179 | |||
180 | return &conn->dev; | ||
181 | } | ||
182 | |||
164 | static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | 183 | static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) |
165 | { | 184 | { |
166 | struct rfcomm_dev *dev; | 185 | struct rfcomm_dev *dev; |
@@ -244,7 +263,7 @@ out: | |||
244 | return err; | 263 | return err; |
245 | } | 264 | } |
246 | 265 | ||
247 | tty_register_device(rfcomm_tty_driver, dev->id, NULL); | 266 | tty_register_device(rfcomm_tty_driver, dev->id, rfcomm_get_device(dev)); |
248 | 267 | ||
249 | return dev->id; | 268 | return dev->id; |
250 | } | 269 | } |