spa: bluez: modemmanager: Add support for memory dialing for PTS tests

This add a new property to to allow to fake memory dialing for PTS tests
HFP/AG/OCM/BV-01-C and HFP/AG/OCM/BV-02-C.
This commit is contained in:
Frédéric Danis 2025-11-18 15:06:50 +01:00 committed by Wim Taymans
parent 04cf29f7cd
commit 9a48bbaa36
2 changed files with 17 additions and 1 deletions

View file

@ -1138,6 +1138,9 @@ HFP/HSP backend (default: native). Available values: any, none, hsphfpd, ofono,
@PAR@ monitor-prop bluez5.hfphsp-backend-native-modem # string @PAR@ monitor-prop bluez5.hfphsp-backend-native-modem # string
@PAR@ monitor-prop bluez5.hfphsp-backend-native-pts # boolean
Enable specific workarounds for Bluetooth qualification.
@PAR@ monitor-prop bluez5.disable-dummy-call # boolean @PAR@ monitor-prop bluez5.disable-dummy-call # boolean
By default a call status event is sent on audio stream connection/disconnection to By default a call status event is sent on audio stream connection/disconnection to
workaround some headset timeout disconnection when the HFP HF is used by another workaround some headset timeout disconnection when the HFP HF is used by another

View file

@ -36,6 +36,8 @@ struct impl {
struct modem modem; struct modem modem;
struct spa_list call_list; struct spa_list call_list;
bool pts;
}; };
struct dbus_cmd_data { struct dbus_cmd_data {
@ -944,8 +946,13 @@ bool mm_do_call(void *modemmanager, const char* number, void *user_data, enum cm
spa_autofree struct dbus_cmd_data *data = NULL; spa_autofree struct dbus_cmd_data *data = NULL;
spa_autoptr(DBusMessage) m = NULL; spa_autoptr(DBusMessage) m = NULL;
DBusMessageIter iter, dict; DBusMessageIter iter, dict;
size_t i = 0;
for (size_t i = 0; number[i]; i++) { /* Allow memory dial for PTS tests HFP/AG/OCM/BV-01-C and HFP/AG/OCM/BV-02-C */
if (this->pts && number[0] == '>')
i++;
for (; number[i]; i++) {
if (!is_valid_dial_string_char(number[i])) { if (!is_valid_dial_string_char(number[i])) {
spa_log_warn(this->log, "Call creation canceled, invalid character found in dial string: %c", number[i]); spa_log_warn(this->log, "Call creation canceled, invalid character found in dial string: %c", number[i]);
if (error) if (error)
@ -1078,6 +1085,8 @@ void *mm_register(struct spa_log *log, void *dbus_connection, const struct spa_d
{ {
const char *modem_device_str = NULL; const char *modem_device_str = NULL;
bool modem_device_found = false; bool modem_device_found = false;
const char *pts_str = NULL;
bool pts = false;
spa_assert(log); spa_assert(log);
spa_assert(dbus_connection); spa_assert(dbus_connection);
@ -1087,6 +1096,9 @@ void *mm_register(struct spa_log *log, void *dbus_connection, const struct spa_d
if (!spa_streq(modem_device_str, "none")) if (!spa_streq(modem_device_str, "none"))
modem_device_found = true; modem_device_found = true;
} }
if ((pts_str = spa_dict_lookup(info, "bluez5.hfphsp-backend-native-pts")) != NULL) {
pts = spa_atob(pts_str);
}
} }
if (!modem_device_found) { if (!modem_device_found) {
spa_log_info(log, "No modem allowed, doesn't link to ModemManager"); spa_log_info(log, "No modem allowed, doesn't link to ModemManager");
@ -1104,6 +1116,7 @@ void *mm_register(struct spa_log *log, void *dbus_connection, const struct spa_d
if (modem_device_str && !spa_streq(modem_device_str, "any")) if (modem_device_str && !spa_streq(modem_device_str, "any"))
this->allowed_modem_device = strdup(modem_device_str); this->allowed_modem_device = strdup(modem_device_str);
spa_list_init(&this->call_list); spa_list_init(&this->call_list);
this->pts = pts;
if (add_filters(this) < 0) if (add_filters(this) < 0)
return NULL; return NULL;