Modem disconnect - serial breaks etc.

Dan Williams dcbw at redhat.com
Mon Jul 24 17:24:20 UTC 2017


On Mon, 2017-07-24 at 18:09 +0100, Tim Small wrote:
> I'm seeing an issue where the ppp connection exits, but the modem
> seems
> to be left in connected state (I can verify that by sending mm
> SIGSTOP,
> then opening a serial terminal window - I'm able to then manually
> hangup
> the modem using the +++ escape sequence).

Interesting.

> Although it doesn't say so explicitly, I think "Flashing data port"
> is
> intended to reset the modem.

Yes, that's the intent.  Kernel serial drivers are supposed to
interpret the baud rate of 0 and then drop DTR+RTS, which if the modem
is configured correctly should then break out of data mode and
disconnect the call.  But you're right, it looks like that's not
happening long enough in MM.  Wikipedia says "2 seconds", though most
usage in ModemManager seems to be 1 second.

> Looking at this code it attempt to set the serial baud rate to zero
> for
> 1 second (i.e. what is commonly known as a serial "break" I believe).
> However this isn't working correctly since the debug output shows the
> next command being executed in less than a second:
> 
> <debug> [006603.496836] Flashing data port (ttyUSB0)...
> <debug> [006603.498142] (ttyUSB0): port attributes not fully set
> <debug> [006603.498209] (ttyUSB0): --> 'ATE0<CR>'

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.

Dan

> 
> I've also confirmed this by taping the serial transmit line from the
> host to the modem into the serial RX line of a "Bus Pirate" - this
> shows
> that a serial break is sent (it report a UART framing error) when I
> use
> the serial break function of "GNU screen" (ctrl-a followed by ctrl-
> b),
> but not with modem manager.
> 
> If I alter the mm-port-serial to run tcsendbreak() on the serial line
> fd, then the bus pirate does show a serial break on the line - so
> assuming a break is the intended behaviour here, I think the code
> should
> be altered to use tcsendbreak instead of setting the baud rate to 0.
> 
> 
> However... this won't help much with Telit modems since, they don't
> respond to serial breaks by going back into command mode, but
> probably
> will with other modems which do respond to this I suppose.
> 
> 
> 
> 445.026597] loading access technology (Telit)...
> 445.026619] Couldn't refresh access technologies: 'No AT port
> available
> to run command'
> 445.026631] Periodic signal quality checks scheduled in 30s
> 461.016638] Disconnecting bearer
> '/org/freedesktop/ModemManager1/Bearer/0'
> 461.016710] Modem /org/freedesktop/ModemManager1/Modem/0: state
> changed
> (connected -> disconnecting)
> 461.016866] Reopening data port (ttyUSB0)...
> 461.016886] (ttyUSB0) reopening port (2)
> 461.016897] (ttyUSB0) device open count is 1 (close)
> 461.016906] (ttyUSB0) device open count is 0 (close)
> 461.016916] (ttyUSB0) closing serial port...
> 461.016927] (ttyUSB0): port now disconnected
> 461.016944] (ttyUSB0) serial port closed
> 462.017906] (ttyUSB0) opening serial port...
> 462.018649] (ttyUSB0): couldn't set serial port closing_wait to none:
> Inappropriate ioctl for device
> 462.018674] (ttyUSB0): setting up baudrate: 115200
> 462.018797] (ttyUSB0) device open count is 1 (open)
> 462.018812] (ttyUSB0): running init sequence...
> 462.018833] (ttyUSB0) device open count is 2 (open)
> 462.018851] Flashing data port (ttyUSB0)...
> 462.019024] (ttyUSB0): port attributes not fully set
> 462.019049] (ttyUSB0): --> 'ATE0<CR>'
> 463.020724] (ttyUSB0) device open count is 1 (close)
> 463.020889] Sending PDP context deactivation in primary/data port...
> 463.020938] (ttyUSB0) device open count is 2 (open)
> 465.021902] (ttyUSB0): --> 'ATV1<CR>'
> 468.025315] (ttyUSB0): --> 'AT+CMEE=1<CR>'
> 471.024933] (ttyUSB0): --> 'ATX4<CR>'
> 474.025394] (ttyUSB0): --> 'AT&C1<CR>'
> 475.025866] loading signal quality...
> 475.026092] (ttyUSB0) device open count is 3 (open)
> 477.023131] (ttyUSB0): --> 'AT+CGACT=0,1<CR>'
> 487.029913] PDP context deactivation failed (not fatal): Serial
> command
> timed out
> 
> 
> 


More information about the ModemManager-devel mailing list