project/uqmi.git
4 months agouqmi: extend wda-get-data-format master
David Bauer [Mon, 28 Jul 2025 01:57:24 +0000 (03:57 +0200)]
uqmi: extend wda-get-data-format

With QMAP, more settings for the modem data format are relevant. Include
them into the wda-get-data-format output.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agowda: add option for enabling flow-control
David Bauer [Sun, 27 Jul 2025 19:10:53 +0000 (21:10 +0200)]
wda: add option for enabling flow-control

In conjunction with QMAP, the modem can perform flow-control towards the
host.

Add the necessary option for activating flow-control by configuring the
modem data format.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agowds: implement retrieval of profile list
David Bauer [Fri, 14 Feb 2025 11:04:55 +0000 (12:04 +0100)]
wds: implement retrieval of profile list

Implement a command which returns the list of profiles configured on the
modem.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agowds: implement selection of LTE attach PDNs
David Bauer [Fri, 14 Feb 2025 10:49:14 +0000 (11:49 +0100)]
wds: implement selection of LTE attach PDNs

Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agowds: implement selection of default profile
David Bauer [Thu, 13 Feb 2025 16:00:44 +0000 (17:00 +0100)]
wds: implement selection of default profile

Allow configuration of the default profile on the modem.

This is required to set the default bearer when on LTE.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agowds: implement profile deletion
David Bauer [Thu, 13 Feb 2025 01:19:27 +0000 (02:19 +0100)]
wds: implement profile deletion

Implement deletion of a specific configuration on the modem.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agowds: reduce code duplication
David Bauer [Thu, 13 Feb 2025 00:56:43 +0000 (01:56 +0100)]
wds: reduce code duplication

Reduce code duplications by extracting the parsing of the profile
identifier into a dedicated function.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agodata: add downlink padding option
David Bauer [Mon, 10 Feb 2025 04:09:02 +0000 (05:09 +0100)]
data: add downlink padding option

This option was taken from the GPL code of the Teltonika RUTX50
(Version 00.07.12).

Link: https://teltonika-networks.com/de/support/gpl-code-center
Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agowda: allow agggregation parameter configuration
David Bauer [Sun, 7 May 2023 18:10:21 +0000 (20:10 +0200)]
wda: allow agggregation parameter configuration

ALlow configuration protocol and parameters in up and downstream
direction.

For this to work, the data link layer has to be configured using the
RMNet layer.

Link: https://docs.kernel.org/networking/device_drivers/cellular/qualcomm/rmnet.html
Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agouqmi: enable binding WDS sessions to QMAP multiplex
David Bauer [Sun, 7 May 2023 16:26:07 +0000 (18:26 +0200)]
uqmi: enable binding WDS sessions to QMAP multiplex

Add CLI arguments to bind a PDP session to a QMAP multiplex. This is
required to use the features of the Kernel RMNet layer.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 months agouqmi: fix whitespace errors
David Bauer [Wed, 28 Aug 2024 02:41:45 +0000 (04:41 +0200)]
uqmi: fix whitespace errors

Signed-off-by: David Bauer <mail@david-bauer.net>
5 months agouqmid: sim_fsm: implement PIN/PUK checking set by configuration
Alexander Couzens [Thu, 31 Oct 2024 13:17:03 +0000 (14:17 +0100)]
uqmid: sim_fsm: implement PIN/PUK checking set by configuration

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: read IMEI, IMEISV, MEID (CDMA IMEI)
Alexander Couzens [Sun, 8 Sep 2024 14:12:00 +0000 (16:12 +0200)]
uqmid: read IMEI, IMEISV, MEID (CDMA IMEI)

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: examples: enable roaming
Alexander Couzens [Sun, 8 Sep 2024 13:46:10 +0000 (15:46 +0200)]
uqmid: examples: enable roaming

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: ubus call dump: add roaming variable
Arne Zachlod [Thu, 5 Sep 2024 13:48:47 +0000 (15:48 +0200)]
uqmid: ubus call dump: add roaming variable

Signed-off-by: Arne Zachlod <arne@nerdkeller.org>
5 months agouqmid: fsm: set fi->N = 0 for state start_iface
Alexander Couzens [Sun, 1 Sep 2024 14:54:09 +0000 (16:54 +0200)]
uqmid: fsm: set fi->N = 0 for state start_iface

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: add netifd protocol handler
Alexander Couzens [Tue, 13 Aug 2024 11:05:13 +0000 (13:05 +0200)]
uqmid: add netifd protocol handler

Allow to use /etc/config/network configuration similar to
uqmi. The following qmi specific fields supported:

* apn
* username
* password
* pin
* roaming

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: modem: handle modem with auto connect
Alexander Couzens [Wed, 14 Aug 2024 12:44:37 +0000 (14:44 +0200)]
uqmid: modem: handle modem with auto connect

When a modem has WDS auto connect enabled,
a start network will result in the error "No Effect".
Stop the auto connection and start it to get the packet handle.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: modem_tx: add tx_wds_stop_network()
Alexander Couzens [Wed, 14 Aug 2024 12:43:50 +0000 (14:43 +0200)]
uqmid: modem_tx: add tx_wds_stop_network()

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: move usim related function into own fsm
Alexander Couzens [Sun, 8 Sep 2024 15:50:06 +0000 (17:50 +0200)]
uqmid: move usim related function into own fsm

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: WDS: disable autoconnect on start network
Alexander Couzens [Wed, 14 Aug 2024 12:36:16 +0000 (14:36 +0200)]
uqmid: WDS: disable autoconnect on start network

The autoconnect features prevents uqmid from working correctly,
because the autoconnected connection doesn't contain a valid aid
which is required to control the connection.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: implement roaming support (allow and forbid)
Alexander Couzens [Wed, 14 Aug 2024 12:35:58 +0000 (14:35 +0200)]
uqmid: implement roaming support (allow and forbid)

Set roaming flag on the wds profile which is used to connect
to the network.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: add uqmi_sim_decode_imsi() to decode EF.IMSI from UIM
Alexander Couzens [Sun, 18 Aug 2024 22:48:30 +0000 (00:48 +0200)]
uqmid: add uqmi_sim_decode_imsi() to decode EF.IMSI from UIM

SIM or USIM based files are encoded in BCD format and
QMI doesn't offer a direct method to get the IMSI when only the UIM
service is available.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: modem_fsm: implement re-transmission of GET IMSI calls
Alexander Couzens [Tue, 13 Aug 2024 21:04:59 +0000 (23:04 +0200)]
uqmid: modem_fsm: implement re-transmission of GET IMSI calls

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: osmocom/fsm: add member N
Alexander Couzens [Thu, 6 Feb 2025 17:28:27 +0000 (18:28 +0100)]
uqmid: osmocom/fsm: add member N

The N variable counts how often a timer timed out.
It is used in many 3gpp specs to trigger a failure case
when 3x times the timer timed out.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: modem_fsm: set timeout for GET_IMSI to 3 seconds
Alexander Couzens [Tue, 13 Aug 2024 20:39:51 +0000 (22:39 +0200)]
uqmid: modem_fsm: set timeout for GET_IMSI to 3 seconds

Every state should have a timeout. 3 seconds should be plenty
to respond to GET_IMSI.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: add preliminary support for gsmtapv3
Alexander Couzens [Sun, 19 May 2024 15:29:38 +0000 (16:29 +0100)]
uqmid: add preliminary support for gsmtapv3

gsmtap is a protocol to encapsulate debug messages. It originates
from osmocom to encapsulate GSM protocols of multiple layers.
It has been extended to encapsulate many different types of protocols
including non-3GPP messages.
gsmptap version 3 is currently under review and an initial draft exists.

uqmid will use gsmtap to copy and transmit QMI messages to a remote debug destination.
Either use wireshark or a custom utilty to receive and print those messages.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: osmocom/fsm: fix logline for 64bit timestamp
Alexander Couzens [Tue, 13 Aug 2024 19:33:30 +0000 (21:33 +0200)]
uqmid: osmocom/fsm: fix logline for 64bit timestamp

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: add support to set username, password for PDN
Alexander Couzens [Tue, 13 Aug 2024 11:09:20 +0000 (13:09 +0200)]
uqmid: add support to set username, password for PDN

Some APNs require to set a username, password in the wds profile.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: ubus: check for empty strings for configure arguments
Alexander Couzens [Tue, 13 Aug 2024 11:11:25 +0000 (13:11 +0200)]
uqmid: ubus: check for empty strings for configure arguments

Allow to pass empty string as argument via ubus

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: ubus: use talloc() for modem assigned fields when allocating it
Alexander Couzens [Sun, 19 May 2024 16:05:04 +0000 (17:05 +0100)]
uqmid: ubus: use talloc() for modem assigned fields when allocating it

talloc will take care of free'ing it together with the modem.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: wwan: add support to handle kernel network interface
Alexander Couzens [Sat, 18 May 2024 13:33:40 +0000 (14:33 +0100)]
uqmid: wwan: add support to handle kernel network interface

The kernel network interface can have different modes
- 802.3
- raw-ip
- passthrough towards rmnet/qmap

Currently uqmid will only support raw-ip.
To support higher throughput it will use the rmnet ip interface
with QMAP support.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agouqmid: service: add indications support
Alexander Couzens [Fri, 19 Apr 2024 12:31:13 +0000 (14:31 +0200)]
uqmid: service: add indications support

QMI allow baseband services to send indications (events) towards uqmid.
To some indication uqmid has to register first, other indications
are sent as soon the service has been opened.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agoadd uqmid: a daemonic version of uqmi
Alexander Couzens [Sun, 1 Oct 2023 15:38:49 +0000 (17:38 +0200)]
add uqmid: a daemonic version of uqmi

It is configured via ubus to handle QMI based modem and keep
the state of the modem in difference to uqmi as command utility.
Further it also allows to react on events (indications) of the modem.
See uqmid/examples/ for more usage.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agoCMakeLists: set cmake minimum to 3.10
Alexander Couzens [Sat, 22 Feb 2025 16:22:49 +0000 (17:22 +0100)]
CMakeLists: set cmake minimum to 3.10

Drop unsupported pre_build argument of add_custom_command

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 months agocommon/utils: add system_fd_set_cloexec()
Alexander Couzens [Mon, 23 Oct 2023 14:54:28 +0000 (16:54 +0200)]
common/utils: add system_fd_set_cloexec()

Will be used by uqmid/ubus interface.
Taken from netifd/ubus interface.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
7 months agouqmi nas: fix incorrect parameter order
David Bauer [Sun, 20 Apr 2025 01:27:39 +0000 (03:27 +0200)]
uqmi nas: fix incorrect parameter order

print_lte_info has been called with incorrect argument order in all places.

Fix the method signature so RSRP and RSRQ are correctly represented in
the output.

Signed-off-by: David Bauer <mail@david-bauer.net>
15 months agouim: add support for ICC communication channel
David Bauer [Wed, 3 Jan 2024 14:16:19 +0000 (16:16 +0200)]
uim: add support for ICC communication channel

This creates an interface to obtain a communication channel with the ICC
of the modem. This interface can be used by other applications to
interact with the SIM card, for example LPAd applications for managing
connected eUICC.

Signed-off-by: David Bauer <david.bauer@uniberg.com>
15 months agoqmi: fix dynamic array macro
David Bauer [Wed, 3 Jan 2024 14:16:19 +0000 (16:16 +0200)]
qmi: fix dynamic array macro

The macro was using the parameter for referencing the length field, which
used the same suffix as the parameter name.

Rename the length parameter to correctly access the length field.

Signed-off-by: David Bauer <david.bauer@uniberg.com>
15 months agodata: add support for ICC channel
David Bauer [Wed, 3 Jan 2024 14:16:19 +0000 (16:16 +0200)]
data: add support for ICC channel

Link: https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/merge_requests/376
Signed-off-by: David Bauer <david.bauer@uniberg.com>
19 months agouqmi: print radio interfaces in serving system command
Jean Thomas [Wed, 10 Apr 2024 11:29:22 +0000 (13:29 +0200)]
uqmi: print radio interfaces in serving system command

Add a "radio_interface" array to the NAS --get-serving-system
command.

Signed-off-by: Jean Thomas <jean.thomas@wifirst.fr>
19 months agouqmi: create function to print radio interface string
Jean Thomas [Wed, 10 Apr 2024 11:29:21 +0000 (13:29 +0200)]
uqmi: create function to print radio interface string

Signed-off-by: Jean Thomas <jean.thomas@wifirst.fr>
19 months agouqmi: Add basic 5G NR support
Jean Thomas [Wed, 10 Apr 2024 11:29:20 +0000 (13:29 +0200)]
uqmi: Add basic 5G NR support

* Add 5G NR to supported networks in DMS --get-capabilities.
* Add 5G NR to supported mode in NAS --set-network-modes.
* Add 5G NR signal information to NAS --get-signal-info.
* Add 5G NR system information to NAS --get-system-info.
* Add 5G NR to supported radios in NAS --get-tx-rx-info.
* Add 5G NR cell information to NAS --get-cell-location-info.

Signed-off-by: Jean Thomas <jean.thomas@wifirst.fr>
19 months agouqmi: sync data from libqmi project
Jean Thomas [Wed, 10 Apr 2024 10:25:06 +0000 (12:25 +0200)]
uqmi: sync data from libqmi project

JSON files taken from libqmi at commit
20a902ac997b6d140154295e7cdf5d5e986f9b67.

Signed-off-by: Jean Thomas <jean.thomas@wifirst.fr>
19 months agouqmi: support C reserved keywords in upstream JSON files
Jean Thomas [Wed, 10 Apr 2024 10:25:05 +0000 (12:25 +0200)]
uqmi: support C reserved keywords in upstream JSON files

Add a dummy prefix in case a name in the upstream JSON files is a
C reserved keyword.

This is the case with the "Register" element of the new "Configure
Profile Event List" message.

Signed-off-by: Jean Thomas <jean.thomas@wifirst.fr>
20 months agoreorganize source code in common and uqmi specific parts
Alexander Couzens [Sat, 9 Mar 2024 18:57:08 +0000 (19:57 +0100)]
reorganize source code in common and uqmi specific parts

In preparation to add support for uqmid.
Move uqmi specific parts into directory uqmi/.
Move common parts used by both uqmid and uqmi into common/ directory.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months ago.gitignore build/ directories
Alexander Couzens [Sat, 9 Mar 2024 19:30:37 +0000 (20:30 +0100)]
.gitignore build/ directories

build is common used to build with cmake.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agouqmi: commands-uim: fix uninitialized use of card_application_state
Alexander Couzens [Sat, 9 Mar 2024 19:17:07 +0000 (20:17 +0100)]
uqmi: commands-uim: fix uninitialized use of card_application_state

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agodata/code-gen: add support for indications
Alexander Couzens [Sat, 9 Mar 2024 19:10:50 +0000 (20:10 +0100)]
data/code-gen: add support for indications

Indication (or also notifactions) are send by the modem towards the hosts.
They are similar to response, but without a request.
Some indication will send towards the host as soon the host has created a
session with a service. For other indication the host need to subscribe first.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agoqmi-struct.h: add missing includes
Alexander Couzens [Sat, 9 Mar 2024 19:44:07 +0000 (20:44 +0100)]
qmi-struct.h: add missing includes

To allow qmi-struct.h to be standalone includable.

20 months agomove qmi_get_error_str to into utils.c
Alexander Couzens [Tue, 17 Oct 2023 11:15:22 +0000 (14:15 +0300)]
move qmi_get_error_str to into utils.c

In prepration to allow uqmid to use it as well.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agodev.c: add missing import strings.h
Alexander Couzens [Sun, 1 Oct 2023 16:50:00 +0000 (18:50 +0200)]
dev.c: add missing import strings.h

Fix compiler warning undeclared function.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agocommands-nas: add missing includes
Alexander Couzens [Sun, 1 Oct 2023 16:30:34 +0000 (18:30 +0200)]
commands-nas: add missing includes

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agocommands: make `struct blob_buf status` public
Alexander Couzens [Sun, 1 Oct 2023 16:29:49 +0000 (18:29 +0200)]
commands: make `struct blob_buf status` public

status is already used by other files as public variable.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agocommands-nas: fix gcc warning
Alexander Couzens [Sun, 1 Oct 2023 16:28:10 +0000 (18:28 +0200)]
commands-nas: fix gcc warning

The compiler still thinks c could be initialized.
Even this can't happen, assign it to NULL to silence
the warning.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agodev.c: add comment to qmi_request_wait()
Alexander Couzens [Sun, 1 Oct 2023 16:48:19 +0000 (18:48 +0200)]
dev.c: add comment to qmi_request_wait()

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agoCMakeLists: refactor SOURCES variable to allow later adding uqmid
Alexander Couzens [Sun, 1 Oct 2023 17:10:10 +0000 (19:10 +0200)]
CMakeLists: refactor SOURCES variable to allow later adding uqmid

Rename main.c into uqmi.c.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agoCMakeLists: set no-dangling-pointer
Alexander Couzens [Tue, 17 Oct 2023 11:05:39 +0000 (14:05 +0300)]
CMakeLists: set no-dangling-pointer

As long complete callback will have a stack allocated pointer, uqmi
need to have --Wno-dangling-pointer.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agoCMakeLists: improve generated files
Alexander Couzens [Sun, 1 Oct 2023 11:47:40 +0000 (13:47 +0200)]
CMakeLists: improve generated files

Flag custom command as PRE_BUILT.
Flag all generated files as generated.
Make generated .c files depend on generated .h files.
Move all generated files to the build dir.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
20 months agoCMakeLists: update cmake minimum version to 3.5
Alexander Couzens [Sun, 1 Oct 2023 11:45:26 +0000 (13:45 +0200)]
CMakeLists: update cmake minimum version to 3.5

Older versions aren't anymore supported.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
22 months agouqmi: cancel all requests on SYNC indication reception
Jean Thomas [Tue, 5 Dec 2023 10:12:38 +0000 (11:12 +0100)]
uqmi: cancel all requests on SYNC indication reception

A SYNC indication might be sent by the modem on boot as a first
response, in order to indicate that all Client IDs have been
deallocated. Upon reception of this indication, cancel all current
requests, as they will never be answered.

Signed-off-by: Jean Thomas <jean.thomas@wifirst.fr>
22 months agouqmi: improve response detection
Jean Thomas [Tue, 5 Dec 2023 10:12:37 +0000 (11:12 +0100)]
uqmi: improve response detection

Create a helper which checks the flags depending on the service
indicated in the received message, as the response flag is not the same
for the CTL service and the other services. This avoids considering
a CTL indication as a valid response.

Also use a mask in order to check the flags, as they are a bitmap.

Signed-off-by: Jean Thomas <jean.thomas@wifirst.fr>
2 years agouqmi: add slot number to uim-sim-status output
David Bauer [Sat, 28 Oct 2023 23:01:46 +0000 (01:01 +0200)]
uqmi: add slot number to uim-sim-status output

Add the SIM-card slot-number to uim-sim-status output.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agouim: fix help formatting
David Bauer [Wed, 18 Oct 2023 10:11:17 +0000 (12:11 +0200)]
uim: fix help formatting

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agouqmi: add APN profile commands
Henrik Ginstmark [Mon, 5 Sep 2022 20:07:52 +0000 (22:07 +0200)]
uqmi: add APN profile commands

Add commands to create and modify default APN profile

--get-default-profile
--get-profile-settings
--create-profile
--modify-profile

Signed-off-by: Henrik Ginstmark <henrik@ginstmark.se>
[change argument for default profile number]
Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agouim: support SIM card power-up/down
David Bauer [Sat, 7 Oct 2023 17:04:10 +0000 (19:04 +0200)]
uim: support SIM card power-up/down

Support the power-up and power-down commands for the modem's SIM card.
This allows to reset the SIM card and recover it from an illegal card
application state.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agouim: add application state to SIM status
David Bauer [Sat, 7 Oct 2023 17:03:24 +0000 (19:03 +0200)]
uim: add application state to SIM status

Parse the card application state and report it to the SIM card status
output object.

This is required to detect a card application which is in the failed
(illegal) state.

Signed-off-by: David Bauer <mail@david-bauer.net>
3 years agonas: add decoding of cell_id
Henrik Ginstmark [Tue, 7 Dec 2021 20:53:57 +0000 (21:53 +0100)]
nas: add decoding of cell_id

Add decoding of lte_system_info_v2.cid, in --get-system-info, and
intrafrequency_lte_info_v2.global_cell_id, in --get-cell-location-info,
to enodeb_id and cell_id.
h´xxxxxyy -> enodeb_id = h´xxxxx, cell_id = h´yy

Add decoding of wcdma_system_info_v2.cid, in --get-system-info, to
rnc_id and cell_id.
h´xxxxyyyy -> rnc_id = h´xxxx,  cell_id = h´yyyy

Change order to
mcc-mnc-tac/lac-enodeb_id/rnc_id-cell_id.

Signed-off-by: Henrik Ginstmark <henrik@ginstmark.se>
3 years agouqmi: wms - added storage to read text messages
Henrik Ginstmark [Tue, 15 Mar 2022 19:35:46 +0000 (20:35 +0100)]
uqmi: wms - added storage to read text messages

Today it's hard coded to read text messages from SIM card.
Not all devices store received text messages in SIM, they store
in me, QMI_WMS_STORAGE_TYPE_NV.
I have added --storage as an argumet available to
--list-messages
--get-message
--delete-message
--get-raw-message

If --storage is omitted default storage is sim, as before.

Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Henrik Ginstmark <henrik@ginstmark.se>
3 years agouqmi: corrected too short received SMS
Henrik Ginstmark [Fri, 11 Mar 2022 23:33:54 +0000 (00:33 +0100)]
uqmi: corrected too short received SMS

When characters with ascii values bigger than 0x7f are used, the
length of the received text message is too short.

Test message sent: 123äÄ123
Before correction:
root@OpenWrt:/tmp# uqmi -d /dev/cdc-wdm0 --get-message 20
Raw text: 31 32 33 7b 5b 31 32 33
{
        "smsc": "+46724400001",
        "sender": "+46xxxxxxxxx",
        "timestamp": "2022-03-11 18:48:10",
        "text": "123äÄ1"
}

after correction:
root@OpenWrt:/tmp# uqmi -d /dev/cdc-wdm0 --get-message 20
Raw text: 31 32 33 7b 5b 31 32 33
{
        "smsc": "+46724400001",
        "sender": "+46xxxxxxxxx",
        "timestamp": "2022-03-11 18:48:10",
        "text": "123äÄ123"
}

Signed-off-by: Henrik Ginstmark <henrik@ginstmark.se>
3 years agouqmi: add support for get operating mode
Oskari Lemmela [Tue, 25 Jan 2022 18:05:49 +0000 (20:05 +0200)]
uqmi: add support for get operating mode

Currently only the set operation is supported.
Add support for getting the current operating mode.

Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Henrik Ginstmark <henrik@ginstmark.se>
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
4 years agocommand-nas: fix out-of-bounds read
Daniel Golle [Mon, 22 Nov 2021 01:19:05 +0000 (01:19 +0000)]
command-nas: fix out-of-bounds read

Limit iteration to number of array members fixing potential
out-of-bounds read.

Coverity CID: 1493471 Out-of-bounds read
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agouqmi: use unmodified upstream JSON files
Daniel Golle [Sat, 13 Nov 2021 23:07:49 +0000 (23:07 +0000)]
uqmi: use unmodified upstream JSON files

Extend code generator to handle also identifiers starting with a
numerical character.

Suggested-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
Acked-by: Oskari Lemmelä <oskari@lemmela.net>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agouim: add --uim-get-sim-state
Daniel Golle [Sat, 6 Nov 2021 02:02:00 +0000 (02:02 +0000)]
uim: add --uim-get-sim-state

Provide same output as --get-pin-status for SIM/modem which require
using uim instead of dms command for that.
For now only the first present SIM card with only the first application
on the card is supported (which should cover the vast majority of
cases and allows to remain compatible with --get-pin-status output)

Suggested-by: Arjun AK <arjunak234@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agouqmi: add more diagnostics commands
Oskari Lemmela [Sun, 25 Mar 2018 16:23:06 +0000 (19:23 +0300)]
uqmi: add more diagnostics commands

Useful diagnostic commands for measuring connection info.
Implemented cell location, carrier aggregation and MIMO chain
info in easily parsable json format.

Compressed package size increased by 9kB.

Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
4 years agouqmi: sync data from libqmi project
Oskari Lemmela [Tue, 12 Oct 2021 05:16:35 +0000 (08:16 +0300)]
uqmi: sync data from libqmi project

Sync all json and header files from libqmi project.
Update code to adapt changes in libqmi files.

Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
4 years agouqmi: update code generator
Oskari Lemmela [Mon, 11 Oct 2021 19:14:32 +0000 (22:14 +0300)]
uqmi: update code generator

Add support for common-refs and double arrays.
Fix error message line and type parsing.

Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
5 years agouqmi: add timeout parameter
Zefir Kurtisi [Thu, 7 Nov 2019 11:54:08 +0000 (12:54 +0100)]
uqmi: add timeout parameter

Working with Quectel EM12 LTE-module, we observe
regular stalls of the QMI interface which cause
a request issued by uqmi to hang forever.

Most reproducibly this happens after the device
has been power-cycled and left untouched for a
while (~ 60s+). Most of the time the very first
QMI request fails, since it is not responded by
the module. This is the strace from such a run
(from --get-pin-status):

 open("/dev/cdc-wdm0", O_RDWR|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 6
 fcntl64(6, F_GETFL)                     = 0x10802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
 fcntl64(6, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) = 0
 epoll_ctl(3, EPOLL_CTL_ADD, 6, {EPOLLIN|EPOLLRDHUP|EPOLLET, {u32=268567076, u64=1153486808202346496}}) = 0
 write(6, "\1\17\0\0\0\0\0\1\"\0\4\0\1\1\0\2", 16) = 16
 clock_gettime(CLOCK_MONOTONIC, {tv_sec=95, tv_nsec=583444789}) = 0
 clock_gettime(CLOCK_MONOTONIC, {tv_sec=95, tv_nsec=583770264}) = 0
 epoll_pwait(3,
 [ hang forever ]

After killing the blocked uqmi process, the next
request works as expected.

We don't know whether this is a device FW issue
(we use the latest EM12GPAR01A15M4G) or whether
the device enters some undocumented power-save
mode after idling for some time.

This patch extends uqmi with a timeout option
(-t, --timeout <ms>) which if set terminates a
request after the given amount of msecs. In
our usecase it provides a means of preventing
infinitively stuck QMI requests. Since we
observe the issue only for the very first
request after cold-boot, we use a dummy access
early in qmi.sh, e.g.
  uqmi -d /dev/cdc-wdm0 --get-pin-status -t 3000 >/dev/null 2>&1

This ensures the QMI interface is un-stuck in
case it entered the stall-state observed. The
change is intentionally not included in this
commit, since you don't need it if it works
for you.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
5 years agonas: add --get-plmn
Martin Schiller [Thu, 4 Jul 2019 11:35:37 +0000 (13:35 +0200)]
nas: add --get-plmn

This command is needed in the qmi proto handler to check if the plmn
is already set to 'auto'.

The reason for this is, that setting the plmn to 'auto' will implicitly
lead to a (delayed) network re-registration, which could further lead
to some timing related issues in the qmi proto handler.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
6 years agouqmi: add explicit check for message type when expecting a response
Tautvydas Belgeras [Thu, 20 Jun 2019 10:45:19 +0000 (13:45 +0300)]
uqmi: add explicit check for message type when expecting a response

When the utility sends a request it expects a response type message,
but does not explicitly check for it. When a device stays idle for
some time, it switches into a sleep mode, and notifies the utility with an
identification type message. In some configurations the device only sends
this identification message when triggered by the utility, in this case by
the request message. What the utility gets is two messages at the same time -
an identification and a response. When it tries to decode former it obviously
fails, because it is not what it expected.

Signed-off-by: Tautvydas Belgeras <tautvydas.b@8devices.com>
7 years agouqmi_add_command: fixed command argument assignment
Carlo Lobrano [Thu, 22 Jun 2017 07:40:37 +0000 (09:40 +0200)]
uqmi_add_command: fixed command argument assignment

The char *arg passed to uqmi_add_command was not assigned to cmd[idx].arg.

Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
8 years agouqmi: Change returned value to QMI_CMD_REQUEST for 'sync' command.
Nickolay Ledovskikh [Fri, 16 Dec 2016 11:35:15 +0000 (14:35 +0300)]
uqmi: Change returned value to QMI_CMD_REQUEST for 'sync' command.

QMI_CMD_DONE is not working properly with 'sync' command.
We must use QMI_CMD_REQUEST.

Signed-off-by: Nickolay Ledovskikh <nledovskikh@gmail.com>
8 years agouqmi: Add sync command to release all cids.
Nickolay Ledovskikh [Wed, 7 Dec 2016 17:12:54 +0000 (20:12 +0300)]
uqmi: Add sync command to release all cids.

Signed-off-by: Nickolay Ledovskikh <nledovskikh@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name> [add command line help]
9 years agombim: fix memory corruption issues
Felix Fietkau [Tue, 22 Nov 2016 14:20:57 +0000 (15:20 +0100)]
mbim: fix memory corruption issues

Use a common buffer that has enough headroom for the MBIM header.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 years agonas: fix network scan
Matti Laakso [Sun, 20 Nov 2016 21:27:34 +0000 (23:27 +0200)]
nas: fix network scan

Signed-off-by: Matti Laakso <malaakso@elisanet.fi>
9 years agowds: add option for specifying profile index
Matti Laakso [Sun, 20 Nov 2016 21:27:33 +0000 (23:27 +0200)]
wds: add option for specifying profile index

Some modems require the specification of a profile index which
determines the APN and the IP family used for the connection.

Signed-off-by: Matti Laakso <malaakso@elisanet.fi>
9 years agowds: make APN optional
Matti Laakso [Sun, 20 Nov 2016 21:27:32 +0000 (23:27 +0200)]
wds: make APN optional

Some modem firmwares do not use the APN selected in the Start
Network command. Moreover, it is marked optional in the QMI
specification.

Signed-off-by: Matti Laakso <malaakso@elisanet.fi>
9 years agowds: add a separate --set-ip-family option
Matti Laakso [Sun, 20 Nov 2016 21:27:31 +0000 (23:27 +0200)]
wds: add a separate --set-ip-family option

Change the current ip-family option to set the IP Family Preference
TLV in the Start Network command, and add a separate set-ip-family
option for the Set IP Family command. This is done to match how
the autoconnect and set-autoconnect options work.

Older modems don't support the Set IP Family command, and they
should use the IP Family Preference TLV. On the other hand, newer
modems, e.g., from Huawei, don't respect that TLV, and require the
use of the separate Set IP Family command.

Signed-off-by: Matti Laakso <malaakso@elisanet.fi>
9 years agowds: fix set-autoconnect help text
Matti Laakso [Sun, 20 Nov 2016 21:27:30 +0000 (23:27 +0200)]
wds: fix set-autoconnect help text

Signed-off-by: Matti Laakso <malaakso@elisanet.fi>
9 years agouim: add missing extra data for UIM PIN verify request
Felix Fietkau [Fri, 4 Nov 2016 14:46:06 +0000 (15:46 +0100)]
uim: add missing extra data for UIM PIN verify request

Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 years agoadd UIM verify pin commands
Felix Fietkau [Fri, 4 Nov 2016 13:20:51 +0000 (14:20 +0100)]
add UIM verify pin commands

Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 years agoenable uim message functions
Felix Fietkau [Fri, 4 Nov 2016 13:09:15 +0000 (14:09 +0100)]
enable uim message functions

Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 years agodata: update qmi-service-uim.json from libqmi git
Felix Fietkau [Fri, 4 Nov 2016 13:04:15 +0000 (14:04 +0100)]
data: update qmi-service-uim.json from libqmi git

Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 years agouqmi: fix big endian bugs in MBIM code
Bjørn Mork [Tue, 23 Aug 2016 12:31:05 +0000 (14:31 +0200)]
uqmi: fix big endian bugs in MBIM code

All MBIM integer fields are 32bit little endian.  So we need to convert
then all on big endian systems.

Fixes: e69bf24b00d8 ("uqmi: add support for MBIM devices with QMI service")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
9 years agodms: add "Set FCC Authentication" request
Bjørn Mork [Sun, 21 Aug 2016 00:01:10 +0000 (02:01 +0200)]
dms: add "Set FCC Authentication" request

Many newer modems from Sierra Wireless includes a feature known as
"FCC Authentication".  The basic idea is that the radio is kept in
low power mode until the driver has told the firmware that it is
OK to switch it on.  This is done with a vendor specific QMI DMS
request with no input or output TLVs.

The "Set FCC Authentication" request is required for any modem with
the feature enabled.  Which includes most newer Lenovo branded Sierra
Wireless modems based on Qualcomm chipsets, like for example the
EM7455.

Sample session with an EM7455 in MBIM mode and the FCC Authentication
feature enabled:

 $ umbim -d /dev/cdc-wdm0 -n radio
   hwradiostate: on
   swradiostate: off
 $ uqmi -m -d /dev/cdc-wdm0 --fcc-auth
 $ umbim -d /dev/cdc-wdm0 -t 2 radio
   hwradiostate: on
   swradiostate: on

Signed-off-by: Bjørn Mork <bjorn@mork.no>
9 years agouqmi: add support for MBIM devices with QMI service
Bjørn Mork [Sun, 21 Aug 2016 00:01:09 +0000 (02:01 +0200)]
uqmi: add support for MBIM devices with QMI service

Many Qualcomm based devices offer a QMI service when running in MBIM
mode. This is useful for a number of requests which have no MBIM
counterpart.

This implementation is very basic, simply wrapping the QMI requests
in an MBIM command. It is up to the user to make sure that the MBIM
command sequence is valid, using a mix of umbim and uqmi requests.

umbim must be used to send "OPEN" before uqmi can issue any MBIM
requests. Example:

1. use umbim to open the session, using the '-n' option:

$ umbim -d /dev/cdc-wdm0 -n caps
  devicetype: 0003 - remote
  cellularclass: 0001
  voiceclass: 0001 - no-voice
  simclass: 0002
  dataclass: 003C
  smscaps: 0003
  controlcaps: 0001
  maxsessions: 0008
  deviceid: 0145820007xxxxx
  firmwareinfo: SWI9X30C_02.08.02.00
  hardwareinfo: EM7455

2. use uqmi to send an MBIM request, using the '-m' option:

$ uqmi -m -d /dev/cdc-wdm0 --get-serving-system
{
        "registration": "registered",
        "plmn_mcc": 242,
        "plmn_mnc": 1,
        "plmn_description": "TELENOR",
        "roaming": false
}

3. use umbim to close the open session, using the '-t X' option:

$ umbim -d /dev/cdc-wdm0 -t 2 caps
  devicetype: 0003 - remote
  cellularclass: 0001
  voiceclass: 0001 - no-voice
  simclass: 0002
  dataclass: 003C
  smscaps: 0003
  controlcaps: 0001
  maxsessions: 0008
  deviceid: 0145820007xxxxx
  firmwareinfo: SWI9X30C_02.08.02.00
  hardwareinfo: EM7455

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup, portability fixes]
10 years agobuild: Support for out of source builds added
Bachtin, Dmitri [Thu, 19 Nov 2015 12:31:02 +0000 (13:31 +0100)]
build: Support for out of source builds added

The scripts gen-{header,code,error-list}.pl were called with
source-local paths what disallowed out of source builds.

Updated CMakeLists.txt to call the scripts with ${CMAKE_SOURCE_DIR}
prefix.

Signed-off-by: Dmitri Bachtin <dbachtin@init-ka.de>
10 years agobuild: added _library suffix to lib variables
Bachtin, Dmitri [Fri, 20 Nov 2015 06:34:36 +0000 (07:34 +0100)]
build: added _library suffix to lib variables

It is a convention under CMake to suffix variables in the FIND_LIBRARY
calls with _LIBRARY. Added _library suffix to json, blobmsg_json and
ubox variables.

10 years agouqmi: search for ubox, blobmsg_json and json include paths
Bachtin, Dmitri [Fri, 20 Nov 2015 06:34:35 +0000 (07:34 +0100)]
uqmi: search for ubox, blobmsg_json and json include paths

CMake will search for include paths via FIND_PATH() of the following
libraries: libubox, blobmsg_json and json. This allows to build uqmi
when the dependencies are in non-standard locations by specifying
respective _include_dir variables.

10 years agowds: cast pdp_type enum to int to avoid clang considering the range check tautological
Felix Fietkau [Sun, 22 Nov 2015 11:36:28 +0000 (12:36 +0100)]
wds: cast pdp_type enum to int to avoid clang considering the range check tautological

enum overflow behavior is undefined

Signed-off-by: Felix Fietkau <nbd@openwrt.org>