Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1136972ybh; Thu, 16 Jul 2020 04:18:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRMXDBhVWnNqnmeYjg3XU7nZx56NKWubv0O/92DKKGDIW6hq+7uZ0R1rT7U0kQy60aARqI X-Received: by 2002:a17:906:492:: with SMTP id f18mr3207863eja.279.1594898312685; Thu, 16 Jul 2020 04:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594898312; cv=none; d=google.com; s=arc-20160816; b=cbwfuhwUr0Rkwf4fC4IIykWv8K81y3/T75rLfRHtm7RGHgR+mDjKRlp0NoKDFgLBzM CJdc/LJW7KWELEB8rm3UcNvTTrzJZURVHPYZrf//OrIRBZ/3zOpytMd11zKB3bnOnJra gl6qubBq1YfA1Mhg3ch+DjVAo1MBs73J0T2nxySiVCQ/xF91Qd3Y8F6hX67PY7uqFgAe BC/L9e5j9MssuRAhL6U18PlQbWBU4/lA3v7NHmELaMjJiYRk+YPSmmXVN04QuqyDt8xP suCR70/Xt5YAPLj0uLVs/D4z0QfMEUOBNe8iCbtbksVZJ37EvwdsT8cx+r3/3F7UmF+O xSqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id :organization:cc:to:subject:from:dkim-filter; bh=a+i193AZESFQBKVtGkfl5Lo87XIBhhUEgaFemoSZPIY=; b=HbygtG451R7jYiFtibrYeoNX2tmPDe91TNO+RIZY8UDVFLZ2cBlZdiwTQ9KG6QxJ0O 6KF2sYL7O6iWyKzAulmcXzlL/ZywHOfXk+DoivToC+LuUF+wZAHpwRxOQqCquBk3rU4i RjjQW+pg7oucWnfLHk8dyatH7ad91XDepEVv16blaM2z5y7wwCPvm3G0DeupExXJxv1o fjaggDWAThAfC5kpoqPxibpL25ClGvYY78y+I/3ciBfUSNzAiZdgMbWbNOO2K9VmdRE0 cfA2JZGEGqQcO1VgSDLMTgopmX46GcsIhBSLj8HZNlQmZ2W/bGdpFQTzKUwxyoepL7Ja 4A3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=omprussia.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 17si2825092ejw.686.2020.07.16.04.17.50; Thu, 16 Jul 2020 04:18:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=omprussia.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726515AbgGPLRo (ORCPT + 99 others); Thu, 16 Jul 2020 07:17:44 -0400 Received: from mxout03.lancloud.ru ([89.108.73.187]:33992 "EHLO mxout03.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbgGPLRo (ORCPT ); Thu, 16 Jul 2020 07:17:44 -0400 X-Greylist: delayed 579 seconds by postgrey-1.27 at vger.kernel.org; Thu, 16 Jul 2020 07:17:43 EDT Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 4E6132092F27 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov Subject: [PATCH RFC] bluetooth: add support for some old headsets To: Marcel Holtmann , Johan Hedberg , CC: "David S. Miller" , Jakub Kicinski , Organization: Open Mobile Platform, LLC Message-ID: <6f461412-a6c0-aa53-5e74-394e278ee9b1@omprussia.ru> Date: Thu, 16 Jul 2020 14:08:01 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [213.87.162.13] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1908.lancloud.ru (fd00:f066::208) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 . Signed-off-by: Sergey Shtylyov --- 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); }