bluez: handle non-hexadecimal XAPL version strings

This commit is contained in:
Valentin Hăloiu 2022-01-29 21:13:45 +00:00
parent 115875dc5b
commit 483831e514
No known key found for this signature in database
GPG key ID: BBF680C8FC58A35D

View file

@ -705,7 +705,6 @@ static bool rfcomm_hfp_ag(struct rfcomm *rfcomm, char* buf)
unsigned int indicator_value;
int xapl_vendor;
int xapl_product;
int xapl_version;
int xapl_features;
if (sscanf(buf, "AT+BRSF=%u", &features) == 1) {
@ -889,7 +888,7 @@ static bool rfcomm_hfp_ag(struct rfcomm *rfcomm, char* buf)
rfcomm_send_reply(rfcomm, "OK");
} else if (sscanf(buf, "AT+BIEV=%u,%u", &indicator, &indicator_value) == 2) {
process_hfp_hf_indicator(rfcomm, indicator, indicator_value);
} else if (sscanf(buf, "AT+XAPL=%04x-%04x-%04x,%u", &xapl_vendor, &xapl_product, &xapl_version, &xapl_features) == 4) {
} else if (sscanf(buf, "AT+XAPL=%04x-%04x-%*[^,],%u", &xapl_vendor, &xapl_product, &xapl_features) == 3) {
if (xapl_features & SPA_BT_HFP_HF_XAPL_FEATURE_BATTERY_REPORTING) {
/* claim, that we support battery status reports */
rfcomm_send_reply(rfcomm, "+XAPL=iPhone,%u", SPA_BT_HFP_HF_XAPL_FEATURE_BATTERY_REPORTING);