Commit Graph

40 Commits

Author SHA1 Message Date
Aleksander Morgado
5d176a1e61 base-modem: explicitly say if NET or TTY data ports are supported
A modem that creates exclusively bearer objects that work with NET
ports (e.g. all QMI or MBIM modems) must not add any TTY port in the
list of data ports.

A modem that creates exclusively bearer objects that work with TTY
ports (e.g. the generic modem) must not add any NET port in the
list of data ports.

A modem that may use both TTY and NET ports should add all in the list
of data ports.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/324
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/329
2021-03-04 18:03:28 +01:00
Aleksander Morgado
9dbc346f93 simtech: port to use object logging 2020-04-08 16:35:10 +02:00
Aleksander Morgado
0f708daf0b modem-helpers: port supported modes filtering to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado
f66f7458b7 simtech: fix warnings with -Wimplicit-fallthrough
simtech/mm-broadband-modem-simtech.c: In function ‘enable_unsolicited_events_context_step’:
  simtech/mm-broadband-modem-simtech.c:442:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    442 |         ctx->step++;
        |         ~~~~~~~~~^~
  simtech/mm-broadband-modem-simtech.c:444:5: note: here
    444 |     case ENABLE_UNSOLICITED_EVENTS_STEP_LAST:
        |     ^~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
f6a103ef13 simtech: fix warnings with -Wswitch-default
simtech/mm-broadband-modem-simtech.c: In function ‘enable_unsolicited_events_context_step’:
  simtech/mm-broadband-modem-simtech.c:378:5: error: switch missing default case [-Werror=switch-default]
    378 |     switch (ctx->step) {
        |     ^~~~~~
  simtech/mm-broadband-modem-simtech.c: In function ‘disable_unsolicited_events_context_step’:
  simtech/mm-broadband-modem-simtech.c:563:5: error: switch missing default case [-Werror=switch-default]
    563 |     switch (ctx->step) {
        |     ^~~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
7873ef00e9 simtech: fix warnings with -Wsign-compare
simtech/mm-broadband-modem-simtech.c: In function ‘simtech_act_to_mm_act’:
  simtech/mm-broadband-modem-simtech.c:89:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
     89 |     return (nsmod < G_N_ELEMENTS (simtech_act_to_mm_act_map) ? simtech_act_to_mm_act_map[nsmod] : MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
        |                   ^
2020-01-31 15:18:35 +01:00
Aleksander Morgado
bbeabb495e helpers: new macro to CLAMP high threshold only
Useful when clamping a unsigned integer with low threshold set to 0,
which would give us compiler warnings with -Wtype-limits when using
CLAMP(), e.g.:

  via/mm-broadband-modem-via.c: In function ‘handle_evdo_quality_change’:
  /usr/include/glib-2.0/glib/gmacros.h:811:63: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
    811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
        |                                                               ^
  via/mm-broadband-modem-via.c:284:19: note: in expansion of macro ‘CLAMP’
    284 |         quality = CLAMP (quality, 0, 100);
        |                   ^~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado
eb66e8ae68 simtech: setup USB audio channel when in-call
We'll use +CPCMREG=1/0 to start/stop USB audio function, and we will
also report the specific ttyUSB port to be used for audio in the Call
interface.
2019-10-16 17:50:16 +02:00
Aleksander Morgado
89c9566ede simtech: implement +CLCC URC based call list management 2019-10-14 15:32:20 +02:00
Aleksander Morgado
6cbeb96aa0 simtech: +CNSMOD value may have multiple digits
We don't expect them in the set of values we support, but they may
happen according to the spec.
2019-10-11 09:24:22 +00:00
Aleksander Morgado
e1d18afe39 simtech: add support for reporting LTE 2019-10-11 09:24:22 +00:00
Aleksander Morgado
61f3c3c8c4 simtech: rework access tech value mapping 2019-10-11 09:24:22 +00:00
Aleksander Morgado
7fcefc7af0 simtech: rework enabling/disabling unsolicited events
We will explicitly query for +AUTOCSQ and +CNSMOD support before
trying to enable them.

If +AUTOCSQ is supported and correctly enabled, we'll request signal
quality polling to be disabled.

If +CNSMOD is supported and correctly enabled, we'll request access
technology polling to be disabled.
2019-10-11 09:24:22 +00:00
Aleksander Morgado
c820e02ff8 simtech: enable +CSQ URC support
The +AUTOCSQ setup enables automatic signal quality reporting via +CSQ
URCs, which unfortunately have the same format as the +CSQ command
responses.

Therefore, we need to subclass load_signal_quality() explicitly in
order to ignore those cases where the response to the +CSQ command is
received empty (already processed as a URC).
2019-10-11 09:24:22 +00:00
Aleksander Morgado
1f6f9eec4d simtech: keep access tech URC regex in private struct 2019-10-11 09:24:22 +00:00
Aleksander Morgado
c98a1a9dc8 simtech: disable CMER/CIND support explicitly
The logic to setup the generic +CIND indications in the SIM7600E seems
to end up breaking connectivity when in TTY+PPP mode. If we issue the
AT+CMER=3,0,0,1 command, this will end up in the modem not replying a
correct CONNECT response to the ATD command.

Let's disable these +CIND indications completely in the simtech
plugin, as there is even no AT command reference saying those are
supported.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/144
2019-10-11 09:24:22 +00:00
Aleksander Morgado
81795f3023 simtech: implement GPS support with AT+CGPS
The new logic is available in a new 'MMSharedSimtech' interface which
is implemented both by the generic AT-based MMBroadbandModemSimtech
modem, and by a new QMI-based new MMBroadbandModemQmiSimtech.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/112
2019-10-11 09:24:22 +00:00
Aleksander Morgado
abede5b9e3 simtech: increase +CNSMOD command timeout
From 5s to 20s, as it seems it could take much more to complete and
get a response, as seen in the logs below.

    <debug> [1568553228.546862] (ttyUSB3): --> 'AT+CNSMOD=1<CR>'
    <debug> [1568553233.799470] (ttyUSB3): --> 'AT+AUTOCSQ=1,1<CR>'
    <debug> [1568553238.798866] (ttyUSB3) setting up 3GPP unsolicited registration messages handlers
    <debug> [1568553238.798932] (ttyUSB2) setting up 3GPP unsolicited registration messages handlers
    <debug> [1568553238.798990] (ttyUSB3) device open count is 1 (close)
    <warn>  [1568553238.799029] (tty/ttyUSB3) at port timed out 2 consecutive times
    <debug> [1568553238.799094] (ttyUSB3) device open count is 2 (open)
    <debug> [1568553238.799148] (ttyUSB3): --> 'AT+CREG=2<CR>'
    <warn>  [1568553241.798727] (tty/ttyUSB3) at port timed out 3 consecutive times
    <debug> [1568553241.798799] (ttyUSB3): --> 'AT+CREG=1<CR>'
    <debug> [1568553244.795389] Enabling unsolicited registration events in primary port failed: 'AT sequence failed'
    <debug> [1568553244.795462] (ttyUSB2) device open count is 2 (open)
    <debug> [1568553244.795507] (ttyUSB3) device open count is 1 (close)
    <warn>  [1568553244.795545] (tty/ttyUSB3) at port timed out 4 consecutive times
    <debug> [1568553244.795588] (ttyUSB2): --> 'AT+CREG=2<CR>'
    <debug> [1568553244.800815] (ttyUSB3): <-- '<CR><LF>OK<CR><LF><CR><LF>OK<CR><LF>'
    <debug> [1568553244.801624] (ttyUSB3): <-- '<CR><LF>OK<CR><LF><CR><LF>OK<CR><LF>'
    <debug> [1568553244.808710] (ttyUSB2): <-- '<CR><LF>OK<CR><LF>'
2019-09-15 16:22:55 +02:00
Ben Chan
1e47692573 simtech: fix memory leak 2017-10-07 10:01:44 +02:00
Aleksander Morgado
01ba79b70b simtech: port 3gpp_{setup|cleanup}_unsolicited_messages to GTask 2017-10-06 10:02:13 +02:00
Aleksander Morgado
c04160817a simtech: port 3gpp_enable_unsolicited_events to GTask 2017-10-06 10:02:13 +02:00
Aleksander Morgado
e7fbf6fc56 simtech: port 3gpp_disable_unsolicited_events to GTask 2017-10-06 10:02:13 +02:00
Aleksander Morgado
df4abdec15 simtech: port load_access_technologies to GTask 2017-10-06 10:02:13 +02:00
Aleksander Morgado
cda7deea3d simtech: port load_supported_modes to GTask 2017-10-06 10:00:09 +02:00
Aleksander Morgado
bf83bb7577 simtech: port load_current_modes to GTask 2017-10-06 10:00:09 +02:00
Aleksander Morgado
9c1f9023e3 simtech: port set_current_modes to GTask 2017-10-06 10:00:09 +02:00
Aleksander Morgado
5ee58513c7 simtech: fix error reporting in 3gpp unsolicited events enabling 2017-09-13 16:37:00 +02:00
Aleksander Morgado
ef274b5fa2 simtech: fix async completion in 3gpp event handlers setting 2017-07-17 10:20:17 +02:00
Aleksander Morgado
2eb55d3224 plugins: use G_N_ELEMENTS when iterating ports array 2017-05-30 17:28:23 +02:00
Aleksander Morgado
6f235b9948 ports: rename 'MMAtSerialPort' to 'MMPortSerialAt' 2014-02-13 13:40:01 +01:00
Aleksander Morgado
1c67d050cb api,introspection: merge 'AllowedModes' and 'SupportedMode' into 'CurrentModes'
We now have a single 'CurrentModes' property which contains both values in a
tuple with signature "(uu)".

Also, rename 'SetAllowedModes()' to 'SetCurrentModes()', and update the list of
arguments expected to have a single "(uu)" tuple.
2013-06-05 19:15:14 +02:00
Aleksander Morgado
45ceba7692 api,introspection: 'SupportedModes' is now a list of possible combinations
Instead of just a mask of MMModemMode values, we now provide a list of the
allowed and preferred mode combinations supported by the modem. E.g.:

$> sudo mmcli -m 0
  -------------------------
  Modes    |      supported: 'allowed: 2g; preferred: none
           |                  allowed: 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: 2g
           |                  allowed: 2g, 3g; preferred: 3g
           |                  allowed: 4g; preferred: none
           |                  allowed: 2g, 3g, 4g; preferred: none'
2013-06-05 19:15:14 +02:00
Aleksander Morgado
c250fa3797 libmm-glib: remove the `libmm-common.h' header
Both the ModemManager daemon and the mmcli will now include `libmm-glib.h' only.

We also handle two new special `_LIBMM_INSIDE_MM' and `LIBMM_INSIDE_MMCLI'
symbols, which if included before the `libmm-glib.h' library allow us to:

 * Don't include the libmm-glib high level API in the ModemManager daemon, as
   the object names would clash with those in the core.

 * Define some of the methods of helper objects to be included only if compiling
   ModemManager daemon or the mmcli.
2012-10-04 10:17:12 +02:00
Aleksander Morgado
0436b3e457 api,introspection: report list of drivers, not just one
Different ports of the same modem may get handled by different drivers. We
therefore need to provide a list of drivers (new `Modem.Drivers' property with
signature 'as') instead of just one (removed `Modem.Driver' property with
signature 's').

$ sudo mmcli -m 0 | grep drivers
           |        drivers: 'qcserial, qmi_wwan'
2012-08-24 13:34:51 +02:00
Aleksander Morgado
e8bc2f41e7 simtech: implement custom allowed/preferred mode setting 2012-04-14 16:04:18 +02:00
Aleksander Morgado
9e89e88ce9 simtech: implement custom allowed/preferred mode loading 2012-04-14 16:04:18 +02:00
Aleksander Morgado
c9214bd54f simtech: implement custom access technology loading 2012-04-14 16:04:17 +02:00
Aleksander Morgado
281cada39d simtech: implement custom unsolicited events enabling/disabling 2012-04-14 16:04:17 +02:00
Aleksander Morgado
1cea1e5bbe simtech: implement custom unsolicited events setup/cleanup 2012-04-14 16:04:17 +02:00
Aleksander Morgado
8cd4b29fde simtech: new `MMBroadbandModemSimtech' object 2012-04-14 16:04:17 +02:00