From a6faae32608833f3d26d57bc6bace4f2a9add8bd Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 19 Sep 2012 07:35:23 +0200 Subject: broadband-modem: skip +CGMM: prefix when loading device model Some devices, e.g. ZTE MF820D, seem to prefix the `AT+CGMM?' response with the `+CGMM:' string, resulting in the following model string being loaded: model: '+CGMM: "MF820D"' Avoid this by: 1) Removing the expected prefixes. 2) Unquoting the resulting string. Reported by: Marius Kotsbak --- src/mm-modem-helpers.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/mm-modem-helpers.c') diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 60d7459b..db0bfbdf 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -32,6 +32,23 @@ /*****************************************************************************/ +gchar * +mm_strip_quotes (gchar *str) +{ + gsize len; + + if (!str) + return NULL; + + len = strlen (str); + if ((len >= 2) && (str[0] == '"') && (str[len - 1] == '"')) { + str[0] = ' '; + str[len - 1] = ' '; + } + + return g_strstrip (str); +} + const gchar * mm_strip_tag (const gchar *str, const gchar *cmd) { -- cgit v1.2.3-70-g09d2