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 <marius.kotsbak@gmail.com>
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user