mbm plugin gps improvements
Tomas Jura
tomas.jura1 at gmail.com
Fri Jan 29 10:16:19 PST 2016
On 29.1.2016 16:25, Dan Williams wrote:
> The #6 - "Do not restore termios on port close" is a controversial
> patch. It has the wide impact and definitely can introduce nasty
> regressions. It is possible that some code could depend on the
> restore
> of the term setup. But such dependency is IMHO danger itself. In
> other
> words I a piece of code needs a port setup should do it itself and
> not
> blindly rely that the port setup that was somewhat preserved between
> port openings.
> Yes, code that uses the serial port should set the serial port up
> correctly by itself. And if the other code does that, then it
> shouldn't matter whether the termios are left modified or reset back to
> previous values. Was the termios restore causing problems somewhere?
Yes, the restore of termios was a problem. Suppose the following scenario:
1. Initial conditions: tty termios echo on, modem echo on,
2. modem manager startup, mm opens port and sets itself termios echo to off
3. A request for unmanaged gps port. MM starts the gps nmea message
stream, closes the port and restore the tty termios echo.
4. Now starts the never ending message ping-pong. Modem emmits nmea
sentence, computer echos the sentence back and modem echos the sentence
back ....
The overall port output is then not readable by any nmea parser - it is
a strange mix of the nmea messages.
The bug occurrence looked as random, it depends on initial tty and modem
echo mode. I was not able to replicate the error safely for the long
time. It happens only for the unmanaged gps mode. The raw and nmea modes
use the good internal MM port setup.
Even if the consumer immediately setup tty to noecho, sometimes a gps
message is emitted before the termios is applied. The final solution is
to leave the tty gps port in a "ready to read" state - do not restore
termios. I think that such setup should be a part of the unmanaged gps
port preparation. Later I remembered to the old ATE0 command, and for
all cases I disabled the echo on the modem side too.
> Thanks for the patches, some good cleanups!
>
> Dan
>
>
More information about the ModemManager-devel
mailing list