From a7b8cbb71d1447a5cc870aefed99ccc6b3325cd3 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 29 Mar 2013 12:33:20 +0100 Subject: port-probe: don't reschedule next probing step when serial port buffer full When the serial port buffer gets full of non-AT garbage during port probing, we were re-scheduling the next probing step, which is completely wrong, as we then would be processing the same probing task twice. If we get a buffer full, just cancel the AT probing cancellable, which would cancel not only the possible AT probings, but also the custom init if there is any. Also, make sure that the custom_init() of the plugins out there don't return an error if the GCancellable is cancelled. Cancelling the GCancellable means we should just stop the custom_init(), and actually sending an error in custom_init() means that the port should be set as unsupported by the plugin, so completely different things. Should fix https://bugzilla.gnome.org/show_bug.cgi?id=696695 --- src/mm-port-probe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mm-port-probe.c b/src/mm-port-probe.c index 77349250..788c1045 100644 --- a/src/mm-port-probe.c +++ b/src/mm-port-probe.c @@ -940,10 +940,16 @@ serial_buffer_full (MMSerialPort *serial, GByteArray *buffer, MMPortProbe *self) { + PortProbeRunTask *task = self->priv->task; + if (is_non_at_response (buffer->data, buffer->len)) { - mm_serial_port_close (serial); + mm_dbg ("(%s/%s) serial buffer full", + g_udev_device_get_subsystem (self->priv->port), + g_udev_device_get_name (self->priv->port)); + /* Don't explicitly close the AT port, just end the AT probing + * (or custom init probing) */ mm_port_probe_set_result_at (self, FALSE); - serial_probe_schedule (self); + g_cancellable_cancel (task->at_probing_cancellable); } } -- cgit v1.2.3-70-g09d2