Commit Graph

17 Commits

Author SHA1 Message Date
Florian Eckert
24d2ba0ba8 modemmanager: check during SIM unlocking whether initialization has been completed
After the SIM has been successfully unlocked, it is initialized. This can
take longer on some modems, so we must wait until the modem is ready to
execute the next commands.

Otherwise the modem cannot be enabled and aborts with the following
error message:

error: couldn't enable the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.WrongState: modem in initializing state'

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
fa6198e36b modemmanager: reset to 'no' plmn if nothing is configured
If a configured 'plmn' is deleted from the configuration between a connection
setup, it will continue to be used because the modem remembers it.

Therefore, the 'plmn' stored in the modem must be deleted when a new
connection is established if it is no longer in the configuration.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
3a5aa8a387 modemmanager: swap plmn and technology set command in the proto
In the current implementation of the modemmanager 'proto', if a 'plmn' and a
'technology' is configured, the 'plmn' is set first and then second the
'technology' on a 'proto' setup.

However, this is problematic if a 'technology' has already been set in an
earlier run. It is possible, that this previously set 'technology' is not
available at the current location, as the modem remembers the setting.

To fix this, first set the technology and then the plmn.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
8682084e34 modemmanager: move plmn registration into own function
To improve the code, the setting of the 'plmn' is moved to separate function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
5ab483aa44 modemmanager: rename function modemmanager_check_state to modemmanager_check_sim_state
This is a preparation commit for a new function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
9f35173639 modemmanager: move initial eps settings after modem enable
This settings are needed before any other mmcli command is executed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
85a01e2bb3 modemmanager: add pin check attempts
This new check in the proto modemanager prevents the SIM card from being
blocked and therefore PUK is not required. If the PIN is entered incorrectly
in the 'uci' configuration, it makes no sense to try this several times
until the PUK is required. Should it nevertheless happen that the PUK
is required, then this will logged.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
deaef51d07 modemmanager: improvement of readability by reversing the query
No functional change. The change makes reading the source clearer.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
cdda998996 modemmanager: add missing interface argument to function modemmanager_check_state
The variable interface is used in the sub-function 'modemmanager_check_state'.
However, this is not an argument of the function and so the global value
is used. Addding the variable as an function call argument fixes this.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
64bd9e9d08 modemmanager: move modemmanager_check_state failed and locked into sub functions
To make the source clearer, the program parts for the 'locked' and 'failed'
cases are outsourced to sub-functions.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
dced576bfe modemmanager: fix value call with modemmanager_get_field function
The correct values are prefixed with 'modem.generic'. This is missing
for the value 'state' and 'state-failed-reason.

While we're at it, let's move the readout of 'state-failed-reason' to the
failed case, because that's the only place it's needed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Chen Minqiang
9877676890 modemmanager: add sourcefilter option support
This make source based IPv6 routing option available for
modemmanager case dhcpv6

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2024-06-23 16:39:01 -07:00
Oliver Sedlbauer
7eb763b962 modemmanager: remove status message from errors
The message 'MM_CONNECT_IN_PROGRESS' is a status message, not an error
message. To avoid confusion, the message has been removed.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2024-06-11 16:00:20 +02:00
Oliver Sedlbauer
06a6258035 modemmanager: add option to force connection
This commit improves the automatic reconnect logic. If the modem cannot
establish a connection, for example due to poor reception, the
proto_block_restart prevents the interface from trying to reconnect.
To enforce the connection, this commit adds a new option that allows the
system to attempt to establish a connection indefinitely.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2024-06-11 15:59:45 +02:00
Florian Eckert
9d509b7433 modemmanager: start a 3gpp network regsistration
If a 'plmn' is set in the configuration, a registration attempt should be
established before the simple-connect command. If the plmn is set during
the simple-connect, a network change may occur during the connection setup.

To prevent this, the registration is started before the simple-connect with
a separate mmcli command. So that we can be sure that the modem is already
registered in the correct network before the simple-connect command.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-03-05 15:20:38 +01:00
Florian Eckert
d839e194c5 modemmanager: move cleanup and enable to the top
Before a new connection attempt is made, the previous connection must be
cleaned up before further connection attempts are made. This is now done
by moving the cleanup and enable sequence to the beginning of the
conection setup.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-03-05 15:20:38 +01:00
Florian Eckert
dab2cdc44c modemmanager: moving the openwrt related files to subdirectories
Moving the openwrt related files to subdirectories as they are installed
on the system. This change makes it immediately apparent during development
where the file is to be installed in the running system.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-03-05 13:04:59 +01:00