trimmed. > Hi Ron, > > * Ron Shaffer <rshaffer@xxxxxxxxxxxxxx> [2010-05-24 16:11:01 -0500]: > >> >> Certain headsets such as the Motorola H350 will reject SCO and eSCO >> connection requests while the ACL is transitioning from sniff mode >> to active mode. Add synchronization so that SCO and eSCO connection >> requests will wait until the ACL has fully transitioned to active mode. >> >> Signed-off-by: Ron Shaffer <rshaffer@xxxxxxxxxxxxxx> > @@ -117,9 +117,18 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle) > > { > > struct hci_dev *hdev = conn->hdev; > > struct hci_cp_add_sco cp; > > + struct hci_conn *acl = conn->link; > > > > BT_DBG("%p", conn); > > > > + if (acl->mode == HCI_CM_SNIFF && > > + test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->pend)) { > Wrong indentation here. Add a extra tab for test_bit. > > + set_bit(HCI_CONN_SCO_PEND, &conn->pend); > > + return; > > + } > > + > > + clear_bit(HCI_CONN_SCO_PEND, &conn->pend); > > > You already clear the bit on hci_mode_change_evt with > test_and_clear_bit. No need to clear it again here. > The same happens for hci_setup_sync(). > Clearing the bit and clearing it in hci_change_mode_evt are independent actions for two different scenarios. Scenario 1: A SCO/eSCO connection is requested and the ACL is in active mode. Scenario 2: A SCO/eSCO connection is requested and the ACL is transitioning modes. For scenario 1, I cleared the bit here because I did not want to assume the bit had been initialized. If it's set, then any future changes to the ACL mode (sniff, active) requested by the local side would result in a request for a SCO or eSCO connection when one already exists. For scenario 2, the first conditional is TRUE, and the bit gets set. Later when the mode change event is received, the bit is cleared and the SCO/eSCO connection is requested. -- Ron Shaffer Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html