[PATCH] telit: don't ignore AT ports without an explicit port type hint tag

Dan Williams dcbw at redhat.com
Mon Mar 13 16:35:50 UTC 2017


On Sat, 2017-03-11 at 13:29 +0100, Aleksander Morgado wrote:
> The telit plugin is based on two main ways of checking the purpose of
> each port: udev tags flagging specific interfaces (with info taken
> from Windows .inf drivers), or otherwise using AT#PORTCFG? to query
> the modem about that information. If none of those applies, the port
> is ignored by default.
> 
> In order to support devices that are not explicitly tagged, the
> plugin
> shouldn't flag as ignored the AT-capable TTYs, instead they are now
> grabbed as 'secondary': ports grabbed as secondary will never be used
> for either primary/data IF there is another port flagged explicitly
> for primary/data.
> 
> This fixes the support for modems with a single TTY and no explicit
> port type hint tag, e.g. RS232 modems with just one single TTY where
> there's no point in specifying port type hints: the port will be
> grabbed as secondary, and then automatically promoted to primary/data
> as there is no other port grabbed.
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=100159
> ---
> 
> Hey Dan, Daniele, Carlo and everyone,
> 
> This patch makes it possible for the Telit plugin to support Telit
> modems that only expose a single TTY, without needing to manually add
> any port type hint.
> 
> What do you think?

Also makes sense to me.

Dan

> ---
>  plugins/telit/mm-common-telit.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/plugins/telit/mm-common-telit.c b/plugins/telit/mm-
> common-telit.c
> index 78530c42..3f2cce5c 100644
> --- a/plugins/telit/mm-common-telit.c
> +++ b/plugins/telit/mm-common-telit.c
> @@ -84,11 +84,22 @@ telit_grab_port (MMPlugin *self,
>          } else
>              ptype = MM_PORT_TYPE_IGNORED;
>      } else {
> -        /* If the port was tagged by the udev rules but isn't a
> primary or secondary,
> -         * then ignore it to guard against race conditions if a
> device just happens
> -         * to show up with more than two AT-capable ports.
> +        /* If the port isn't explicitly tagged as primary,
> secondary, or gps
> +         * port, we will fallback to flagging it as secondary, but
> only if it
> +         * probed AT successfully.
> +         *
> +         * This is so that we support the case where a single TTY is
> exposed
> +         * by the modem and no explicit port type hint is specified.
> +         *
> +         * From the modem point of view, only the AT_FLAG_PRIMARY
> would be
> +         * important, as that is the port that would end up getting
> used for PPP
> +         * in this case, so having multiple secondary ports, if that
> ever
> +         * happened, wouldn't be an issue.
>           */
> -        ptype = MM_PORT_TYPE_IGNORED;
> +        if (mm_port_probe_is_at (probe))
> +            pflags = MM_PORT_SERIAL_AT_FLAG_SECONDARY;
> +        else
> +            ptype = MM_PORT_TYPE_IGNORED;
>      }
> 
>      return mm_base_modem_grab_port (modem,
> --
> 2.12.0


More information about the ModemManager-devel mailing list