simtech: handle non-standard '+CRING' URCs

The SIM7600E ends up emitting these URCs with too many <CR>s, and the
generic +CRING handler doesn't catch them, interfering with other
actions, e.g.:

  $ sudo mmcli --call 1 --accept
  error: couldn't accept the call: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Couldn't accept the call: Unhandled response '+CRING: VOICE

  +CRING: VOICE''
This commit is contained in:
Aleksander Morgado
2019-10-15 10:40:11 +02:00
parent 395b22178c
commit 345922caa1
4 changed files with 92 additions and 0 deletions

View File

@@ -53,11 +53,13 @@ typedef struct {
FeatureSupport clcc_urc_support;
GRegex *clcc_urc_regex;
GRegex *voice_call_regex;
GRegex *cring_regex;
} Private;
static void
private_free (Private *ctx)
{
g_regex_unref (ctx->cring_regex);
g_regex_unref (ctx->voice_call_regex);
g_regex_unref (ctx->clcc_urc_regex);
g_slice_free (Private, ctx);
@@ -80,6 +82,7 @@ get_private (MMSharedSimtech *self)
priv->clcc_urc_support = FEATURE_SUPPORT_UNKNOWN;
priv->clcc_urc_regex = mm_simtech_get_clcc_urc_regex ();
priv->voice_call_regex = mm_simtech_get_voice_call_urc_regex ();
priv->cring_regex = mm_simtech_get_cring_urc_regex ();
/* Setup parent class' MMIfaceModemLocation and MMIfaceModemVoice */
@@ -829,6 +832,27 @@ voice_call_urc_received (MMPortSerialAt *port,
mm_dbg ("voice call finished");
}
static void
cring_urc_received (MMPortSerialAt *port,
GMatchInfo *info,
MMSharedSimtech *self)
{
MMCallInfo call_info;
gchar *str;
/* We could have "VOICE" or "DATA". Now consider only "VOICE" */
str = mm_get_string_unquoted_from_match_info (info, 1);
mm_dbg ("Ringing (%s)", str);
g_free (str);
call_info.index = 0;
call_info.direction = MM_CALL_DIRECTION_INCOMING;
call_info.state = MM_CALL_STATE_RINGING_IN;
call_info.number = NULL;
mm_iface_modem_voice_report_call (MM_IFACE_MODEM_VOICE (self), &call_info);
}
static void
common_voice_setup_cleanup_unsolicited_events (MMSharedSimtech *self,
gboolean enable)
@@ -858,6 +882,12 @@ common_voice_setup_cleanup_unsolicited_events (MMSharedSimtech *self,
enable ? (MMPortSerialAtUnsolicitedMsgFn)voice_call_urc_received : NULL,
enable ? self : NULL,
NULL);
mm_port_serial_at_add_unsolicited_msg_handler (ports[i],
priv->cring_regex,
enable ? (MMPortSerialAtUnsolicitedMsgFn)cring_urc_received : NULL,
enable ? self : NULL,
NULL);
}
}