diff options
author | Dan Williams <dcbw@redhat.com> | 2012-09-10 16:46:32 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-09-10 16:57:05 -0500 |
commit | 67fd482597a1839c765da75b7f85eb675573f7b7 (patch) | |
tree | fec0b91a2a1dfaf3a5df54adedfd1f8b60786e2e | |
parent | 09b2ba64bd8cde263aca585848ea584a1f3d6338 (diff) | |
download | ModemManager-67fd482597a1839c765da75b7f85eb675573f7b7.tar.gz |
huawei,anydata: use common response stripping function
-rw-r--r-- | plugins/mm-modem-anydata-cdma.c | 18 | ||||
-rw-r--r-- | plugins/mm-modem-huawei-cdma.c | 16 |
2 files changed, 3 insertions, 31 deletions
diff --git a/plugins/mm-modem-anydata-cdma.c b/plugins/mm-modem-anydata-cdma.c index 479c00e11..bc27a5aca 100644 --- a/plugins/mm-modem-anydata-cdma.c +++ b/plugins/mm-modem-anydata-cdma.c @@ -63,20 +63,6 @@ mm_modem_anydata_cdma_new (const char *device, /*****************************************************************************/ -static const char * -strip_response (const char *resp, const char *cmd) -{ - const char *p = resp; - - if (p) { - if (!strncmp (p, cmd, strlen (cmd))) - p += strlen (cmd); - while (*p == ' ') - p++; - } - return p; -} - static void evdo_state_done (MMAtSerialPort *port, GString *response, @@ -100,7 +86,7 @@ evdo_state_done (MMAtSerialPort *port, return; } - reply = strip_response (response->str, "*HSTATE:"); + reply = mm_strip_tag (response->str, "*HSTATE:"); /* Format is "<at state>,<session state>,<channel>,<pn>,<EcIo>,<rssi>,..." */ r = g_regex_new ("\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*([^,\\)]*)\\s*,\\s*([^,\\)]*)\\s*,.*", @@ -175,7 +161,7 @@ state_done (MMAtSerialPort *port, return; } - reply = strip_response (response->str, "*STATE:"); + reply = mm_strip_tag (response->str, "*STATE:"); /* Format is "<channel>,<pn>,<sid>,<nid>,<state>,<rssi>,..." */ r = g_regex_new ("\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*([^,\\)]*)\\s*,.*", diff --git a/plugins/mm-modem-huawei-cdma.c b/plugins/mm-modem-huawei-cdma.c index d8aea4a27..1ec4f4c3f 100644 --- a/plugins/mm-modem-huawei-cdma.c +++ b/plugins/mm-modem-huawei-cdma.c @@ -120,20 +120,6 @@ handle_evdo_quality_change (MMAtSerialPort *port, /*****************************************************************************/ -static const char * -strip_response (const char *resp, const char *cmd) -{ - const char *p = resp; - - if (p) { - if (!strncmp (p, cmd, strlen (cmd))) - p += strlen (cmd); - while (*p == ' ') - p++; - } - return p; -} - static void sysinfo_done (MMAtSerialPort *port, GString *response, @@ -155,7 +141,7 @@ sysinfo_done (MMAtSerialPort *port, goto done; } - reply = strip_response (response->str, "^SYSINFO:"); + reply = mm_strip_tag (response->str, "^SYSINFO:"); /* Format is "<srv_status>,<srv_domain>,<roam_status>,<sys_mode>,<sim_state>" */ r = g_regex_new ("\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)", |