The original code for xmm7360_byte_array_read_asn_int() returned
signed integers both from the function and from the returned
Xmm7360RpcMsgArg, but didn't handle sign extension on the
value returned from the function. That would lead to different
values between the function return and the Xmm7360RpcMsgArg
value, which seems wrong.
Make those two correspond and add checks in various places that
shouldn't ever see negative ints.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
That way UNKNOWN is the zero'd value instead of BYTE; it's easier
to test for and less error-prone if not explicitly set to the right
value.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
xmm7360_byte_array_read_asn_int() would keep bit-shifting a gint into
oblivion if the int's size was > 32-bit. It also didn't handle size 0
ints at all, and while size 24 ints would get stuffed into a 32-bit
variable those probably aren't a thing and if they actually are they
should get specifically handled.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
So we can unit-test all the parsing and building code more easily
without having to link to a bunch of serial port stuff.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
If the error matches, then a `+CIMI` command is sent to the device and
processing continues. However, the current error (for the `+CPIN?` command)
is not freed or propagated, fix that.
Fixes: 5c1fcbfe4a ("mtk-legacy: read IMSI if CPIN response is an error")
Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
The MTK specific modem object should be included in the 'mtk' shared
utils, so that they're available to other plugins.
Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
Current cell broadcast messages from missile warnings in Israel
have an addition `00` at the end to pad for an even byte number.
This breaks conversion making the whole message fail conversion. As this
is a 15 part message in 3 languages the whole notification is lost in
this case.
Try harder to convert the message and recover even partial bits.
Closes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/1042
Signed-off-by: Guido Günther <agx@sigxcpu.org>
The port type hints for the RW101-cat6 and RW101-cat12 have been
updated, with USB interface #2 now designated as both the AT primary
port and fastboot port.
Signed-off-by: Wenbin <ywbjob@163.com>
only GGA NMEA sentences are supported by current implementation of
MMLocationGpsRaw. RMC and GLL messages are added, but currently test
are negative.
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
To be able to have quick position fix GNSS engine needs to know
- predicted orbits data,
- current time,
- approximate position.
Modem sends indications with requests, when it needs corresponding
information. Predicted orbits can be injected using
'mmcli -m any --location-inject-assistance-data=<file>'. But to
accelerate time to first fix after cold start extra information is
needed like time and coarse position.
Inject position requests are received, when GPS session is initiated
using QMI_LOC_START. In inject position request modem sends
information about its last known position. If last known position is
zero, when this is a cold start and inject position is needed to
improve TTFF.
Last position from the modem is cached in ModemManager and is injected
next time, when modem requests it. For example, if modem is restarted.
When timestamp on injected position is too old, than position is
ignored and location engine does cold start. Therefore current time is
used for injected position.
When injected position is far away the actual one (for example, after
flight), after some time location engine falls back to cold start.
Tested on Quectel EG25-G.
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
This class allows to preserve cached position across ModemManager restarts.
Cached location can be used to improve time to first fix after device
start by injecting coarse position into location engine. Since there
wasn't any fix yet, position in ModemManager is unknown. To fix this
cached location is saved on disk (/var/lib/ModemManager/location.ini)
when location session is stopped or ModemManager is stopped and loaded
on the next start from the file.
install_emptydir is introduced in meson 0.60.
Distributions has to create directory to store cached location in
packaging, because ModemManager runs under systemd isolation with
limited rights and it can't create this directory by itself.
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
To be able to have quick position fix GNSS engine needs to know
- predicted orbits data,
- current time,
- approximate position.
Modem sends indications with requests, when it needs corresponding
information. Predicted orbits can be injected using
'mmcli -m any --location-inject-assistance-data=<file>'. But to
accelerate time to first fix after cold start extra information is
needed like time and coarse position. This commit injects UTC time.
UTC time inject requests are received, when GPS session is initiated
using QMI_LOC_START.
Tested on Quectel EG25-G.
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
UML290 with firmware L0290VWBB12F.248 doesn't support QMI network
time and crashes when asked for AT network time too quickly after
being plugged in.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Qualcomm suggests to use mux id values >= 0x81: though this does not
seem a strict mandatory rule, there are scenarios in which the usage of
a specifix mux id is required otherwise various kind of issues could
happen (e.g. call failure, limited throughput...).
A new ID_MM_INITIAL_QMAP_MUX_ID udev tag allows setting the first initial
mux id value to be used when creating the multiplexed data connection.
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
On SDM845 (OP6T) modem always starts with engine lock 'all'.
It doesn't allow to read assistance server settings at the beginning.
QMI call 'Get Predicted Orbits Data Source' (0x0036) fails with general
failure. As a result it's not possible to inject assistance data using
'mmcli -m any --location-inject-assistance-data=<file>'.
Commit 90843b7a0d ("shared-qmi: Lock and unlock GPS engine when
starting and stopping") unlocks engine on GNSS start, that allows
geolocation to work on SDM845, but it locks engine back on GNSS stop.
As a result after GNSS stop it's not possible to inject XTRA data again.
On EG25-G engine lock settings is stored in NV storage and is preserved after
modem restart. By default engine lock is 'none'. But currently on GNSS
stop this value is changed to 'all', that blocks location engine.
If previous ModemManager version is installed after
stopping geolocation and locking the engine, geolocation will not
work, since the engine is still locked and modem restart will not help.
This commit unlocks engine on modem start so all following operations
with an engine succeed. Engine isn't locked back.
Tested on SDM845 (OP6T) and Quectel EG25-G.
Fixes: 90843b7a0d ("shared-qmi: Lock and unlock GPS engine when starting and stopping")
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Since c2e3a8c10e, the generic plugin was
not able to attach to virtual ports, because they have no associated
driver, and the probe fails with "port filtered as couldn't retrieve
driver". It seems that this driver check was accidentially introduced
and is not really necessary, as there isn't a special "XMMRPC driver"
to blacklist.
Signed-off-by: Sonya Sireneva <sleirsgoevy@gmail.com>
In merge request !1405, when handling subscriber_ready_status_ready()
fails, it exits early and allows preload retry without resetting
`self->priv->preload_cancellable`. When the preload_subscriber_info() runs
again, it fails at g_assert check and causes a crash.
Before !1405, `self->priv->preload_cancellable` is reset within
application_list_query_ready().
Signed-off-by: Rukun Mao <rmao@google.com>
mhi_wwan_mbim ends up being detected as mhi-pci-generic, so we need to
look for that in addition to cdc_wwan when doing MBIM data port stuff.
Otherwise devices (various Foxconn X55/X72, Cinterion MV3x, Quectel
EM1xx, Telit FN990) that expose the IP_HW0_MBIM MHI channel won't
correctly clean up data ports on startup, and may not correctly
handle bearer multiplexing.
mhi_net is only used for QMI devices with rmnet so it shouldn't
be involved in the MBIM data path at all.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Cleaning up multiple active multiplexed bearers causes an assert in
mm_iface_modem_count_bearers since the max number of active bearers
is not properly determined.
Rework the management of the flags in order to better match their
intents, considering that MULTIPLEXED is a subset of ACTIVE/CONNECTED.
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
Before the change, preload is attempted once regardless of its
results. When the first attempt fails, it got stuck and can not get valid
SIM info.
Signed-off-by: Rukun Mao <rmao@google.com>
The device would eventually be automatically probed. Add hints anyway,
as not to waste time with the generic probe.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Function mm_parse_suple_address returns TRUE on valid input data
regardless of its type (URL or IP). As a result
qmi_message_loc_set_server_input_set_ipv4 was always called on valid
data. If URL was provided, then 0.0.0.0 ip address was sent to the
modem instead of provided URL.
Fixes: 6e84f3d459 ("iface-modem-location: validate SUPL server address")
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
It might be too late to register the indication callbacks after the
response is received. Register the callbacks when the request is made so
an requested indication will always be handled.
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Newer modem firmware requires the use of the GPS engine lock, which
controls what the GPS engine can do. Set the GPS engine lock when
appropriate to handle this newer firmware.
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
By default, the Pixel 3a only emits $PQXXX traces, even when all the
desired traces are reported as enabled. A request to set the NMEA types
must still be sent to enable the GGA/GSA/GSV traces. Remove the
optimization that prevents the request from happening automatically.
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
It was noted, that when supl server is set using IP address. Modem
doesn't connect to the SUPL server anymore. When IP address is inverted,
then modem connects to SUPL server successfuly.
IP address is stored as uint32_t. According to Telit's documentation [1]
numeric values are encoded in little-endian format in QMI.
After converting IP address from string to binary using inet_pton
IP address is stored in network byte order (big-endian). Therefore it's
needed another convertion from big-endian to host endianness. Final
conversion from host endianness to endianness needed for QMI will be
done in generated
qmi_message_pds_set_agps_config_input_set_location_server_address.
Vendor's Android GNSS hal uses htonl() to convert from struct in_addr
(already in big-endian) before sending QMI request as well [2].
Tested on Quectel EG25-G and SDM845 (OnePlus 6T).
1. FN980 Family Telit Proprietary QMI Command Reference Guide. 4.1.3.1 Byte Ordering
2. https://github.com/ugly-kid-af/device_xiaomi_violet/blob/snow/gps/gnss/GnssAdapter.cpp#L1110
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>