mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
Bluetooth: hci_event: Add support for handling LE BIG Sync Lost event
When the BIS source stops, the controller sends an LE BIG Sync Lost event (subevent 0x1E). Currently, this event is not handled, causing the BIS stream to remain active in BlueZ and preventing recovery. Signed-off-by: Yang Li <yang.li@amlogic.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
45b54f007d
commit
b2a5f2e1c1
@ -2851,6 +2851,12 @@ struct hci_evt_le_big_sync_estabilished {
|
|||||||
__le16 bis[];
|
__le16 bis[];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
#define HCI_EVT_LE_BIG_SYNC_LOST 0x1e
|
||||||
|
struct hci_evt_le_big_sync_lost {
|
||||||
|
__u8 handle;
|
||||||
|
__u8 reason;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
#define HCI_EVT_LE_BIG_INFO_ADV_REPORT 0x22
|
#define HCI_EVT_LE_BIG_INFO_ADV_REPORT 0x22
|
||||||
struct hci_evt_le_big_info_adv_report {
|
struct hci_evt_le_big_info_adv_report {
|
||||||
__le16 sync_handle;
|
__le16 sync_handle;
|
||||||
|
@ -1346,7 +1346,8 @@ hci_conn_hash_lookup_big_sync_pend(struct hci_dev *hdev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline struct hci_conn *
|
static inline struct hci_conn *
|
||||||
hci_conn_hash_lookup_big_state(struct hci_dev *hdev, __u8 handle, __u16 state)
|
hci_conn_hash_lookup_big_state(struct hci_dev *hdev, __u8 handle, __u16 state,
|
||||||
|
__u8 role)
|
||||||
{
|
{
|
||||||
struct hci_conn_hash *h = &hdev->conn_hash;
|
struct hci_conn_hash *h = &hdev->conn_hash;
|
||||||
struct hci_conn *c;
|
struct hci_conn *c;
|
||||||
@ -1354,7 +1355,7 @@ hci_conn_hash_lookup_big_state(struct hci_dev *hdev, __u8 handle, __u16 state)
|
|||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
|
|
||||||
list_for_each_entry_rcu(c, &h->list, list) {
|
list_for_each_entry_rcu(c, &h->list, list) {
|
||||||
if (c->type != BIS_LINK || c->state != state)
|
if (c->type != BIS_LINK || c->state != state || c->role != role)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (handle == c->iso_qos.bcast.big) {
|
if (handle == c->iso_qos.bcast.big) {
|
||||||
|
@ -2146,7 +2146,8 @@ struct hci_conn *hci_bind_bis(struct hci_dev *hdev, bdaddr_t *dst, __u8 sid,
|
|||||||
struct hci_link *link;
|
struct hci_link *link;
|
||||||
|
|
||||||
/* Look for any BIS that is open for rebinding */
|
/* Look for any BIS that is open for rebinding */
|
||||||
conn = hci_conn_hash_lookup_big_state(hdev, qos->bcast.big, BT_OPEN);
|
conn = hci_conn_hash_lookup_big_state(hdev, qos->bcast.big, BT_OPEN,
|
||||||
|
HCI_ROLE_MASTER);
|
||||||
if (conn) {
|
if (conn) {
|
||||||
memcpy(qos, &conn->iso_qos, sizeof(*qos));
|
memcpy(qos, &conn->iso_qos, sizeof(*qos));
|
||||||
conn->state = BT_CONNECTED;
|
conn->state = BT_CONNECTED;
|
||||||
|
@ -6876,7 +6876,8 @@ static void hci_le_create_big_complete_evt(struct hci_dev *hdev, void *data,
|
|||||||
|
|
||||||
/* Connect all BISes that are bound to the BIG */
|
/* Connect all BISes that are bound to the BIG */
|
||||||
while ((conn = hci_conn_hash_lookup_big_state(hdev, ev->handle,
|
while ((conn = hci_conn_hash_lookup_big_state(hdev, ev->handle,
|
||||||
BT_BOUND))) {
|
BT_BOUND,
|
||||||
|
HCI_ROLE_MASTER))) {
|
||||||
if (ev->status) {
|
if (ev->status) {
|
||||||
hci_connect_cfm(conn, ev->status);
|
hci_connect_cfm(conn, ev->status);
|
||||||
hci_conn_del(conn);
|
hci_conn_del(conn);
|
||||||
@ -6992,6 +6993,37 @@ unlock:
|
|||||||
hci_dev_unlock(hdev);
|
hci_dev_unlock(hdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hci_le_big_sync_lost_evt(struct hci_dev *hdev, void *data,
|
||||||
|
struct sk_buff *skb)
|
||||||
|
{
|
||||||
|
struct hci_evt_le_big_sync_lost *ev = data;
|
||||||
|
struct hci_conn *bis, *conn;
|
||||||
|
|
||||||
|
bt_dev_dbg(hdev, "big handle 0x%2.2x", ev->handle);
|
||||||
|
|
||||||
|
hci_dev_lock(hdev);
|
||||||
|
|
||||||
|
/* Delete the pa sync connection */
|
||||||
|
bis = hci_conn_hash_lookup_pa_sync_big_handle(hdev, ev->handle);
|
||||||
|
if (bis) {
|
||||||
|
conn = hci_conn_hash_lookup_pa_sync_handle(hdev,
|
||||||
|
bis->sync_handle);
|
||||||
|
if (conn)
|
||||||
|
hci_conn_del(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Delete each bis connection */
|
||||||
|
while ((bis = hci_conn_hash_lookup_big_state(hdev, ev->handle,
|
||||||
|
BT_CONNECTED,
|
||||||
|
HCI_ROLE_SLAVE))) {
|
||||||
|
clear_bit(HCI_CONN_BIG_SYNC, &bis->flags);
|
||||||
|
hci_disconn_cfm(bis, ev->reason);
|
||||||
|
hci_conn_del(bis);
|
||||||
|
}
|
||||||
|
|
||||||
|
hci_dev_unlock(hdev);
|
||||||
|
}
|
||||||
|
|
||||||
static void hci_le_big_info_adv_report_evt(struct hci_dev *hdev, void *data,
|
static void hci_le_big_info_adv_report_evt(struct hci_dev *hdev, void *data,
|
||||||
struct sk_buff *skb)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
@ -7115,6 +7147,11 @@ static const struct hci_le_ev {
|
|||||||
hci_le_big_sync_established_evt,
|
hci_le_big_sync_established_evt,
|
||||||
sizeof(struct hci_evt_le_big_sync_estabilished),
|
sizeof(struct hci_evt_le_big_sync_estabilished),
|
||||||
HCI_MAX_EVENT_SIZE),
|
HCI_MAX_EVENT_SIZE),
|
||||||
|
/* [0x1e = HCI_EVT_LE_BIG_SYNC_LOST] */
|
||||||
|
HCI_LE_EV_VL(HCI_EVT_LE_BIG_SYNC_LOST,
|
||||||
|
hci_le_big_sync_lost_evt,
|
||||||
|
sizeof(struct hci_evt_le_big_sync_lost),
|
||||||
|
HCI_MAX_EVENT_SIZE),
|
||||||
/* [0x22 = HCI_EVT_LE_BIG_INFO_ADV_REPORT] */
|
/* [0x22 = HCI_EVT_LE_BIG_INFO_ADV_REPORT] */
|
||||||
HCI_LE_EV_VL(HCI_EVT_LE_BIG_INFO_ADV_REPORT,
|
HCI_LE_EV_VL(HCI_EVT_LE_BIG_INFO_ADV_REPORT,
|
||||||
hci_le_big_info_adv_report_evt,
|
hci_le_big_info_adv_report_evt,
|
||||||
|
Loading…
Reference in New Issue
Block a user