From 6077763d90b69cfc60b23f383c4529f966facaaf Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 28 Jun 2009 14:05:05 -0400 Subject: 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. --- src/mm-serial-parsers.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/mm-serial-parsers.c') 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) -- cgit v1.2.3-70-g09d2