Commit Graph
161 Commits
Author SHA1 Message Date
Aleksander Morgado 4be88b899e modem-helpers-mbim: port to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 3186a498c1 sms-part-3gpp: port to use object logging 2020-04-08 16:35:09 +02:00
Aleksander Morgado 46405afdf3 broadband-modem-mbim: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado 38f6e4eec9 broadband-modem-mbim: fix segfault when loading capabilities
If loading capabilities using QMI over MBIM returns NONE without an
explicit error, the process would crash. Fix that by making the error
optional when NONE is received.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/185
2020-03-16 09:58:08 +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 af2bea5a54 broadband-modem-mbim: avoid using the deprecated mm_pco_list_free() 2020-01-31 14:52:49 +01:00
Aleksander Morgado 6d54691930 broadband-modem-mbim: fix warnings with -Wshadow
mm-broadband-modem-mbim.c: In function ‘ussd_cancel_ready’:
  mm-broadband-modem-mbim.c:5005:16: error: declaration of ‘task’ shadows a parameter [-Werror=shadow]
   5005 |         GTask *task;
        |                ^~~~
  mm-broadband-modem-mbim.c:4991:34: note: shadowed declaration is here
   4991 |                    GTask        *task)
        |                    ~~~~~~~~~~~~~~^~~~
2020-01-30 19:09:52 +01:00
Aleksander Morgado bcd380a6f1 broadband-modem-mbim: fix warnings with -Wdouble-promotion
mm-broadband-modem-mbim.c: In function ‘atds_signal_query_ready’:
  mm-broadband-modem-mbim.c:4389:49: error: implicit conversion from ‘float’ to ‘double’ to match other operand of binary expression [-Werror=double-promotion]
   4389 |         mm_signal_set_ecio (result->umts, -24.0 + ((float) ecno / 2));
        |                                                 ^
  mm-broadband-modem-mbim.c:4394:48: error: implicit conversion from ‘float’ to ‘double’ to match other operand of binary expression [-Werror=double-promotion]
   4394 |         mm_signal_set_rsrq (result->lte, -19.5 + ((float) rsrq / 2));
        |                                                ^
2020-01-30 19:09:52 +01:00
Aleksander Morgado c8e4c2e751 broadband-modem-mbim: fix warnings with -Wtype-limits
mm-broadband-modem-mbim.c: In function ‘basic_connect_notification_signal_state’:
  /usr/include/glib-2.0/glib/gmacros.h:811:63: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
    811 | ine CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
        |                                                           ^

  mm-broadband-modem-mbim.c:2918:19: note: in expansion of macro ‘CLAMP’
   2918 |         quality = CLAMP (rssi == 99 ? 0 : rssi, 0, 31) * 100 / 31;
        |                   ^~~~~
2020-01-30 19:09:52 +01:00
Aleksander Morgado ac70712f1f broadband-modem-mbim: fix warnings with -Wtype-limits
This change is exclusively to make the compiler happy, don't even like
it myself...

  mm-broadband-modem-mbim.c: In function ‘signal_state_query_ready’:
  /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)))
        |                                                               ^
  mm-broadband-modem-mbim.c:1680:19: note: in expansion of macro ‘CLAMP’
   1680 |         quality = CLAMP (rssi == 99 ? 0 : rssi, 0, 31) * 100 / 31;
        |                   ^~~~~
2020-01-30 19:09:52 +01:00
Aleksander Morgado 7e67cbfe42 broadband-modem-mbim: fix warnings with -Wswitch-enum
mm-broadband-modem-mbim.c: In function ‘query_device_services_ready’:
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_INVALID’ not handled in switch [-Werror=switch-enum]
   2132 |             switch (service) {
        |             ^~~~~~
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_BASIC_CONNECT’ not handled in switch [-Werror=switch-enum]
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_SMS’ not handled in switch [-Werror=switch-enum]
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_PHONEBOOK’ not handled in switch [-Werror=switch-enum]
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_STK’ not handled in switch [-Werror=switch-enum]
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_AUTH’ not handled in switch [-Werror=switch-enum]
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_DSS’ not handled in switch [-Werror=switch-enum]
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_MS_FIRMWARE_ID’ not handled in switch [-Werror=switch-enum]
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_MS_HOST_SHUTDOWN’ not handled in switch [-Werror=switch-enum]
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_PROXY_CONTROL’ not handled in switch [-Werror=switch-enum]
  mm-broadband-modem-mbim.c:2132:13: error: enumeration value ‘MBIM_SERVICE_QMI’ not handled in switch [-Werror=switch-enum]
2020-01-30 19:09:52 +01:00
Aleksander Morgado 00bb228472 broadband-modem-{qmi,mbim}: port cleanups always during dispose()
If we need to disconnect signal handlers for the different port
objects managed in the QMI/MBIM modems, we need to do that during
dispose(), as there is no guarantee at all that the port objects will
exist in the MMBaseModem by the time finalize() is run.

  ModemManager[4183]: <debug> [1579097652.255333] Modem (Sierra) '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4' completely disposed
  ModemManager[4183]: [/dev/cdc-wdm1] unexpected port hangup!
  ModemManager[4183]: [/dev/cdc-wdm1] channel destroyed
  ModemManager[4183]: <info>  [1579097652.258186] Connection to mbim-proxy for /dev/cdc-wdm1 lost, reprobing

  (ModemManager:4183): GLib-GObject-WARNING **: 15:14:12.258: invalid unclassed pointer in cast to 'MMBaseModem'
  ModemManager[4183]: mm_base_modem_set_reprobe: assertion 'MM_IS_BASE_MODEM (self)' failed

  (ModemManager:4183): GLib-GObject-WARNING **: 15:14:12.258: invalid unclassed pointer in cast to 'MMBaseModem'
  ModemManager[4183]: mm_base_modem_set_valid: assertion 'MM_IS_BASE_MODEM (self)' failed
  ModemManager[4183]: [/dev/cdc-wdm1] unexpected port hangup!
  ModemManager[4183]: [/dev/cdc-wdm1] channel destroyed
  ModemManager[4183]: [/dev/cdc-wdm1] MBIM error: Cannot write message: Broken pipe
  ModemManager[4183]: [/dev/cdc-wdm1] MBIM error: Cannot write message: Broken pipe
  ModemManager[4183]: [/dev/cdc-wdm1] MBIM error: Cannot write message: Broken pipe
  ModemManager[4183]: [/dev/cdc-wdm1] MBIM error: Cannot write message: Broken pipe
2020-01-15 15:37:06 +01:00
Aleksander Morgado a28f88b684 broadband-modem-mbim: implement reset in Intel-based devices 2019-11-28 22:25:36 +01:00
Aleksander Morgado dc3bd91b53 broadband-modem-mbim: plug task leak when completing USSD operation 2019-11-28 14:58:31 +01:00
Aleksander Morgado 8f21f40674 broadband-modem-mbim: avoid LTE attach config/status if unsupported
If we know that the LTE attach status/configuration CIDs in the Basic
Connect Extensions service are unsupported, don't even try to use
them, so that we avoid timeouts in the requests.
2019-11-27 09:03:22 +01:00
Eric Caruso 33140e1fc3 mm-broadband-modem-mbim: fix incorrect log message
The log message would display a value based on combining the
notification flags with a CID, which doesn't make sense. Test
against the flag for this notification instead.
2019-10-12 04:23:26 +00:00
Aleksander Morgado 7974933de8 broadband-modem-mbim: avoid using MM_CORE_ERROR_CANCELLED 2019-10-11 07:27:59 +00:00
Aleksander Morgado 6493f5f933 broadband-modem-mbim: use retry logic from generic modem interface
If the modem interface reports that this is the last attempt to load
the lock status and the modem is still reporting no sim, then, we'll
report a hard error right away. Otherwise, we'll let the generic logic
retry the operation, instead of doing it ourselves.
2019-09-15 07:17:52 +00:00
Aleksander Morgado f2f42e193e iface-modem: report last attempt to load_unlock_required implementations
The load_unlock_required() step will be automatically retried by the
generic interface logic unless some specific errors happen (e.g. it
won't be retried if a SIM missing error is received).

This patch allows telling the implementation of the method whether
this time being run is the last one before reporting a hard error or
not.
2019-09-15 07:17:52 +00:00
Ben Chan 5efa15b83f broadband-modem-mbim: fix potential dereference of null GByteArray
ussd_decode() expects a non-null GByteArray while process_ussd_message()
could potentially passes a null GByteArray to ussd_decode(). This
patch fixes the issue by having process_ussd_message() always creates a
GByteArray.
2019-08-25 12:38:55 +00:00
Lech Perczak 7a6e92727f broadband-modem-mbim: parse nw_error in register_state_set_ready only if MBIM_STATUS_FAILURE
Some modems (Namely: Telit LE910 V2) report nonzero NwError code,
outside of 3GPP TS 24.008 - in "register-state set command-done" response,
while status code equals MBIM_STATUS_ERROR_NONE.
In such cases network is operational.
According to MBIM specification 1.0 table 10.5.9.8 "Status codes",
NwError shall be nonzero only if Status Code equals MBIM_STATUS_FAILURE,
and client shall parse NwError only in such cases.
Also, MBIM specification does not explicitly state that 'NwError == 0' equals
no error, rather than that it is unknown error, hence raise an error
unconditionally if MBIM status code is MBIM_STATUS_FAILURE.

Therefore, check NwError IFF MBIM response status code equals
MBIM_STATUS_FAILURE, instead of MBIM_STATUS_SUCCESS.

Fixes: 854c371c8a ("broadband-modem-mbim: implement 3GPP registration request")
Signed-off-by: Lech Perczak <l.perczak@camlintechnologies.com>
2019-04-26 14:36:32 +00:00
Dan Williams 88fac7f14a build: fix -Wunused-but-set-variable support and handle clang better
By default the build used -Wno-unused-but-set-variable but that's
clearly not what we want. Fix those problems.

When using clang, the compiler doesn't error on unknown compile
options, so let's add -Werror to the checking too.

CC='clang'
configure:3408: checking for gcc
configure:3435: result: clang
...
configure:17644: checking whether gcc understands -Wno-unused-but-set-variable
configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes -Wno-unused-parameter -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-but-set-variable  conftest.c >&5
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
1 warning generated.
configure:17657: $? = 0
configure:17666: result: yes

Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
2019-04-02 10:48:40 -05:00
Aleksander Morgado b4b6dc9e65 shared-qmi: implement QMI PDC based carrier config support
We implement both loading the current configuration in use, as well as
automatically switching to a different one if a mapping file is
available.
2019-04-02 12:14:03 +02:00
Aleksander Morgado b8daedd3c0 broadband-modem-mbim: static array to define used QMI services 2019-04-02 12:11:25 +02:00
Aleksander Morgado c12b5fa027 broadband-modem-mbim: implement initial EPS bearer settings updating
We use the "LTE attach config" extension defined by Microsoft to update
the initial EPS bearer settings.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/mb-lte-attach-operations
2018-12-07 16:20:53 +00:00
Aleksander Morgado 2b25673f34 broadband-modem-mbim: implement initial EPS bearer settings loading
We use the "LTE attach config" extension defined by Microsoft to query
the initial EPS bearer settings.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/mb-lte-attach-operations
2018-12-07 16:20:53 +00:00
Aleksander Morgado 1e09b586a7 broadband-modem-mbim: implement initial EPS bearer status support
We use the "LTE attach status" extension defined by Microsoft to query
and monitor the initial EPS bearer settings.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/mb-lte-attach-operations
2018-12-07 16:20:53 +00:00
Ben Chan 2522efb359 broadband-modem-mbim: update ms-basic-connect-extensions naming
libmbim 1.17.4 (commit 3eeaa4248b98 "ms-basic-connect-extensions: rename
service") added a MS prefix to the Basic Connectivity Extensions
service. This patch updates the MMBroadbandModemMbim code accordingly.
2018-11-07 09:52:30 +01:00
Ben Chan 436f9ef7e6 core: use g_clear_pointer() to avoid explicitly checking and resetting pointers 2018-10-18 13:17:36 +02:00
Aleksander Morgado c906da415c broadband-modem-mbim: plug leaks when using the ATDS service 2018-10-09 14:13:15 +02:00
Aleksander Morgado d1744c7663 shared-qmi: reuse band management logic in MBIM whenever possible 2018-09-12 17:25:19 +00:00
Aleksander Morgado 7f18a9370a broadband-modem-mbim: use QMI-based mode/capability switching if supported
The implementation available in the shared QMI logic can be used
as-is, with one important note: if the QMI-based mode/capability
switching is used, we MUST also use QMI-based "3GPP network
registration" logic. This is needed because the MBIM command used to
select which 3GPP network to connect to allows specifying the mask of
access technologies desired, and that would overwrite whatever we had
previously set with QMI-based mode/capability switching commands.
2018-09-12 17:25:19 +00:00
Aleksander Morgado 6026c99f2e shared-qmi: reuse device factory reset logic in MBIM whenever possible 2018-09-12 17:25:19 +00:00
Aleksander Morgado 9dc26cc44d shared-qmi: reuse device reset logic in MBIM whenever possible 2018-09-12 17:25:19 +00:00
Ben Chan 0520836afa mbim: fix inconsistency in WITH_QMI guards 2018-08-23 09:44:28 +02:00
Ben Chan 6530683cfb broadband-modem-mbim: add missing guard for shared_qmi_init()
Fixes: 9e42a19742
2018-08-22 17:21:34 +02:00
Aleksander Morgado 532ff24101 broadband-modem-mbim: implement 3GPP USSD support 2018-08-21 16:50:15 +00:00
Aleksander Morgado 666622b4d4 broadband-modem-mbim: report Unsupported if QMI over MBIM not available
For non-Qualcomm MBIM devices, report a generic "Unsupported" error if
we try to do an operation that would otherwise be only available with
QMI-over-MBIM.
2018-08-21 13:26:08 +00:00
Aleksander Morgado d3b43bd0a6 shared-qmi: support for Qualcomm gpsOneXTRA assistance data
The gpsOneXTRA assistance data provides a convenient way to inject
predicted orbit information into the module, without requiring to have
an Internet connection in the module itself.
2018-08-21 13:26:08 +00:00
Aleksander Morgado 0798f32362 shared-qmi: implement LOC-based GPS/A-GPS support 2018-08-21 13:26:08 +00:00
Aleksander Morgado 9e42a19742 broadband-modem-mbim: support for QMI PDS based GPS location 2018-08-21 13:26:08 +00:00
Aleksander Morgado f9cbe045e5 broadband-modem-mbim: use the preallocated DMS client for FCC Auth 2018-08-21 13:26:08 +00:00
Aleksander Morgado 5e6980c7fc broadband-modem-mbim: preallocate QMI clients if QMI over MBIM supported 2018-08-21 13:26:08 +00:00
Aleksander Morgado c0cc694c67 port-mbim: automatically try to open a QMI over MBIM device
Most Qualcomm-based MBIM devices also support QMI over MBIM. We will
try to check in runtime whether the MBIM device supports QMI over
MBIM, and if so, setup a QmiDevice within the MMPortMbim.
2018-08-21 13:26:08 +00:00
Ben Chan 930a5879d4 broadband-modem-mbim: update 'Pco' property in Modem3gpp interface
This patch changes MMBroadbandModemMbim to update the 'Pco' property in
the Modem3gpp interface upon receiving a MBIM_CID_PCO notification.
2018-08-18 13:34:06 -07:00
Aleksander Morgado b7e5ca62c5 broadband-modem-mbim: explicitly ignore SMS storage initialization
The MBIM protocol hides to the user the concept of SMS storages, so we
should explicitly ignore the initialization step so that it isn't run
with the parent AT-based implementation.
2018-08-14 10:58:08 +02:00
Aleksander Morgado b378be0f0d broadband-modem-mbim: fallback to trying AT+CESQ if ATDS signal unsupported 2018-08-10 04:26:12 +00:00
Aleksander Morgado ab9130682c broadband-modem-mbim: implement extended signal support with ATDS 2018-08-10 04:26:12 +00:00
Aleksander Morgado 7a941466c2 broadband-modem-mbim: implement 3GPP location support with ATDS 2018-08-10 04:26:12 +00:00
Aleksander Morgado ff6a82f5b7 broadband-modem: check if modem implements MBIM_CID_USSD 2018-08-10 04:26:12 +00:00