aboutsummaryrefslogtreecommitdiff
path: root/src/mm-serial-parsers.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2009-06-28 14:05:05 -0400
committerDan Williams <dcbw@redhat.com>2009-06-28 14:05:05 -0400
commit6077763d90b69cfc60b23f383c4529f966facaaf (patch)
tree81ae20133a6ea116d58ddc2ee86644f4e1c9eb0a /src/mm-serial-parsers.c
parent112f2da19dbe8dcd8f32b998459298e7c1884c67 (diff)
asynchronous and deferred port detection
Allow plugins to perform asynchronous port detection, and to defer port detection until later. This moves the prober bits into MMPluginBase so that all plugins can take adavantage of it only when needed; the probing is not done at udev time. Furthermore, plugins like Novatel can flip the secondary ports over the AT mode through deferred detection, by deferring the secondary ports until the main port has been detected and AT$NWDMAT has been sent. This commit also finishes the port of the rest of the plugins (except mbm) over to the new port detection methods and plugin API.
Diffstat (limited to 'src/mm-serial-parsers.c')
-rw-r--r--src/mm-serial-parsers.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mm-serial-parsers.c b/src/mm-serial-parsers.c
index 8e6b75b8..ae0c20da 100644
--- a/src/mm-serial-parsers.c
+++ b/src/mm-serial-parsers.c
@@ -87,6 +87,9 @@ mm_serial_parser_v0_parse (gpointer data,
g_return_val_if_fail (parser != NULL, FALSE);
g_return_val_if_fail (response != NULL, FALSE);
+ if (G_UNLIKELY (!response->len || !strlen (response->str)))
+ return FALSE;
+
found = g_regex_match_full (parser->generic_response, response->str, response->len, 0, 0, &match_info, NULL);
if (found) {
str = g_match_info_fetch (match_info, 1);
@@ -205,7 +208,10 @@ mm_serial_parser_v1_parse (gpointer data,
g_return_val_if_fail (parser != NULL, FALSE);
g_return_val_if_fail (response != NULL, FALSE);
- /* First, check for successfule responses */
+ if (G_UNLIKELY (!response->len || !strlen (response->str)))
+ return FALSE;
+
+ /* First, check for successful responses */
found = g_regex_match_full (parser->regex_ok, response->str, response->len, 0, 0, NULL, NULL);
if (found)