mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -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;
|
||||
bool parsed = false, found = false;
|
||||
|
||||
number[0] = '\0';
|
||||
|
||||
token[strcspn(token, "\r")] = 0;
|
||||
token[strcspn(token, "\n")] = 0;
|
||||
token_end = token + strlen(token);
|
||||
|
|
@ -2181,13 +2183,13 @@ static bool rfcomm_hfp_hf(struct rfcomm *rfcomm, char* token)
|
|||
token[pos] = '\0';
|
||||
mpty = atoi(token);
|
||||
token += pos + 1;
|
||||
parsed = true;
|
||||
}
|
||||
if (token < token_end) {
|
||||
if (sscanf(token, "\"%16[^\"]\",%u", number, &type) != 2) {
|
||||
spa_log_warn(backend->log, "Failed to parse number: %s", token);
|
||||
number[0] = '\0';
|
||||
}
|
||||
parsed = true;
|
||||
}
|
||||
|
||||
if (SPA_LIKELY (parsed)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue