Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1207101ybh; Thu, 16 Jul 2020 06:15:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxA4bLAE0YG8lMG6xxmi3yWjHaGCtT+Ov/7jpMeVNcAa9+G/TGgoyWs+EI/SMN0d1wLJRdB X-Received: by 2002:aa7:da58:: with SMTP id w24mr4482294eds.385.1594905322488; Thu, 16 Jul 2020 06:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594905322; cv=none; d=google.com; s=arc-20160816; b=n6OAHCZ4jRx0QMEA3By8IxyAC8I1B39fKvsrtp7m2/9CyJ5EUfcCeKEPBbyRSH7nvK SLacirkCO7OfSzrYf2OKmuIiC8v5bJZx9Nbxx4U5iXfbLyFUdI7Lld/ufMlB0FITAcbE FhduSDam/SGy80UA0hpeKczGYTHzVsqqj1wwGWCQGjJmcFarF2v/xGvIMiZRzNQc8Cu4 qO4veX5y73RT6+hbfSHiM0dMgblSGIvPBDI6obhlUDPLAZz/dS/PvCsXRWbWFNxBxAbU tlmQU/4yrYhoTgk9hAkXC98tCY2MTqPkPm5eDF/6GslWY/wL8Q/ugkTO8+0V6nIbQwas WWNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=/vOJyX8tEsKzxF4EXTd+UHf0qAPf1IVmB7ces1VbJpc=; b=KFDlh8falZ0WUjqEEa3P2u1Etnw3vXoCbibA6cG/j/p3voWFQx09OptAFBcadtUg/W SU8tqSbzMXHTw55LqBXoHFXa1YKx5OmI29XiCxsvsQlpz+3YK+6izydsh+cNHvdrprbT 0wweFFI0NJXSRMOksxsMvh+/+jeeFj5V31duVjALGJ7e6fwkj4KqXgqC1PtbgyuASvOh UObVtI6bEKWuq+TAUx13ueAOxcDsDdxNo58VmPb0/N6EHZ2c8zXiTov/UShBLfbwOyyY LxdNpv+fb4lUaI6dnWGirEysYEJ1ZEaJ7b5wsvpns2p1VsL7FIj13eZoFPaBPQKKFAFl kQQA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x8si3769387edl.120.2020.07.16.06.14.38; Thu, 16 Jul 2020 06:15:22 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728271AbgGPNOe convert rfc822-to-8bit (ORCPT + 99 others); Thu, 16 Jul 2020 09:14:34 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:39948 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728260AbgGPNOd (ORCPT ); Thu, 16 Jul 2020 09:14:33 -0400 Received: from marcel-macbook.fritz.box (p5b3d2638.dip0.t-ipconnect.de [91.61.38.56]) by mail.holtmann.org (Postfix) with ESMTPSA id 7A4F8CED01; Thu, 16 Jul 2020 15:24:30 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH RFC] bluetooth: add support for some old headsets From: Marcel Holtmann In-Reply-To: <6f461412-a6c0-aa53-5e74-394e278ee9b1@omprussia.ru> Date: Thu, 16 Jul 2020 15:14:31 +0200 Cc: Johan Hedberg , Bluetooth Kernel Mailing List , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <1834765D-52E6-45B8-9923-778C9182CFA9@holtmann.org> References: <6f461412-a6c0-aa53-5e74-394e278ee9b1@omprussia.ru> To: Sergey Shtylyov X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Sergey, > 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. please include the parts of btmon output that show this issue. > 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; since this is the command status event, I doubt that sco->out check is needed. And I would start with a switch statement right away. I also think that we need to re-structure this hci_cs_setup_sync_conn function a little to avoid the deep indentation. Make it look more like hci_sync_conn_complete_evt also use a switch statement even if right now we only have one entry. Regards Marcel