project/uqmi.git
2 months agouim: add support for ICC communication channel master
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>
2 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>
2 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>
6 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>
6 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>
6 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>
6 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>
6 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>
7 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>
7 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>
7 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>
7 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>
7 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.

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
9 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>
9 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>
12 months 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>
12 months 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>
12 months 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>
12 months 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>
12 months 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
5 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>
6 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>
7 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>
7 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]
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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]
8 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>
8 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.

8 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.

8 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>
8 years agowds: make ipv6 address endian swap more portable
Felix Fietkau [Sun, 22 Nov 2015 11:30:46 +0000 (12:30 +0100)]
wds: make ipv6 address endian swap more portable

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agouqmi: Added CMake option BUILD_STATIC for a static uqmi build
Bachtin, Dmitri [Wed, 9 Sep 2015 07:35:49 +0000 (09:35 +0200)]
uqmi: Added CMake option BUILD_STATIC for a static uqmi build

Signed-off-by: Dmitri Bachtin <dbachtin@init-ka.de>
9 years agouqmi: Add get-current-settings command-line switch
Antti Seppälä [Sat, 8 Aug 2015 07:44:38 +0000 (07:44 +0000)]
uqmi: Add get-current-settings command-line switch

Adding --get-current-settings switch which can be used to query
ip-settings among some other useful data obtained from remote end when
connected.

This is mainly useful with modems which do not provide a dhcp server for
nameserver or ip-information (especially in ipv6 networks).

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Tested-by: Matti Laakso <malaakso@elisanet.fi>
9 years agouqmi: Add IP family selection command-line switch
Antti Seppälä [Sat, 8 Aug 2015 07:44:37 +0000 (07:44 +0000)]
uqmi: Add IP family selection command-line switch

This patch adds support for (optionally) specifying ip family via a
command- line switch. The switch sends respective "Set IP Family" WDS
message to qmi-device before actually connecting.

Using this switch allows connecting to ipv6 enabled networks or networks
with dual-stack support with the appropriate hardware (dongle and FW
with ipv6 support) and configuration (AT+CGDCONT reporting ipv6 or
ipv4v6 capability).

Help text:
  --ip-family <family>:    Set ip-family for the connection (ipv4, ipv6, unspecified)

Usage example for ipv6:
  uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid> --start-network <apn> --ip-family ipv6

Dual-stack usage example:
  uqmi -d /dev/cdc-wdm0 --get-client-id wds
  uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid-1> --start-network <apn> --ip-family ipv4
  uqmi -d /dev/cdc-wdm0 --get-client-id wds
  uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid-2> --start-network <apn> --ip-family ipv6

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Tested-by: Matti Laakso <malaakso@elisanet.fi>
9 years agoadd missing license headers (LGPL v2)
Felix Fietkau [Tue, 12 May 2015 11:01:34 +0000 (13:01 +0200)]
add missing license headers (LGPL v2)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agoAdd command to get IMEI from the device
Felix Fietkau [Mon, 13 Apr 2015 22:29:26 +0000 (00:29 +0200)]
Add command to get IMEI from the device

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agoAdd command to specify preferred PLMN
Sławomir Demeszko [Fri, 16 Jan 2015 19:30:38 +0000 (20:30 +0100)]
Add command to specify preferred PLMN

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoAdd command for listing device capabilities
Sławomir Demeszko [Thu, 8 Jan 2015 18:08:30 +0000 (19:08 +0100)]
Add command for listing device capabilities

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoAdd missing option for getting tdma signal strength
Sławomir Demeszko [Thu, 8 Jan 2015 14:15:40 +0000 (15:15 +0100)]
Add missing option for getting tdma signal strength

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoFix encoding phone number on sending sms
Sławomir Demeszko [Thu, 18 Dec 2014 15:12:15 +0000 (16:12 +0100)]
Fix encoding phone number on sending sms

Return proper length of encoded phone number with odd count of digits,
without this patch number is encoded in memory but length returned
by function is not incremented and sms cannot be send.

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoMaking smsc number optional
Sławomir Demeszko [Mon, 22 Dec 2014 18:47:34 +0000 (19:47 +0100)]
Making smsc number optional

If smsc number is not provided before sending sms then
operator's default stored on simcard will be used.

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoFix improper length of sms message stored in User Data Length field
Sławomir Demeszko [Mon, 22 Dec 2014 18:02:57 +0000 (19:02 +0100)]
Fix improper length of sms message stored in User Data Length field

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoFix logical expression which is always true
Sławomir Demeszko [Mon, 22 Dec 2014 17:23:50 +0000 (18:23 +0100)]
Fix logical expression which is always true

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoAdd mandatory field to Initiate Network Register
Sławomir Demeszko [Wed, 17 Dec 2014 18:06:16 +0000 (19:06 +0100)]
Add mandatory field to Initiate Network Register

According to json data Action field in Initiate Network Register
is mandatory. I get "Missing argument" from qmi without it.

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoFix improper characters after reading Escape code for switching extension table in SMS
Sławomir Demeszko [Wed, 17 Dec 2014 16:14:53 +0000 (17:14 +0100)]
Fix improper characters after reading Escape code for switching extension table in SMS

Escape code 0x1b is a prefix indicating that next character should be
represented from extension table, but it only applies to one character,
so switching it off is needed to read further characters correctly.

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoAdded commands to change PIN code
Sławomir Demeszko [Wed, 17 Dec 2014 14:56:32 +0000 (15:56 +0100)]
Added commands to change PIN code

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoAdded shared struct to allow the same option names for different functions
Sławomir Demeszko [Wed, 17 Dec 2014 12:35:33 +0000 (13:35 +0100)]
Added shared struct to allow the same option names for different functions

For example we can use one option --new-pin with commands unblock-pin
and with change-pin, without that we need to invent new name
for every new command.

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoAdded option for enabling and disabling protection of simcard by PIN
Sławomir Demeszko [Wed, 17 Dec 2014 12:35:32 +0000 (13:35 +0100)]
Added option for enabling and disabling protection of simcard by PIN

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoAdd support for 16-bit reference number in concatenated SMS.
Sławomir Demeszko [Wed, 17 Dec 2014 13:34:48 +0000 (14:34 +0100)]
Add support for 16-bit reference number in concatenated SMS.

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoFix character "@" added at end of received messages
Sławomir Demeszko [Mon, 8 Dec 2014 18:05:25 +0000 (19:05 +0100)]
Fix character "@" added at end of received messages

If 7 bit message encoded on 8 bit cells has one last bit occupying
whole byte it need to be padded with 7 zero bits. To not mistake
these last 7 bits with a character with code 0 (@) we need to check
length from User Data Length field and not rely on actual length
of received data. An example can be message "abcdefg" encoded
as "61 f1 98 5c 36 9f 01", it is decoded as "abcdefg@".

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoAdded support for 8 bit and 16 bit encoded SMS messages
Sławomir Demeszko [Mon, 8 Dec 2014 12:27:34 +0000 (13:27 +0100)]
Added support for 8 bit and 16 bit encoded SMS messages

Message is presented as string of hexadecimal pairs in JSON output.

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoSeparation of decoding User Data Header from decoding 7 bit message
Sławomir Demeszko [Mon, 8 Dec 2014 12:27:33 +0000 (13:27 +0100)]
Separation of decoding User Data Header from decoding 7 bit message

It is preparation for supporting 8 bit and 16 bit encoding. Moving out
this code from decode_7bit_field() allows to reuse it in caller
function where other than 7 bit decoding will take place.

Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoAdd --delete-message for deleting SMS messages
Sławomir Demeszko [Tue, 2 Dec 2014 15:26:36 +0000 (15:26 +0000)]
Add --delete-message for deleting SMS messages

Signed-off-by: Sławomir Demeszko <s.demeszko@wireless-instruments.com>
9 years agoSEGFAULT on reading Unicode sms messages
Sławomir Demeszko [Thu, 27 Nov 2014 14:00:12 +0000 (14:00 +0000)]
SEGFAULT on reading Unicode sms messages

Added complementary blobmsg_close_table() before returning from function
on error.

9 years agoadd wda commands for setting/getting wireless data mode
Felix Fietkau [Tue, 25 Nov 2014 20:22:16 +0000 (21:22 +0100)]
add wda commands for setting/getting wireless data mode

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agosuppress enum conversion warnings
Felix Fietkau [Tue, 25 Nov 2014 20:11:50 +0000 (21:11 +0100)]
suppress enum conversion warnings

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agofix indentation
Felix Fietkau [Wed, 19 Nov 2014 16:30:11 +0000 (17:30 +0100)]
fix indentation

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agoFix improper part number in multipart SMS text messages
Sławomir Demeszko [Tue, 18 Nov 2014 15:07:32 +0000 (15:07 +0000)]
Fix improper part number in multipart SMS text messages

Received multipart SMS messages has part number always one too high.

9 years agoAdd command --get-msisdn for getting phone number
Sławomir Demeszko [Tue, 18 Nov 2014 15:02:00 +0000 (15:02 +0000)]
Add command --get-msisdn for getting phone number

10 years agoAdded command "--get-iccid" to read the SIM serial number.
Uwe Wojak [Thu, 30 Oct 2014 09:17:51 +0000 (10:17 +0100)]
Added command "--get-iccid" to read the SIM serial number.

10 years agoAdded commands to unblock blocked PINs.
Uwe Wojak [Mon, 7 Jul 2014 13:57:53 +0000 (15:57 +0200)]
Added commands to unblock blocked PINs.

Added commands "--unblock-pin1" and "--unblock-pin2" and
parameters "--puk" and  "--new-pin".

10 years agoadd a command for setting the interface data format
Felix Fietkau [Thu, 2 Oct 2014 12:08:31 +0000 (14:08 +0200)]
add a command for setting the interface data format

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofix aliasing error for parsing message float data
Felix Fietkau [Thu, 2 Oct 2014 10:43:18 +0000 (12:43 +0200)]
fix aliasing error for parsing message float data

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoadd a command for changing the autoconnect setting
Felix Fietkau [Thu, 2 Oct 2014 09:59:03 +0000 (11:59 +0200)]
add a command for changing the autoconnect setting

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agosilence a compiler warning about adding an int to a string
Felix Fietkau [Thu, 2 Oct 2014 09:46:04 +0000 (11:46 +0200)]
silence a compiler warning about adding an int to a string

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agomake argument to get_pin_status int instead of enum to prevent invalid optimization
Felix Fietkau [Thu, 2 Oct 2014 09:44:49 +0000 (11:44 +0200)]
make argument to get_pin_status int instead of enum to prevent invalid optimization

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agomove a variable declaration to the right place
Felix Fietkau [Thu, 2 Oct 2014 09:42:15 +0000 (11:42 +0200)]
move a variable declaration to the right place

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