Modem disconnect - serial breaks etc.

Aleksander Morgado aleksander at aleksander.es
Tue Jul 25 11:36:50 UTC 2017


>> Any chance you can put a log message in src/mm-port-
>> serial.c::flash_do(), something like:
>>
>>     GError *error = NULL;
>>
>> +   mm_log("Done flashing");
>>
>>    /* Recover context */
>>     g_assert (self->priv->flash_ctx != NULL);
>>
>> just so we can figure out how long the flash is actually taking, and
>> whether the message a short time later is due to the port re-open, or
>> some other part of the code.
>
> Looks like ATE0<CR> is attempting to be sent whilst the baud rate is set
> to 0.  Not sure what effect that'll have on the actual serial port.
> I'll try and pick it up with the Bus Pirate:
>
> <debug> [000100.352842] Flashing data port (ttyUSB0)...
> <debug> [000100.352985] (ttyUSB0): port attributes not fully set
> <debug> [000100.353004] (ttyUSB0): --> 'ATE0<CR>'
> <debug> [000101.353760] Done flashing
>
> On this serial port at least it seems that the ATE0<CR> does get sent
> (I'm seeing the bytes rxed on the serial port tap), but I'm not able to
> check the timing of that easily so I can't verify whether this actually
> ends up on the wire at 100 seconds in the above example or 101 seconds.
>

The ATE0 there is sent as part of the "init-sequence" configured in
the TTY. It happens here because we do a full port close and port
reopen with mm_port_serial_reopen(), and that will trigger the
init-sequence when the port gets opened for the first time  (port open
count 0->1). The problem here is that we send the init-sequence
*without* waiting for it to finish, so we queue the commands to run in
idle, but don't wait for the response; and by doing that we're going
into the next configured step right away, which is port flashing. That
is why you see that sequence of logs.

Now, that's obviously wrong :) We should be doing the port flashing
*before* any AT command is sent. Looks like the init-sequence logic is
really flawed if we're doing a port flash just after that. I'm
thinking we could make configurable the automatic "init-sequence" when
the port open count goes 0->1, and update the logic to do it manually
(mm_port_serial_at_run_init_sequence()) but after the port flashings
have finished. I'll suggest a patch for this.

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list