Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp19471394ybl; Sat, 4 Jan 2020 02:08:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzt7L9J/H0edi6kBQ0ZCJQGLacTOCKvFBIJdX7BUkqhuzEmMddFnmVjtINhA7sYQQkZ0/2A X-Received: by 2002:a9d:ee2:: with SMTP id 89mr41539276otj.270.1578132501362; Sat, 04 Jan 2020 02:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578132501; cv=none; d=google.com; s=arc-20160816; b=IBlFzI4UPSobtSrkYL7339/kcGucqNGxLd5BzKiMH1LPddhjJnk/iqOZcpvH5VStZd Z6Etd0l7v4HVjMxubWQP6OW/eXTtfzWpHBwrcqFn91yTqf/FsGuh+8oAHPsH4wWFvpap QJ6LnjsITcBULp8Dvo5QF152EYZLKxOWPHJYKQGOS0V3TvoI+8n/sZWimCDlSvUAqfxK 16CXu1GKzVCTUnqoMR7L11rD95i6tCHR7WYWv4cfzP0sR7i7nsEULKJmUULj8op9BoEf hRurrxnmkddfhlmd8AhJPaBQtu5Xa3fJimuHfBR7XU7y740ugMGea0wBKMywDTxIehUJ +rpQ== 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=T2gp+k5/cQbT/dj8E7T8k+iQG9j5+EqZ/CJPR/rJQGk=; b=QuTmTYJIZsGcUr8sfbLfaXsSoODdMRuxJQZsbYtLkD8zH785lKHGc0N/mphF39MIWn nz5w5ZXFyLTTQ7LFHJ3w5879BEn/h6cgTNTOJ9wkBjU0expX4+WngqstFZeOq2j9Ndb4 Rn2EnXaP48b2T3lvDaYUb/nVM1BtRa+PMTwkSB7layGQ4ez7z8YaPE75ggNzbPDQIbLu vC1X/A10OWcOZyQCUdR2QR9UntiFrxjWk9PYe8c3M8sylW9tvaeuoeDVdhs+cFuyeiS3 3KtmysKg176xceFtja4ZTo7h7eX6bf385LiDZCbaa+9LMKs+aBBi8ga4ToOn12BsHwT+ bw+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si28795639ois.221.2020.01.04.02.08.09; Sat, 04 Jan 2020 02:08:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726275AbgADKII convert rfc822-to-8bit (ORCPT + 99 others); Sat, 4 Jan 2020 05:08:08 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:38272 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbgADKII (ORCPT ); Sat, 4 Jan 2020 05:08:08 -0500 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id B1438CED13; Sat, 4 Jan 2020 11:17:22 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: [PATCH v5 1/2] bluetooth: add support to notify SCO air mode From: Marcel Holtmann In-Reply-To: <20191129121042.3311-1-sathish.narasimman@intel.com> Date: Sat, 4 Jan 2020 11:08:06 +0100 Cc: BlueZ devel list , Sathish Narsimman Content-Transfer-Encoding: 8BIT Message-Id: References: <20191129121042.3311-1-sathish.narasimman@intel.com> To: Sathish Narsimman X-Mailer: Apple Mail (2.3608.40.2.2.4) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Satish, > notifying HCI_NOTIFY_CONN_ADD for SCO connection is generic in > case of msbc audio. To differnetiate SCO air mode audio introducing > HCI_NOTIFY_SCO_CVSD and HCI_NOTIFY_SCO_TRASP. > > Signed-off-by: Sathish Narsimman > --- > include/net/bluetooth/hci.h | 3 +++ > include/net/bluetooth/hci_core.h | 3 +++ > net/bluetooth/hci_conn.c | 19 +++++++++++++++---- > net/bluetooth/hci_event.c | 9 +++++++++ > 4 files changed, 30 insertions(+), 4 deletions(-) > > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h > index 5bc1e30dedde..bfaaef1aa4d6 100644 > --- a/include/net/bluetooth/hci.h > +++ b/include/net/bluetooth/hci.h > @@ -52,6 +52,9 @@ > #define HCI_NOTIFY_CONN_ADD 1 > #define HCI_NOTIFY_CONN_DEL 2 > #define HCI_NOTIFY_VOICE_SETTING 3 > +#define HCI_NOTIFY_ENABLE_SCO_CVSD 4 > +#define HCI_NOTIFY_ENABLE_SCO_TRANSP 5 > +#define HCI_NOTIFY_DISABLE_SCO 6 > > /* HCI bus types */ > #define HCI_VIRTUAL 0 > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h > index b689aceb636b..9258e19f8cc5 100644 > --- a/include/net/bluetooth/hci_core.h > +++ b/include/net/bluetooth/hci_core.h > @@ -1604,4 +1604,7 @@ void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, > #define SCO_AIRMODE_CVSD 0x0000 > #define SCO_AIRMODE_TRANSP 0x0003 > > +#define SCO_CODED_CVSD 0x02 > +#define SCO_CODED_TRANSP 0x03 > + why is this needed. And more important, what is wrong with SCO_AIRMODE_CVSD above? > #endif /* __HCI_CORE_H */ > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c > index 87691404d0c6..097a179418d6 100644 > --- a/net/bluetooth/hci_conn.c > +++ b/net/bluetooth/hci_conn.c > @@ -122,8 +122,13 @@ static void hci_conn_cleanup(struct hci_conn *conn) > > hci_conn_hash_del(hdev, conn); > > - if (hdev->notify) > - hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); > + if (conn->type == SCO_LINK || conn->type == ESCO_LINK) { > + if (hdev->notify) > + hdev->notify(hdev, HCI_NOTIFY_DISABLE_SCO); > + } else { > + if (hdev->notify) > + hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); > + } > > hci_conn_del_sysfs(conn); > > @@ -561,8 +566,14 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst, > hci_dev_hold(hdev); > > hci_conn_hash_add(hdev, conn); > - if (hdev->notify) > - hdev->notify(hdev, HCI_NOTIFY_CONN_ADD); > + > + /* As HCI_NOTIFY_ENABLE_SCO_CVSD & HCI_NOTIFY_ENABLE_SCO_TRANSP is > + * used to notify SCO connections during sync_conn_complete event > + */ > + if (conn->type != SCO_LINK && conn->type != ESCO_LINK) { > + if (hdev->notify) > + hdev->notify(hdev, HCI_NOTIFY_CONN_ADD); > + } > > hci_conn_init_sysfs(conn); > > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c > index c1d3a303d97f..ecad696db139 100644 > --- a/net/bluetooth/hci_event.c > +++ b/net/bluetooth/hci_event.c > @@ -4231,6 +4231,15 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, > break; > } > > + BT_DBG("sco connected with air mode: %02x", ev->air_mode); > + if (ev->air_mode == SCO_CODED_CVSD) { > + if (hdev->notify) > + hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD); > + } else if (ev->air_mode == SCO_CODED_TRANSP) { > + if (hdev->notify) > + hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_TRANSP); > + } > + You are however forgetting the old hci_conn_complete for legacy SCO setup. Regards Marcel