Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1461297ybb; Thu, 2 Apr 2020 00:57:51 -0700 (PDT) X-Google-Smtp-Source: APiQypLYuvUOakAJqxa3u5lRJxaS/BtD3imnb//Ob5Gf83ZSkC007ySrzhhfWg9r3rmz/kWqY0Rf X-Received: by 2002:aca:2811:: with SMTP id 17mr1369385oix.126.1585814271874; Thu, 02 Apr 2020 00:57:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585814271; cv=none; d=google.com; s=arc-20160816; b=mk13szkx7NxuBnlJjIdK8sjE8YacopkXJZ03mYP7BbsTPkhq4RhKEiiMo0tDdwt+SN Ty/N68eCDVXqZ+IIPWtkPNdkoNCu1eTAX/l2CBGNMlEMU2BlqenAED1oK1n0Ci9KFegE S/pFSiXQk0vozGdrmSiY2b2TtfsvxLUMA8VGfc9Nx1TslwxSinjuVfSF86rT9FWN/OX/ 5QNzP52C3PBYuyzWLvxqQ35bXmjH1XkDhOsAW0AeaGATNRiYmZh9KViAEVta3E1EaJJq yMN3zfnDayLQeV7NglXKsysOHnnTOdeKmRXc0Yf4kZvzV9IgvcmdXM0w5dbMtw9DiMCX HgzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=yA3S/DF/tIo6k1ooptSuMP1zDHNEY7uAXFfjKrD4uyE=; b=x8bm+14Q9QdV7f6cSO8r0ebHZish5r6J+6AkGwDuWegzW6qWNj+lkt4XrHIxN/Ch7b 7MVd6Cl/nG33s3SSZxmOWtNQ2xgjixUNcUgQrIF6Yw4cg77//vhjmAi0SIIS6NcOxn1s VxwCuvZIC+JpaJ9PcdD6UviN+QpxIvC4a72c2mQAHq37hYs4vUZItOH/WffQcBuCBd9M Sh7gt6dEHtxtYA/04D8+DSw0IlE+3kdUvJ+t2cxZ2on5/LCVysAkS4G/Kthqym6NMr6W lRU4QteYHaQgz+lXvzIDCsURK5XtKwjXGHg0cDMqibIFxzQ+zoYjLJ6F1YbonZCK0cAQ LBaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VOCQkXiS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t28si1979589ooc.16.2020.04.02.00.57.31; Thu, 02 Apr 2020 00:57:51 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VOCQkXiS; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726841AbgDBHzo (ORCPT + 99 others); Thu, 2 Apr 2020 03:55:44 -0400 Received: from mail-il1-f195.google.com ([209.85.166.195]:39262 "EHLO mail-il1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387599AbgDBHzn (ORCPT ); Thu, 2 Apr 2020 03:55:43 -0400 Received: by mail-il1-f195.google.com with SMTP id r5so2691823ilq.6 for ; Thu, 02 Apr 2020 00:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yA3S/DF/tIo6k1ooptSuMP1zDHNEY7uAXFfjKrD4uyE=; b=VOCQkXiSKlFEl5yU+Uw9/eNG4JKkGsPDY0mDHoS1bJtbda3I3CPMM3df6YaN/10Lz/ VwwuAq9P0Ya9+42dLhbIatH77H/suPG+exFWTAFwjOAwYkIyEz3FxM8I3RXXKl4L4+V+ 6MPbnfmfM+7xhvm14gKYHqxMzrExRFgXAWnTeO/lbQAgyrF45z6YsdW+kwS+ND9PibAS fJUvBjRA++ukEkGS7asbAN/KXEOgIM13rwkdqvu78yDeHCLosyXTpVHTzPNBc/58RaEc uBxtLhYzpD/jOkj9ykklDyOhr+/W0dgaKG8gma1p6fCKxmT/PKQ0QKQVwTdCJ++OqlMf +zrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yA3S/DF/tIo6k1ooptSuMP1zDHNEY7uAXFfjKrD4uyE=; b=tN7QOdrWERKnU/eB6/LDBjuHKPzCvEK0d2X91pZbOqHuxqlqJYxKGqHuDu5wWIc1y/ EvURjEmAe+ONsNdqLbSZj10Ap0jLp2hXueu86uu02IWHP4xzjGipD4ODiDgnqCPrwgAC oDxZD4lOKOWH7CTB+WNirL0A2ud/nertFgwChxPs+RER7yoYBQSqeBhz1XPg0a8x4JIE +r03gvfKNHuOk921zg2GoGxwtKjrNismokYzb8GahnJ29DcpLglf2LyL+s7Drdo4ORf+ nfV3iLSA6ugY8tM7acnlpzSiWYbAhQIkhkeCO2CF/Vctirwvekj5ifgBcTTO7hbI15pp a1AA== X-Gm-Message-State: AGi0PubTf2S+IrxIteVLTLmGEFZQui/8ZAUTEwMFfXBv0KruvWfuqyvW ohwFeY/gzpmW42qrjZ2Mtw/E3dvRbnZ8rHgiYh0= X-Received: by 2002:a92:9fd0:: with SMTP id z77mr1992287ilk.257.1585814142421; Thu, 02 Apr 2020 00:55:42 -0700 (PDT) MIME-Version: 1.0 References: <20191129121042.3311-1-sathish.narasimman@intel.com> In-Reply-To: From: Sathish Narasimman Date: Thu, 2 Apr 2020 13:25:30 +0530 Message-ID: Subject: Re: [PATCH v5 1/2] bluetooth: add support to notify SCO air mode To: Marcel Holtmann Cc: BlueZ devel list , Sathish Narsimman Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Marcel On Sat, Jan 4, 2020 at 3:38 PM Marcel Holtmann wrote: > > 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? > AFAIK the above is voice settings param (core spec 5.0, Vol 2, Part E, 6.12) which is used to set the sco pkt type. This patch is to notify the btusb layer. when we receive sync_conn_complete_evt based on the AIR_MODE we receive SCO_CODED_CVSD and SCO_CODED_TRANSP are used to choose alt_setting. air_mode value we receive are 1 byte whereas voice setting param is 2 bytes and are different for CVSD > > #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. Will fix this and update in next version > > Regards > > Marcel >