diff options
author | Igor V. Kovalenko <igor.v.kovalenko@gmail.com> | 2021-03-05 18:06:30 +0300 |
---|---|---|
committer | Marijn Suijten <marijns95@gmail.com> | 2021-03-16 10:48:59 +0100 |
commit | f553afd2df413a9dd4e07165c193afa474e25f9d (patch) | |
tree | 9854d17b0fb5c638718a2e365fd5cbf342dab063 | |
parent | d510ddc7fbbce22d27a3f0dc7f47712059432c71 (diff) |
bluetooth: accept +VGM/+VGS unsolicited reply with '=' and ':' separator
HFP specs states both '=' and ':' should be accepted as a valid
separator for +VGM and +VGS unsolicited result codes.
This change is cherry-picked from Rodrigo Araujo's work here:
https://lists.freedesktop.org/archives/pulseaudio-discuss/2017-September/028820.html
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>
-rw-r--r-- | src/modules/bluetooth/backend-native.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c index b47c36ba3..90116bbd4 100644 --- a/src/modules/bluetooth/backend-native.c +++ b/src/modules/bluetooth/backend-native.c @@ -560,7 +560,7 @@ static void rfcomm_io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_i * AT+CKPD=200: Sent by HS when headset button is pressed. * RING: Sent by AG to HS to notify of an incoming call. It can safely be ignored because * it does not expect a reply. */ - if (sscanf(buf, "AT+VGS=%d", &gain) == 1 || sscanf(buf, "\r\n+VGM=%d\r\n", &gain) == 1) { + if (sscanf(buf, "AT+VGS=%d", &gain) == 1 || sscanf(buf, "\r\n+VGM%*[=:]%d\r\n", &gain) == 1) { if (!t->set_sink_volume) { pa_log_debug("HS/HF peer supports speaker gain control"); t->set_sink_volume = set_sink_volume; @@ -570,7 +570,7 @@ static void rfcomm_io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_i pa_hook_fire(pa_bluetooth_discovery_hook(t->device->discovery, PA_BLUETOOTH_HOOK_TRANSPORT_SINK_VOLUME_CHANGED), t); do_reply = true; - } else if (sscanf(buf, "AT+VGM=%d", &gain) == 1 || sscanf(buf, "\r\n+VGS=%d\r\n", &gain) == 1) { + } else if (sscanf(buf, "AT+VGM=%d", &gain) == 1 || sscanf(buf, "\r\n+VGS%*[=:]%d\r\n", &gain) == 1) { if (!t->set_source_volume) { pa_log_debug("HS/HF peer supports microphone gain control"); t->set_source_volume = set_source_volume; |