2019-11-28 09:20:28

by Sathish Narasimman

[permalink] [raw]
Subject: [PATCH v4 1/2] bluetooth: add support to notify SCO air mode

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 <[email protected]>
---
include/net/bluetooth/hci.h | 2 ++
include/net/bluetooth/hci_core.h | 3 +++
net/bluetooth/hci_event.c | 9 +++++++++
3 files changed, 14 insertions(+)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 5bc1e30dedde..26af112b1f2c 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -52,6 +52,8 @@
#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

/* 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
+
#endif /* __HCI_CORE_H */
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);
+ }
+
hci_connect_cfm(conn, ev->status);
if (ev->status)
hci_conn_del(conn);
--
2.17.1


2019-11-29 12:15:09

by Sathish Narasimman

[permalink] [raw]
Subject: Re: [PATCH v4 1/2] bluetooth: add support to notify SCO air mode

Hi,

On Thu, Nov 28, 2019 at 2:47 PM Sathish Narsimman <[email protected]> wrote:
>
> 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 <[email protected]>
> ---
> include/net/bluetooth/hci.h | 2 ++
> include/net/bluetooth/hci_core.h | 3 +++
> net/bluetooth/hci_event.c | 9 +++++++++
> 3 files changed, 14 insertions(+)
>
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 5bc1e30dedde..26af112b1f2c 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -52,6 +52,8 @@
> #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
>
> /* 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
> +
> #endif /* __HCI_CORE_H */
> 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);
> + }
> +
> hci_connect_cfm(conn, ev->status);
> if (ev->status)
> hci_conn_del(conn);
> --
> 2.17.1
>

Please ignore this as Patch V5 is updated.

Regards
Sathish N