diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2018-07-27 11:43:48 +0200 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2018-08-10 04:19:13 +0000 |
commit | 548b7f88473827954a389d96dac298fa6b6453a6 (patch) | |
tree | e0958961a754c27c72db8294addf502d7ab8b560 /src | |
parent | aff633b1b002ecfecc51d589d580e963c931cb6d (diff) |
base-modem: load AT port type hints when adding port
We keep the pflags input in mm_base_modem_grab_port() so that plugins
can use other methods to gather port type hints (e.g. querying with AT
commands as in Huawei/Telit or looking at sysfs properties as in HSO).
For standard udev tag port type hints, it will be the base modem
looking them up.
Note that there is no longer any need to ignore non-flagged ports for
those modems that require primary/secondary flags. They will be
implicitly ignored when mm_base_modem_organize_ports() decides which
ports to use, as the flagged ones are preferred over the non-flagged
ones.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-base-modem.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c index bf49c37b..2fa39b32 100644 --- a/src/mm-base-modem.c +++ b/src/mm-base-modem.c @@ -211,7 +211,19 @@ mm_base_modem_grab_port (MMBaseModem *self, mm_serial_parser_v1_parse, mm_serial_parser_v1_new (), mm_serial_parser_v1_destroy); - /* Store flags already */ + /* Prefer plugin-provided flags to the generic ones */ + if (at_pflags == MM_PORT_SERIAL_AT_FLAG_NONE) { + if (mm_kernel_device_get_property_as_boolean (kernel_device, "ID_MM_PORT_TYPE_AT_PRIMARY")) { + mm_dbg ("AT port '%s/%s' flagged as primary", subsys, name); + at_pflags = MM_PORT_SERIAL_AT_FLAG_PRIMARY; + } else if (mm_kernel_device_get_property_as_boolean (kernel_device, "ID_MM_PORT_TYPE_AT_SECONDARY")) { + mm_dbg ("AT port '%s/%s' flagged as secondary", subsys, name); + at_pflags = MM_PORT_SERIAL_AT_FLAG_SECONDARY; + } else if (mm_kernel_device_get_property_as_boolean (kernel_device, "ID_MM_PORT_TYPE_AT_PPP")) { + mm_dbg ("AT port '%s/%s' flagged as PPP", subsys, name); + at_pflags = MM_PORT_SERIAL_AT_FLAG_PPP; + } + } mm_port_serial_at_set_flags (MM_PORT_SERIAL_AT (port), at_pflags); } else if (ptype == MM_PORT_TYPE_GPS) { /* Raw GPS port */ |