* [PATCH 0/3] Fix missing HFP WBS callback
@ 2015-08-27 12:01 Will Wang
2015-08-27 12:02 ` [PATCH 1/3] android/hal-ipc-api: " Will Wang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Will Wang @ 2015-08-27 12:01 UTC (permalink / raw)
To: marcel, gustavo, johan.hedberg; +Cc: linux-bluetooth, Will Wang
Hi,
This set of patches:
- adds HFP Wideband speech(WBS) callback function for Android.
- adds a new opcode 0x91 for WBS Command notification.
The patches has been tested on Nexus 5 with Android 5.0.1 Lollipop,
and passed the PTS test "TC_AG_ACC_BI_12_I", the Android framework
outputs log such as:
08-20 18:29:39.932 E/BluetoothHeadsetServiceJni( 1442): mozzz: wbs_callback
...
08-20 18:29:39.933 D/HeadsetStateMachine( 1442): EVENT_TYPE_WBS codec is 1
08-20 18:29:39.935 D/HeadsetStateMachine( 1442): AudioManager.setParameters bt_wbs=off for PTS-HFP-MOZILLA-TPE-PC - 00:1B:DC:07:2F:9A
08-20 18:29:39.936 D/audio_hw_primary( 215): adev_set_parameters: enter: bt_wbs=off
Thanks Szymon Janc(:sjanc)'s speedy reply of the patch process questions
on IRC, and Shawn Huang(:shawnjohnjr)'s technical support.
Will Wang (3):
android/hal-ipc-api: Fix missing HFP WBS callback
android/hal-handsfree: Fix missing HFP WBS callback
android/handsfree: Fix missing HFP WBS callback
android/hal-handsfree.c | 12 ++++++++++++
android/hal-ipc-api.txt | 8 ++++++++
android/hal-msg.h | 6 ++++++
android/handsfree.c | 8 ++++++++
4 files changed, 34 insertions(+)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/3] android/hal-ipc-api: Fix missing HFP WBS callback 2015-08-27 12:01 [PATCH 0/3] Fix missing HFP WBS callback Will Wang @ 2015-08-27 12:02 ` Will Wang 2015-08-27 19:39 ` Szymon Janc 2015-08-27 12:02 ` [PATCH 2/3] android/hal-handsfree: " Will Wang 2015-08-27 12:02 ` [PATCH 3/3] android/handsfree: " Will Wang 2 siblings, 1 reply; 6+ messages in thread From: Will Wang @ 2015-08-27 12:02 UTC (permalink / raw) To: marcel, gustavo, johan.hedberg; +Cc: linux-bluetooth, Will Wang Add definition of HFP WBS Command notification --- android/hal-ipc-api.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt index 503b47a..e3b7798 100644 --- a/android/hal-ipc-api.txt +++ b/android/hal-ipc-api.txt @@ -1068,6 +1068,14 @@ Notifications: Notification parameters: Remote address (6 octets) + Opcode 0x91 - WBS Command notification + + Notification parameters: WBS types (1 octet) + Remote address (6 octets) + + Valid WBS types: 0x00 = None + 0x01 = No + 0x02 = Yes Bluetooth Advanced Audio HAL (ID 6) Bluetooth Advanced Audio Sink HAL (ID 13) -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] android/hal-ipc-api: Fix missing HFP WBS callback 2015-08-27 12:02 ` [PATCH 1/3] android/hal-ipc-api: " Will Wang @ 2015-08-27 19:39 ` Szymon Janc 0 siblings, 0 replies; 6+ messages in thread From: Szymon Janc @ 2015-08-27 19:39 UTC (permalink / raw) To: Will Wang; +Cc: marcel, gustavo, johan.hedberg, linux-bluetooth Hi Will, On Thursday 27 August 2015 20:02:00 Will Wang wrote: > Add definition of HFP WBS Command notification > --- > android/hal-ipc-api.txt | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt > index 503b47a..e3b7798 100644 > --- a/android/hal-ipc-api.txt > +++ b/android/hal-ipc-api.txt > @@ -1068,6 +1068,14 @@ Notifications: > > Notification parameters: Remote address (6 octets) > > + Opcode 0x91 - WBS Command notification > + > + Notification parameters: WBS types (1 octet) > + Remote address (6 octets) > + > + Valid WBS types: 0x00 = None > + 0x01 = No > + 0x02 = Yes > > Bluetooth Advanced Audio HAL (ID 6) > Bluetooth Advanced Audio Sink HAL (ID 13) This patch is now applied, thanks. -- Szymon K. Janc szymon.janc@gmail.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] android/hal-handsfree: Fix missing HFP WBS callback 2015-08-27 12:01 [PATCH 0/3] Fix missing HFP WBS callback Will Wang 2015-08-27 12:02 ` [PATCH 1/3] android/hal-ipc-api: " Will Wang @ 2015-08-27 12:02 ` Will Wang 2015-08-27 19:47 ` Szymon Janc 2015-08-27 12:02 ` [PATCH 3/3] android/handsfree: " Will Wang 2 siblings, 1 reply; 6+ messages in thread From: Will Wang @ 2015-08-27 12:02 UTC (permalink / raw) To: marcel, gustavo, johan.hedberg; +Cc: linux-bluetooth, Will Wang --- android/hal-handsfree.c | 12 ++++++++++++ android/hal-msg.h | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c index 279b26a..9ab04c5 100644 --- a/android/hal-handsfree.c +++ b/android/hal-handsfree.c @@ -153,6 +153,16 @@ static void handle_nrec(void *buf, uint16_t len, int fd) #endif } +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) +static void handle_wbs(void *buf, uint16_t len, int fd) +{ + struct hal_ev_handsfree_wbs *ev = buf; + + if (cbs->wbs_cb) + cbs->wbs_cb(ev->wbs, (bt_bdaddr_t *) (ev->bdaddr)); +} +#endif + static void handle_chld(void *buf, uint16_t len, int fd) { struct hal_ev_handsfree_chld *ev = buf; @@ -289,6 +299,8 @@ static const struct hal_ipc_handler ev_handlers[] = { /* HAL_EV_HANDSFREE_HSP_KEY_PRESS */ { handle_hsp_key_press, false, sizeof(struct hal_ev_handsfree_hsp_key_press) }, + /* HAL_EV_HANDSFREE_WBS */ + { handle_wbs, false, sizeof(struct hal_ev_handsfree_wbs) }, }; static uint8_t get_mode(void) diff --git a/android/hal-msg.h b/android/hal-msg.h index 698f45a..ea79fa7 100644 --- a/android/hal-msg.h +++ b/android/hal-msg.h @@ -1638,6 +1638,12 @@ struct hal_ev_handsfree_hsp_key_press { uint8_t bdaddr[6]; } __attribute__((packed)); +#define HAL_EV_HANDSFREE_WBS 0x91 +struct hal_ev_handsfree_wbs { + uint8_t wbs; + uint8_t bdaddr[6]; +} __attribute__((packed)); + #define HAL_AVRCP_FEATURE_NONE 0x00 #define HAL_AVRCP_FEATURE_METADATA 0x01 #define HAL_AVRCP_FEATURE_ABSOLUTE_VOLUME 0x02 -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] android/hal-handsfree: Fix missing HFP WBS callback 2015-08-27 12:02 ` [PATCH 2/3] android/hal-handsfree: " Will Wang @ 2015-08-27 19:47 ` Szymon Janc 0 siblings, 0 replies; 6+ messages in thread From: Szymon Janc @ 2015-08-27 19:47 UTC (permalink / raw) To: Will Wang; +Cc: marcel, gustavo, johan.hedberg, linux-bluetooth Hi Will, On Thursday 27 August 2015 20:02:01 Will Wang wrote: > --- > android/hal-handsfree.c | 12 ++++++++++++ > android/hal-msg.h | 6 ++++++ > 2 files changed, 18 insertions(+) > > diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c > index 279b26a..9ab04c5 100644 > --- a/android/hal-handsfree.c > +++ b/android/hal-handsfree.c > @@ -153,6 +153,16 @@ static void handle_nrec(void *buf, uint16_t len, int > fd) #endif > } > > +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) > +static void handle_wbs(void *buf, uint16_t len, int fd) > +{ > + struct hal_ev_handsfree_wbs *ev = buf; > + > + if (cbs->wbs_cb) > + cbs->wbs_cb(ev->wbs, (bt_bdaddr_t *) (ev->bdaddr)); > +} > +#endif > + This will not compile on Android KitKat (we still support it). Since daemon is version independent we need to have empty handler on hal. So #ifdefs should be inside function like: static void handle_wbs(void *buf, uint16_t len, int fd) { #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) ... #endif } > static void handle_chld(void *buf, uint16_t len, int fd) > { > struct hal_ev_handsfree_chld *ev = buf; > @@ -289,6 +299,8 @@ static const struct hal_ipc_handler ev_handlers[] = { > /* HAL_EV_HANDSFREE_HSP_KEY_PRESS */ > { handle_hsp_key_press, false, > sizeof(struct hal_ev_handsfree_hsp_key_press) }, > + /* HAL_EV_HANDSFREE_WBS */ > + { handle_wbs, false, sizeof(struct hal_ev_handsfree_wbs) }, > }; > > static uint8_t get_mode(void) > diff --git a/android/hal-msg.h b/android/hal-msg.h > index 698f45a..ea79fa7 100644 > --- a/android/hal-msg.h > +++ b/android/hal-msg.h > @@ -1638,6 +1638,12 @@ struct hal_ev_handsfree_hsp_key_press { > uint8_t bdaddr[6]; > } __attribute__((packed)); > > +#define HAL_EV_HANDSFREE_WBS 0x91 > +struct hal_ev_handsfree_wbs { > + uint8_t wbs; > + uint8_t bdaddr[6]; > +} __attribute__((packed)); > + > #define HAL_AVRCP_FEATURE_NONE 0x00 > #define HAL_AVRCP_FEATURE_METADATA 0x01 > #define HAL_AVRCP_FEATURE_ABSOLUTE_VOLUME 0x02 -- Szymon K. Janc szymon.janc@gmail.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] android/handsfree: Fix missing HFP WBS callback 2015-08-27 12:01 [PATCH 0/3] Fix missing HFP WBS callback Will Wang 2015-08-27 12:02 ` [PATCH 1/3] android/hal-ipc-api: " Will Wang 2015-08-27 12:02 ` [PATCH 2/3] android/hal-handsfree: " Will Wang @ 2015-08-27 12:02 ` Will Wang 2 siblings, 0 replies; 6+ messages in thread From: Will Wang @ 2015-08-27 12:02 UTC (permalink / raw) To: marcel, gustavo, johan.hedberg; +Cc: linux-bluetooth, Will Wang --- android/handsfree.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/android/handsfree.c b/android/handsfree.c index f297926..919728e 100644 --- a/android/handsfree.c +++ b/android/handsfree.c @@ -1067,6 +1067,7 @@ static void at_cmd_bcs(struct hfp_context *result, enum hfp_gw_cmd_type type, void *user_data) { struct hf_device *dev = user_data; + struct hal_ev_handsfree_wbs ev; unsigned int val; DBG(""); @@ -1085,6 +1086,13 @@ static void at_cmd_bcs(struct hfp_context *result, enum hfp_gw_cmd_type type, break; } + ev.wbs = val; + bdaddr2android(&dev->bdaddr, ev.bdaddr); + + ipc_send_notif(hal_ipc, HAL_SERVICE_ID_HANDSFREE, + HAL_EV_HANDSFREE_WBS, sizeof(ev), &ev); + + dev->proposed_codec = 0; dev->negotiated_codec = val; -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-08-27 19:47 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-08-27 12:01 [PATCH 0/3] Fix missing HFP WBS callback Will Wang 2015-08-27 12:02 ` [PATCH 1/3] android/hal-ipc-api: " Will Wang 2015-08-27 19:39 ` Szymon Janc 2015-08-27 12:02 ` [PATCH 2/3] android/hal-handsfree: " Will Wang 2015-08-27 19:47 ` Szymon Janc 2015-08-27 12:02 ` [PATCH 3/3] android/handsfree: " Will Wang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).