forked from fat-tire/nook_kernel
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backported from 2.6.35 by fat-tire
- Loading branch information
Showing
7 changed files
with
151 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
BlueZ - Bluetooth protocol stack for Linux | ||
Copyright (C) 2000-2001 Qualcomm Incorporated | ||
Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. | ||
Written 2000,2001 by Maxim Krasnyansky <[email protected]> | ||
|
@@ -107,7 +107,7 @@ struct hci_dev { | |
unsigned long acl_last_tx; | ||
unsigned long sco_last_tx; | ||
|
||
struct workqueue_struct *workqueue; | ||
struct workqueue_struct *workqueue; | ||
|
||
struct tasklet_struct cmd_task; | ||
struct tasklet_struct rx_task; | ||
|
@@ -137,7 +137,7 @@ struct hci_dev { | |
|
||
atomic_t promisc; | ||
|
||
struct dentry *debugfs; | ||
struct dentry *debugfs; | ||
|
||
struct device *parent; | ||
struct device dev; | ||
|
@@ -250,6 +250,7 @@ enum { | |
HCI_CONN_ENCRYPT_PEND, | ||
HCI_CONN_RSWITCH_PEND, | ||
HCI_CONN_MODE_CHANGE_PEND, | ||
HCI_CONN_SCO_SETUP_PEND, | ||
}; | ||
|
||
static inline void hci_conn_hash_init(struct hci_dev *hdev) | ||
|
@@ -330,6 +331,7 @@ void hci_acl_connect(struct hci_conn *conn); | |
void hci_acl_disconn(struct hci_conn *conn, __u8 reason); | ||
void hci_add_sco(struct hci_conn *conn, __u16 handle); | ||
void hci_setup_sync(struct hci_conn *conn, __u16 handle); | ||
void hci_sco_setup(struct hci_conn *conn, __u8 status); | ||
|
||
struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, | ||
__u16 pkt_type, bdaddr_t *dst); | ||
|
@@ -378,17 +380,17 @@ static inline void hci_conn_put(struct hci_conn *conn) | |
/* ----- HCI tasks ----- */ | ||
static inline void hci_sched_cmd(struct hci_dev *hdev) | ||
{ | ||
tasklet_schedule(&hdev->cmd_task); | ||
tasklet_schedule(&hdev->cmd_task); | ||
} | ||
|
||
static inline void hci_sched_rx(struct hci_dev *hdev) | ||
{ | ||
tasklet_schedule(&hdev->rx_task); | ||
tasklet_schedule(&hdev->rx_task); | ||
} | ||
|
||
static inline void hci_sched_tx(struct hci_dev *hdev) | ||
{ | ||
tasklet_schedule(&hdev->tx_task); | ||
tasklet_schedule(&hdev->tx_task); | ||
} | ||
|
||
/* ----- HCI Devices ----- */ | ||
|
@@ -446,27 +448,28 @@ int hci_inquiry(void __user *arg); | |
void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | ||
|
||
/* Receive frame from HCI drivers */ | ||
static inline int hci_recv_frame(struct sk_buff *skb) | ||
{ | ||
struct hci_dev *hdev = (struct hci_dev *) skb->dev; | ||
if (!hdev || (!test_bit(HCI_UP, &hdev->flags) | ||
&& !test_bit(HCI_INIT, &hdev->flags))) { | ||
kfree_skb(skb); | ||
return -ENXIO; | ||
} | ||
|
||
/* Incomming skb */ | ||
bt_cb(skb)->incoming = 1; | ||
|
||
/* Time stamp */ | ||
__net_timestamp(skb); | ||
|
||
/* Queue frame for rx task */ | ||
skb_queue_tail(&hdev->rx_q, skb); | ||
hci_sched_rx(hdev); | ||
return 0; | ||
static inline int hci_recv_frame(struct sk_buff *skb) | ||
{ | ||
struct hci_dev *hdev = (struct hci_dev *) skb->dev; | ||
if (!hdev || (!test_bit(HCI_UP, &hdev->flags) | ||
&& !test_bit(HCI_INIT, &hdev->flags))) { | ||
kfree_skb(skb); | ||
return -ENXIO; | ||
} | ||
|
||
/* Incomming skb */ | ||
bt_cb(skb)->incoming = 1; | ||
|
||
/* Time stamp */ | ||
__net_timestamp(skb); | ||
|
||
/* Queue frame for rx task */ | ||
skb_queue_tail(&hdev->rx_q, skb); | ||
hci_sched_rx(hdev); | ||
return 0; | ||
} | ||
|
||
//int hci_recv_frame(struct sk_buff *skb); | ||
int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); | ||
|
||
int hci_register_sysfs(struct hci_dev *hdev); | ||
|
@@ -719,3 +722,4 @@ struct hci_sec_filter { | |
void hci_req_complete(struct hci_dev *hdev, int result); | ||
|
||
#endif /* __HCI_CORE_H */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
BlueZ - Bluetooth protocol stack for Linux | ||
Copyright (C) 2000-2001 Qualcomm Incorporated | ||
Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. | ||
Written 2000,2001 by Maxim Krasnyansky <[email protected]> | ||
|
@@ -155,6 +155,27 @@ void hci_setup_sync(struct hci_conn *conn, __u16 handle) | |
hci_send_cmd(hdev, HCI_OP_SETUP_SYNC_CONN, sizeof(cp), &cp); | ||
} | ||
|
||
/* Device _must_ be locked */ | ||
void hci_sco_setup(struct hci_conn *conn, __u8 status) | ||
{ | ||
struct hci_conn *sco = conn->link; | ||
|
||
BT_DBG("%p", conn); | ||
|
||
if (!sco) | ||
return; | ||
|
||
if (!status) { | ||
if (lmp_esco_capable(conn->hdev)) | ||
hci_setup_sync(sco, conn->handle); | ||
else | ||
hci_add_sco(sco, conn->handle); | ||
} else { | ||
hci_proto_connect_cfm(sco, status); | ||
hci_conn_del(sco); | ||
} | ||
} | ||
|
||
static void hci_conn_timeout(unsigned long arg) | ||
{ | ||
struct hci_conn *conn = (void *) arg; | ||
|
@@ -369,6 +390,11 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, | |
acl->sec_level = sec_level; | ||
acl->auth_type = auth_type; | ||
hci_acl_connect(acl); | ||
} else { | ||
if (acl->sec_level < sec_level) | ||
acl->sec_level = sec_level; | ||
if (acl->auth_type < auth_type) | ||
acl->auth_type = auth_type; | ||
} | ||
|
||
if (type == ACL_LINK) | ||
|
@@ -391,10 +417,13 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, | |
acl->power_save = 1; | ||
hci_conn_enter_active_mode(acl); | ||
|
||
if (lmp_esco_capable(hdev)) | ||
hci_setup_sync(sco, acl->handle); | ||
else | ||
hci_add_sco(sco, acl->handle); | ||
if (test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->pend)) { | ||
/* defer SCO setup until mode change completed */ | ||
set_bit(HCI_CONN_SCO_SETUP_PEND, &acl->pend); | ||
return sco; | ||
} | ||
|
||
hci_sco_setup(acl, 0x00); | ||
} | ||
|
||
return sco; | ||
|
@@ -732,3 +761,4 @@ int hci_get_auth_info(struct hci_dev *hdev, void __user *arg) | |
|
||
return copy_to_user(arg, &req, sizeof(req)) ? -EFAULT : 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.