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

Commit dc86dbf1 authored by Nitin Srivastava's avatar Nitin Srivastava Committed by Rupesh Tatiya
Browse files

bluetooth: Fix SCO connection synchronization.



Configure the alternate setting of interface '1' to
'2' once the BT USB driver gets the SCO connection complete
event from HCI Layer. Similarly, configure the alt. setting
to '0' on SCO disconnection complete event.

Change-Id: Ia1384451bedda52749599516e9ff4ec3b1f409c7
Signed-off-by: default avatarNitin Srivastava <nitinsr@codeaurora.org>
Signed-off-by: default avatarRupesh Tatiya <rtatiya@codeaurora.org>
parent 6e11466b
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@
static bool disable_scofix;
static bool force_scofix;

static bool reset = 1;
static int sco_conn;
static int reset = 1;

static struct usb_driver btusb_driver;

@@ -1121,8 +1122,9 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt)

	BT_DBG("%s evt %d", hdev->name, evt);

	if (hci_conn_num(hdev, SCO_LINK) != data->sco_num) {
		data->sco_num = hci_conn_num(hdev, SCO_LINK);
	if ((evt == HCI_NOTIFY_SCO_COMPLETE) || (evt == HCI_NOTIFY_CONN_DEL)) {
		BT_DBG("SCO conn state changed: evt %d", evt);
		sco_conn = (evt == HCI_NOTIFY_SCO_COMPLETE) ? 1 : 0;
		schedule_work(&data->work);
	}
}
@@ -1177,7 +1179,7 @@ static void btusb_work(struct work_struct *work)
	int new_alts;
	int err;

	if (data->sco_num > 0) {
	if (sco_conn) {
		if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
			err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf);
			if (err < 0) {
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
#define HCI_NOTIFY_CONN_ADD		1
#define HCI_NOTIFY_CONN_DEL		2
#define HCI_NOTIFY_VOICE_SETTING	3
#define HCI_NOTIFY_SCO_COMPLETE		4

/* HCI bus types */
#define HCI_VIRTUAL	0
+3 −0
Original line number Diff line number Diff line
@@ -3486,6 +3486,9 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev,
		conn->state  = BT_CONNECTED;

		hci_conn_add_sysfs(conn);
		BT_DBG("SCO conn complete");
		if (hdev->notify)
			hdev->notify(hdev, HCI_NOTIFY_SCO_COMPLETE);
		break;

	case 0x10:	/* Connection Accept Timeout */