linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omprussia.ru>
To: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	<linux-bluetooth@vger.kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, <netdev@vger.kernel.org>
Subject: [PATCH RFC] bluetooth: add support for some old headsets
Date: Thu, 16 Jul 2020 14:08:01 +0300	[thread overview]
Message-ID: <6f461412-a6c0-aa53-5e74-394e278ee9b1@omprussia.ru> (raw)

The MediaTek Bluetooth platform (MT6630 etc.) has a peculiar implementation
for the eSCO/SCO connection via BT/EDR: the host controller returns error
code 0x20 (LMP feature not supported) for HCI_Setup_Synchronous_Connection
(0x0028) command without actually trying to setup connection with a remote
device in case such device (like Digma BT-14 headset) didn't advertise its
supported features.  Even though this doesn't break compatibility with the
Bluetooth standard it breaks the compatibility with the Hands-Free Profile
(HFP).

This patch returns the compatibility with the HFP profile and actually
tries to check all available connection parameters despite of the specific
MediaTek implementation. Without it one was unable to establish eSCO/SCO
connection with some headsets.

Based on the patch by Ildar Kamaletdinov <i.kamaletdinov@omprussia.ru>.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>

---
This patch is against the 'bluetooth-next.git' repo.

 net/bluetooth/hci_event.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: bluetooth-next/net/bluetooth/hci_event.c
===================================================================
--- bluetooth-next.orig/net/bluetooth/hci_event.c
+++ bluetooth-next/net/bluetooth/hci_event.c
@@ -2187,6 +2187,13 @@ static void hci_cs_setup_sync_conn(struc
 	if (acl) {
 		sco = acl->link;
 		if (sco) {
+			if (status == 0x20 && /* Unsupported LMP Parameter value */
+			    sco->out) {
+				sco->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) |
+						(hdev->esco_type & EDR_ESCO_MASK);
+				if (hci_setup_sync(sco, sco->link->handle))
+					goto unlock;
+			}
 			sco->state = BT_CLOSED;
 
 			hci_connect_cfm(sco, status);
@@ -2194,6 +2201,7 @@ static void hci_cs_setup_sync_conn(struc
 		}
 	}
 
+unlock:
 	hci_dev_unlock(hdev);
 }
 

             reply	other threads:[~2020-07-16 11:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 11:08 Sergey Shtylyov [this message]
2020-07-16 13:14 ` [PATCH RFC] bluetooth: add support for some old headsets Marcel Holtmann
2020-07-16 20:33   ` Sergey Shtylyov
2020-07-17  6:59     ` Marcel Holtmann
2020-07-17 19:12       ` Sergey Shtylyov
2020-07-21 18:56         ` Sergey Shtylyov
2020-07-28  7:16           ` Marcel Holtmann
2020-07-28 13:27             ` Ildar Kamaletdinov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f461412-a6c0-aa53-5e74-394e278ee9b1@omprussia.ru \
    --to=s.shtylyov@omprussia.ru \
    --cc=davem@davemloft.net \
    --cc=johan.hedberg@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).