diff options
author | Sonny Sasaka <sonnysasaka@chromium.org> | 2021-02-08 14:25:15 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-26 13:41:16 +0000 |
commit | 48bd923532c5713b5bcce4f3add4917d5c1a8176 (patch) | |
tree | fb2bf09d3ce5a014a8e3d33c144d4f702a90ddba | |
parent | d8a4e5d26c4de095f449de51cd6dab7855d532f8 (diff) | |
download | adhd-48bd923532c5713b5bcce4f3add4917d5c1a8176.tar.gz |
cras: Reply AT+CHLD=? with empty list
Some Bluetooth speakers are known to disconnect if AT+CHLD=? is replied
with "ERROR". This patch changes our behavior to reply with empty list
of features and "OK" to make us interoperable with such speakers.
BUG=b:172413440
TEST=Tested with Udison portable speaker, check that speaker does not
disconnect right after being connected.
Change-Id: I77f75fdf1e978618f53caef16f2fe0a09eb1d115
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2682986
Tested-by: Sonny Sasaka <sonnysasaka@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
-rw-r--r-- | cras/src/server/cras_hfp_slc.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cras/src/server/cras_hfp_slc.c b/cras/src/server/cras_hfp_slc.c index 65e5e652..d3f9e5fb 100644 --- a/cras/src/server/cras_hfp_slc.c +++ b/cras/src/server/cras_hfp_slc.c @@ -607,6 +607,26 @@ static int operator_selection(struct hfp_slc_handle *handle, const char *buf) return hfp_send(handle, AT_CMD("OK")); } +/* The AT+CHLD command is used to control call hold, release, and multiparty + * states. + */ +static int call_hold(struct hfp_slc_handle *handle, const char *buf) +{ + int rc; + + // Chrome OS doesn't yet support CHLD features but we need to reply + // the query with an empty feature list rather than "ERROR" to increase + // interoperability with certain devices (b/172413440). + if (strlen(buf) > 8 && buf[7] == '=' && buf[8] == '?') { + rc = hfp_send(handle, AT_CMD("+CHLD:")); + if (rc) + return rc; + return hfp_send(handle, AT_CMD("OK")); + } + + return hfp_send(handle, AT_CMD("ERROR")); +} + /* AT+CIND command retrieves the supported indicator and its corresponding * range and order index or read current status of indicators. Mandatory * support per spec 4.2. @@ -1062,6 +1082,7 @@ static struct at_command at_commands[] = { { "AT+VTS", dtmf_tone }, { "AT+XAPL", apple_supported_features }, { "AT+XEVENT", vendor_specific_features }, + { "AT+CHLD", call_hold }, { 0 } }; |