Loading include/net/bluetooth/hci_core.h +1 −0 Original line number Diff line number Diff line Loading @@ -730,6 +730,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type, bool initiator); int hci_conn_change_link_key(struct hci_conn *conn); int hci_conn_switch_role(struct hci_conn *conn, __u8 role); int hci_cfg_link_policy(struct hci_conn *conn); void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); Loading net/bluetooth/hci_conn.c +20 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,8 @@ static void hci_acl_create_connection(struct hci_conn *conn) } cp.pkt_type = cpu_to_le16(conn->pkt_type); /* Allow DUT to be MASTER for allow outgoing connection requests */ hdev->link_mode |= HCI_LM_MASTER; if (lmp_rswitch_capable(hdev) && !(hdev->link_mode & HCI_LM_MASTER)) cp.role_switch = 0x01; else Loading Loading @@ -1113,6 +1115,24 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role) } EXPORT_SYMBOL(hci_conn_switch_role); /* Change ACL link policy */ int hci_cfg_link_policy(struct hci_conn *conn) { struct hci_cp_write_link_policy lp; if (conn == NULL) { BT_ERR("%s: NO HCI Connection handle available!", __func__); return -ENODEV; } BT_INFO("%s: Disabling role switch on the ACL handle %d", __func__, conn->handle); lp.handle = conn->handle; lp.policy = HCI_LP_HOLD|HCI_LP_SNIFF|HCI_LP_PARK; hci_send_cmd(conn->hdev, HCI_OP_WRITE_LINK_POLICY, sizeof(lp), &lp); return 0; } EXPORT_SYMBOL(hci_cfg_link_policy); /* Enter active mode */ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active) { Loading net/bluetooth/hci_core.c +2 −2 Original line number Diff line number Diff line Loading @@ -2866,7 +2866,7 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg) case HCISETLINKMODE: hdev->link_mode = ((__u16) dr.dev_opt) & (HCI_LM_MASTER | HCI_LM_ACCEPT); (HCI_LM_MASTER); break; case HCISETPTYPE: Loading Loading @@ -3985,7 +3985,7 @@ struct hci_dev *hci_alloc_dev(void) hdev->pkt_type = (HCI_DM1 | HCI_DH1 | HCI_HV1); hdev->esco_type = (ESCO_HV1); hdev->link_mode = (HCI_LM_ACCEPT); hdev->link_mode = (HCI_LM_MASTER); /* Allow DUT to be in MASTER role */ hdev->num_iac = 0x01; /* One IAC support is mandatory */ hdev->io_capability = 0x03; /* No Input No Output */ hdev->manufacturer = 0xffff; /* Default to internal use */ Loading net/bluetooth/hci_event.c +3 −0 Original line number Diff line number Diff line Loading @@ -2088,6 +2088,9 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp), &cp); } /* Change the ACL LINK POLICY to disable role switch */ hci_cfg_link_policy(conn); } else { conn->state = BT_CLOSED; if (conn->type == ACL_LINK) Loading Loading
include/net/bluetooth/hci_core.h +1 −0 Original line number Diff line number Diff line Loading @@ -730,6 +730,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type, bool initiator); int hci_conn_change_link_key(struct hci_conn *conn); int hci_conn_switch_role(struct hci_conn *conn, __u8 role); int hci_cfg_link_policy(struct hci_conn *conn); void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); Loading
net/bluetooth/hci_conn.c +20 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,8 @@ static void hci_acl_create_connection(struct hci_conn *conn) } cp.pkt_type = cpu_to_le16(conn->pkt_type); /* Allow DUT to be MASTER for allow outgoing connection requests */ hdev->link_mode |= HCI_LM_MASTER; if (lmp_rswitch_capable(hdev) && !(hdev->link_mode & HCI_LM_MASTER)) cp.role_switch = 0x01; else Loading Loading @@ -1113,6 +1115,24 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role) } EXPORT_SYMBOL(hci_conn_switch_role); /* Change ACL link policy */ int hci_cfg_link_policy(struct hci_conn *conn) { struct hci_cp_write_link_policy lp; if (conn == NULL) { BT_ERR("%s: NO HCI Connection handle available!", __func__); return -ENODEV; } BT_INFO("%s: Disabling role switch on the ACL handle %d", __func__, conn->handle); lp.handle = conn->handle; lp.policy = HCI_LP_HOLD|HCI_LP_SNIFF|HCI_LP_PARK; hci_send_cmd(conn->hdev, HCI_OP_WRITE_LINK_POLICY, sizeof(lp), &lp); return 0; } EXPORT_SYMBOL(hci_cfg_link_policy); /* Enter active mode */ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active) { Loading
net/bluetooth/hci_core.c +2 −2 Original line number Diff line number Diff line Loading @@ -2866,7 +2866,7 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg) case HCISETLINKMODE: hdev->link_mode = ((__u16) dr.dev_opt) & (HCI_LM_MASTER | HCI_LM_ACCEPT); (HCI_LM_MASTER); break; case HCISETPTYPE: Loading Loading @@ -3985,7 +3985,7 @@ struct hci_dev *hci_alloc_dev(void) hdev->pkt_type = (HCI_DM1 | HCI_DH1 | HCI_HV1); hdev->esco_type = (ESCO_HV1); hdev->link_mode = (HCI_LM_ACCEPT); hdev->link_mode = (HCI_LM_MASTER); /* Allow DUT to be in MASTER role */ hdev->num_iac = 0x01; /* One IAC support is mandatory */ hdev->io_capability = 0x03; /* No Input No Output */ hdev->manufacturer = 0xffff; /* Default to internal use */ Loading
net/bluetooth/hci_event.c +3 −0 Original line number Diff line number Diff line Loading @@ -2088,6 +2088,9 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp), &cp); } /* Change the ACL LINK POLICY to disable role switch */ hci_cfg_link_policy(conn); } else { conn->state = BT_CLOSED; if (conn->type == ACL_LINK) Loading