mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-30 11:10:29 -04:00
bluez5: backend-native: fix parsing +CLCC response with optional number
The format is: <idx>,<dir>,<status>,<mode>,<mpty>[,<number>,<type>] so the response can be considered parsed when mpty is read.
This commit is contained in:
parent
fb7c37aeb4
commit
491fb26f18
1 changed files with 3 additions and 1 deletions
|
|
@ -2149,6 +2149,8 @@ static bool rfcomm_hfp_hf(struct rfcomm *rfcomm, char* token)
|
||||||
unsigned int status, mpty;
|
unsigned int status, mpty;
|
||||||
bool parsed = false, found = false;
|
bool parsed = false, found = false;
|
||||||
|
|
||||||
|
number[0] = '\0';
|
||||||
|
|
||||||
token[strcspn(token, "\r")] = 0;
|
token[strcspn(token, "\r")] = 0;
|
||||||
token[strcspn(token, "\n")] = 0;
|
token[strcspn(token, "\n")] = 0;
|
||||||
token_end = token + strlen(token);
|
token_end = token + strlen(token);
|
||||||
|
|
@ -2181,13 +2183,13 @@ static bool rfcomm_hfp_hf(struct rfcomm *rfcomm, char* token)
|
||||||
token[pos] = '\0';
|
token[pos] = '\0';
|
||||||
mpty = atoi(token);
|
mpty = atoi(token);
|
||||||
token += pos + 1;
|
token += pos + 1;
|
||||||
|
parsed = true;
|
||||||
}
|
}
|
||||||
if (token < token_end) {
|
if (token < token_end) {
|
||||||
if (sscanf(token, "\"%16[^\"]\",%u", number, &type) != 2) {
|
if (sscanf(token, "\"%16[^\"]\",%u", number, &type) != 2) {
|
||||||
spa_log_warn(backend->log, "Failed to parse number: %s", token);
|
spa_log_warn(backend->log, "Failed to parse number: %s", token);
|
||||||
number[0] = '\0';
|
number[0] = '\0';
|
||||||
}
|
}
|
||||||
parsed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SPA_LIKELY (parsed)) {
|
if (SPA_LIKELY (parsed)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue