Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c96bb92 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "bluetooth: Configure DUT as MASTER for outgoing connection requests"

parents 4592b5f0 e2452ddd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -600,6 +600,7 @@ int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level);
int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type);
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);

+20 −0
Original line number Diff line number Diff line
@@ -96,6 +96,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
@@ -812,6 +814,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)
{
+2 −2
Original line number Diff line number Diff line
@@ -1418,7 +1418,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:
@@ -2135,7 +2135,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->io_capability = 0x03; /* No Input No Output */
	hdev->inq_tx_power = HCI_TX_POWER_INVALID;
	hdev->adv_tx_power = HCI_TX_POWER_INVALID;
+3 −0
Original line number Diff line number Diff line
@@ -1726,6 +1726,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)