From f553afd2df413a9dd4e07165c193afa474e25f9d Mon Sep 17 00:00:00 2001 From: "Igor V. Kovalenko" Date: Fri, 5 Mar 2021 18:06:30 +0300 Subject: [PATCH] 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: --- src/modules/bluetooth/backend-native.c | 4 ++-- 1 file 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;