From 29853d26a92963e60b98e347b41a7583395f9d1e Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 11 Dec 2014 22:00:53 +0100 Subject: [PATCH] port-probe: early flag as not being AT when response is filtered during probing As soon as the parser detects that a response is not AT (using the filter provided by the probe object), we'll flag the probe as not being AT. Then, we'll detect that condition before even calling the response processor callbacks, so that the callbacks don't have the chance to ignore the error. This additional logic should also be applicable when the port is flagged as not being AT by the buffer-full signal. https://bugs.freedesktop.org/show_bug.cgi?id=85098 --- src/mm-port-probe.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mm-port-probe.c b/src/mm-port-probe.c index 18adb38..9b42611 100644 --- a/src/mm-port-probe.c +++ b/src/mm-port-probe.c @@ -886,6 +886,18 @@ serial_probe_at_parse_response (MMPortSerialAt *port, goto out; } + /* Early flag as not being AT; even before calling the response processor, + * as we don't want the processor to just ignore the issue. This is not an + * AT port, and we can safely halt this partial AT probing here. */ + if ((self->priv->flags & MM_PORT_PROBE_AT) && !self->priv->is_at) { + mm_dbg ("(%s/%s) early flag as not being AT...", + g_udev_device_get_subsystem (self->priv->port), + g_udev_device_get_name (self->priv->port)); + task->at_result_processor (self, NULL); + serial_probe_schedule (self); + goto out; + } + if (!task->at_commands->response_processor (task->at_commands->command, response, !!task->at_commands[1].command, @@ -1146,6 +1158,9 @@ serial_parser_filter_cb (gpointer filter, MM_SERIAL_ERROR, MM_SERIAL_ERROR_PARSE_FAILED, "Not an AT response"); + /* Flag as not being an AT port directly in the filter callback, so that + * we skip any further AT command. */ + mm_port_probe_set_result_at (MM_PORT_PROBE (user_data), FALSE); return FALSE; } @@ -1196,7 +1211,7 @@ serial_open_at (MMPortProbe *self) parser = mm_serial_parser_v1_new (); mm_serial_parser_v1_add_filter (parser, serial_parser_filter_cb, - NULL); + self); mm_port_serial_at_set_response_parser (MM_PORT_SERIAL_AT (task->serial), mm_serial_parser_v1_parse, parser, -- 2.1.3