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);
| ^~~~~
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));
| ^
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]
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
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.
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.
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.
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.
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.
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>
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>
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.
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.
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.
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.
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.
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.