Commit graph

64 commits

Author SHA1 Message Date
Aleksander Morgado
eb283ea8a3 modemmanager: fix unquoted strings when launching pppd
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-11-11 15:16:03 -08:00
Maxim Anisimov
c588b92d51 modemmanager: bump to 1.18.12
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
2022-09-14 22:12:01 +03:00
Arkadiusz Drabczyk
cdbc7a67fc modemmanager: fix mm_log() invocations in 25-modemmanager* files
Definition of mm_log() was changed in
45a56a8899 but 25-modemmanager* weren't
changed.

Signed-off-by: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
2022-07-24 10:35:43 -07:00
Aleksander Morgado
c15e94f6c5 modemmanager: explicitly disconnect even if no bearers found
A network restart where netifd is cleanly restarted involves bringing
the network interfaces down. The 'modemmanager' protocol handler will
run a mmcli --simple-disconnect in this case, but only if there are
bearer objects found.

If the network restart happened *during* the connection attempt
procedure, while the modem is e.g. being registered in the network, no
bearer objects exist yet, and so, we would skip doing anything during
the interface teardown operation. This would lead to the original
connection attempt succeeding, so leaving the modem in ModemManager
in connected state, while the associated interface in netifd is
reported down.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-07-05 21:59:51 -07:00
Rosen Penev
df5d7245b9 treewide: remove PKG_INSTALL for meson projects
It doesn't seem to be used by meson.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-06-15 18:07:46 -07:00
Aleksander Morgado
bc754f31cf modemmanager: report network initiated disconnections to netifd
The new connection dispatcher scripts support integrated in
ModemManager 1.18.8 allows us to provide a openwrt-specific dispatcher
script used to report netifd that the underlying network connection is
down.

See also https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/775

Fixes https://github.com/openwrt/openwrt/issues/8368
Fixes https://github.com/openwrt/packages/issues/14096

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-05-14 21:39:50 -07:00
Aleksander Morgado
e430420aa1 modemmanager: install available FCC unlock scripts
The FCC unlock scripts are installed but not enabled by default.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-05-14 21:39:50 -07:00
Aleksander Morgado
43d4e8fff8 modemmanager: bump to 1.18.8
Also removed two patches that are already included in the upstream
release.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-05-14 21:39:50 -07:00
Maxim Anisimov
6ae8b15d68 modemmanager: switch to meson build tools
Using https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git to download the source code.
Added compile option to compile qrtr support.
Enabled lto and additional gcc flags for perfomance and less size.
Modified to use meson as upstream has abandoned autotools.
Removed BUILD_PARALLEL options. These are default with ninja/meson.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
2022-03-30 21:48:56 -07:00
Kuan-Yi Li
de9fce568b modemmanager: bump to 1.18.6
Remove upstreamed patch.

Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
2022-03-09 02:15:46 -08:00
Nicholas Smith
8a878440bf modemmanager: bump to 1.18.4 with patch
The included patch corrects an issue preventing udev rules from
being parsed correctly. [1][2]

This patch should not be needed after the next release. [3]

More information:
[1] e9f254ba3f
[2] https://lists.freedesktop.org/archives/modemmanager-devel/2021-December/009024.html
[3] https://lists.freedesktop.org/archives/modemmanager-devel/2021-December/009022.html

Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
2022-02-11 11:58:42 -08:00
Aleksander Morgado
ab061c8ddd modemmanager: remove 2s timeout before reporting cached events
When ModemManager is started on boot we may end up with hotplug events
reported directly to the daemon, plus some others already cached in
the cache file before the daemon was started.

If the cached events correspond to the same device that is still
notifying ports directly, we may end up with a modem object created
before the cached events have been emitted, so the modem may not
handle all control/data ports it should.

E.g.:

  - modem detected
  - hotplug event for wwan0 port, cached as MM not running
  - hotplug event for cdc-wdm0 port, cached as MM not running
  - hotplug event for ttyUSB0, cached as MM not running
  - MM starts
  - hotplug event for ttyUSB1, directly processed as MM is running
  - hotplug event for ttyUSB2, directly processed as MM is running
  - modem object created with ttyUSB1 and ttyUSB2
  - 2s after MM starts, cached events for wwan0, cdc-wdm0 and ttyUSB0
    happen, but are ignored because the modem object has already been
    created

MM expects that ports of the same device are reported with less than
1500ms in between ports. In other words, if ports are reported more
than 1500ms after the last reported port, they may get ignored.

If we remove the 2s timeout, the report of the cached events will
happen as soon as MM starts, which makes it much more likely to happen
in the timeslot that MM expects for ports of the same device reported.
The logic is still not perfect, and we may also need to increase that
1500ms timeout inside MM, but removing the 2s timeout right away here
makes sense.

This 2s timeout was introduced along with the new wrapper launcher for
the daemon, it didn't exist before.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-01-13 15:54:02 -08:00
Florian Eckert
45a56a8899 modemmanager: refactoring hotplug debug logging
The output of the hotplug is very chatty and floods the log with
messages that are not necessary in functioning operation.

So that the log can be filtered. A log level was added to each message
as the first opiton on mm_log function call.

In addition, the facility of the hotplug script has been set to daemon,
which in my view fits better than user.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-12-14 09:17:34 +01:00
Florian Eckert
dc7095baff ModemManager: add service options
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-12-14 09:17:02 +01:00
Florian Eckert
0b027b131c ModemManager: refactoring procd init script
The way the init script is written now, we get a bad output when calling
the ubus service backend.

ubus call service list "{'verbose':true,'name':'modemmanager'}"
>{
>        "modemmanager": {
>                "instances": {
>                        "instance1": {
>                                "running": true,
>                                "pid": 20511,
>                                "command": [
>                                        "sh",
>                                        "-c",
>                                        ".
>/usr/share/ModemManager/modemmanager.common;    \t
>mkdir -m 0755 -p /var/run/modemmanager;          \t
>mm_cleanup_interfaces;                            \t
>( mm_report_events_from_cache ) >/dev/null 2>&1 & \t
>/usr/sbin/ModemManager"
>                                ],
>                                "term_timeout": 5,
>                                "respawn": {
>                                        "threshold": 3600,
>                                        "timeout": 5,
>                                        "retry": 5
>                                },
>                                "pidfile":"/var/run/modemmanager/modemmanager.pid"
>                        }
>                }
>        }
>}"

I also get the output in the log that the PID file cannot be created.

> daemon.err procd: Failed to remove pidfile: :No such file or directory

The changes in this commit fixes this issues, by moving startup into a
wrapper script.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-12-06 14:49:43 +01:00
Aleksander Morgado
9bc5942529 modemmanager: fix physdev sysfs path detection in PCIe modems
The PCIe physdev path lookup relies on the 'vendor' and 'device'
attribute files, instead of the 'idVendor' and 'idProduct' ones, which
are USB specific.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2021-11-12 11:00:04 -08:00
Aleksander Morgado
2a31359c47 modemmanager: add support for wwan subsystem in hotplug
WWAN devices may now be exposed in the new 'wwan' subsystem in the
kernel (since 5.13), initially applicable to devices exposed in PCIe
(no USB), but at some point may also apply to USB devices that until
now were exposed via other subsystems (e.g. usbmisc, tty).

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2021-10-19 21:39:26 +02:00
Kuan-Yi Li
2937f0024b modemmanager: bump to 1.18.2
Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
2021-09-20 21:52:09 +08:00
Nicholas Smith
c7ec9ec410 modemmanager: switch to autorelease
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
2021-08-22 16:12:36 +10:00
Nicholas Smith
858d61b148 modemmanager: bump to 1.16.10
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
2021-08-22 15:50:33 +10:00
Nicholas Smith
5bfe8ed2df modemmanager: bump to 1.16.6
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
2021-06-07 09:02:37 +10:00
Nicholas Smith
02d8bbcfe0 modemmanager: bump to 1.16.2
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
2021-03-07 19:50:23 +10:00
Nicholas Smith
54a9b58ffd modemmanager: bump to version 1.16.0
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
2021-02-24 13:43:52 +10:00
Nicholas Smith
a0fb37f78c modemmanager: bump version
Signed-off-by: Nicholas Smith <nicholas.smith@telcoantennas.com.au>
2021-01-19 08:47:52 +10:00
Rosen Penev
aca1ee1b67 modemmanager: bump release
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-12-09 01:40:11 -08:00
Rosen Penev
520a619e58
Merge pull request #13009 from valexi7/master
modemmanager: Added options
2020-12-09 00:55:54 -08:00
Nicholas Smith
e13d36fa8b modemmanager: bump to 1.14.8
Signed-off-by: Nicholas Smith <nicholas.smith@telcoantennas.com.au>
2020-11-30 10:35:42 +10:00
Aleksander Morgado
a7108c9e12 modemmanager: include all init commands in the procd instance
If procd relaunches the ModemManager daemon after e.g. a crash, we
also want it to notify all cached hotplug events, or otherwise we
would end up leaving the daemon running without the full initial
processing done.

This change modifies the init script to include all the required init
commands as part of the procd instance command, so that procd launches
all of them on every respawn.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-11-02 10:55:17 +01:00
Aleksander Morgado
9a16087fd6 modemmanager: increase initial timeout for event reporting
When the ModemManager daemon is started by the init script, we're
explicitly calling mm_report_events_from_cache() so that all the
hotplug events that happened before that moment are properly notified
to the newly launched daemon.

This initial reporting of events does a wait for the ModemManager
process to be available in DBus, and if the daemon isn't registered in
the bus in a given time, the process is considered failed:

  Sun Sep  6 16:20:02 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:02 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:03 2020 [2180]: <info>  ModemManager (version 1.14.6) starting in system bus...
  Sun Sep  6 16:20:03 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:04 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:05 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:05 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:06 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:06 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:07 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:07 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:08 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:08 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:09 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:09 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:10 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:10 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:11 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:11 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:12 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:12 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:12 2020 ModemManager: hotplug: error: couldn't report initial kernel events: ModemManager not running

Update the default wait time for this initial event notification from
10s to 60s, because there are cases where the daemon is slower to
boot, e.g. during the first boot after a sysupgrade.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-10-30 23:29:55 +01:00
Nicholas Smith
87593abb06 modemmanager: bump to 1.14.6
Signed-off-by: Nicholas Smith <nicholas.smith@telcoantennas.com.au>
2020-10-15 09:39:02 +10:00
Aleksander Morgado
efda597235 modemmanager: bump to 1.14.2
https://lists.freedesktop.org/archives/modemmanager-devel/2020-August/008099.html

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-08-20 10:01:19 +02:00
Valtteri Holopainen
46f5937ad1 modemmanager: added new proto options
Added signal refresh rate option
modemmanager: update readme.md
Added description for added proto options.

Added compile option to compile --with-at-command-via-dbus for allowing
AT commands to modem without --debug flag

 Changes to be committed:
	modified:   net/modemmanager/Config.in
	modified:   net/modemmanager/Makefile
	modified:   net/modemmanager/files/modemmanager.init
	modified:   net/modemmanager/files/modemmanager.proto
	modified:   README.md

Signed-off-by: Valtteri Holopainen <valtsu@gmail.com>
2020-08-13 12:56:31 +03:00
Aleksander Morgado
735eb02d04 modemmanager: avoid requiring autoreconf to build package
Do not manually overwrite the paths of gdbus-codegen or glib-mkenums
in the ModemManager package build, as modifying the configure.ac ends
up requiring a full autoreconf.

Since MM 1.14, git builds or autoreconf-ed source package builds
require autoconf-archive installed in the build system, and so the
build would fail if this happens.

The update to overwrite the paths was to force using the gdbus-codegen
and glib-mkenums provided by the "host" glib2 package instead of the
"target" glib2 package (see fa8ad6e69c),
but these tools are really the same in both as they're python
programs, arch independent.

Tested in a local build where the setup detects and uses the correct
glib tool paths from the target:
  /home/user/openwrt/staging_dir/target-mips_24kc_musl/usr/bin/gdbus-codegen
  /home/user/openwrt/staging_dir/target-mips_24kc_musl/usr/bin/glib-mkenums

Fixes https://github.com/openwrt/packages/issues/12958

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-07-30 09:32:17 +02:00
Nicholas Smith
377a33730d modemmanager: add error message notifications to proto handler
Signed-off-by: Nicholas Smith <nicholas.smith@telcoantennas.com.au>
2020-07-10 20:28:31 +10:00
Nicholas Smith
e1bcb21d9a modemmanager: bump to 1.14.0
Signed-off-by: Nicholas Smith <nicholas.smith@telcoantennas.com.au>
2020-07-06 22:03:03 +10:00
Rosen Penev
8a965ca029
Merge pull request #12086 from aleksander0m/aleksander/mm-auth
Authentication protocol setup in ModemManager
2020-06-28 20:01:26 -07:00
Aleksander Morgado
41552c1cc2 modemmanager: set interface MTU based on bearer settings
Using the same method used by other protocol handlers like uqmi.

Fixes https://github.com/openwrt/packages/issues/11383

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-25 15:35:50 +02:00
Aleksander Morgado
daff1c4497 modemmanager: improve package README
Explain which are the options supported by the protocol, and also
which are the supported values in each (if the field has value
validation).

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-14 09:19:57 +02:00
Aleksander Morgado
c5c5620f20 modemmanager: allow specifying list of authentication protocols
ModemManager allows specifying which are the authentication protocols
to be used during the user/password context authentication with the
peer.

This protocol update allows users to provide a new 'allowedauth'
option in the interface configuration, which is then used in two
different places:
 * It is sent to ModemManager in the --simple-connect call so that
   modems with a network interface can perform the authentication
   using their own vendor-specific protocol.
 * If the connection is done using PPP, this list of protocols is used
   to configure the pppd call.

If the new 'allowedauth' option is not given, all auth protocols are
implicitly allowed.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-14 09:19:54 +02:00
Aleksander Morgado
3feeacc051 modemmanager: release 1.12.10
https://lists.freedesktop.org/archives/modemmanager-devel/2020-May/007828.html

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-09 15:29:08 +02:00
Rosen Penev
311e2d76bb
modemmanager: fix compilation under uClibc-ng
Needs nls.mk as a result of the glib2 change.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-22 15:50:57 -07:00
Aleksander Morgado
052d9274ef modemmanager: release 1.12.8
https://lists.freedesktop.org/archives/modemmanager-devel/2020-March/007729.html

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-03-14 10:27:11 +01:00
Aleksander Morgado
d121e270e8 modemmanager: release 1.12.6
https://lists.freedesktop.org/archives/modemmanager-devel/2020-February/007713.html

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-02-12 11:34:47 +01:00
Rosen Penev
cfd1e8c12d
modemmanager: fixed license information
Removed unrecognized configure option.

Small cleanups.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-01-22 20:45:23 -08:00
Aleksander Morgado
b9fa64832f modemmanager: release 1.12.4
New stable release with lots of fixes, including some severe memory
leaks happening when GPS management is used in QMI-based devices.

https://lists.freedesktop.org/archives/modemmanager-devel/2020-January/007670.html

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-01-14 15:27:29 +01:00
Aleksander Morgado
d439333770 modemmanager: depend on ppp explicitly
The ModemManager protocol handler checks for the pppd daemon during
the initialization, and if it doesn't exist, the protocol handler is
not even loaded by netifd.

This is because the IP method to use on the connection of a given
modem is not known until ModemManager reports via its interfaces how
the modem should be connected (either using PPP, with DHCP, or with
explicit IP settings).

Fixes https://github.com/openwrt/packages/issues/10802

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-12-19 09:41:45 +01:00
Aleksander Morgado
9362a25801 modemmanager: release 1.12.2
This new release also installs additional 'shared utils' loadable
libraries in /usr/lib/ModemManager, so make sure we include them in
the packaging.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-12-10 14:12:47 +01:00
Aleksander Morgado
5f11888b12 modemmanager: install common utils in /usr/share/ModemManager
The modemmanager.common file includes several utility functions that
are used in several places like the protocol handler and in hotplug
scripts. These utilities should not be installed in /etc as they're
not configuration.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-27 09:28:10 +01:00
Aleksander Morgado
ecad39fd60 modemmanager: don't flag the 'device' option as 'device' type
Unlike other modem protocol handlers like the ones implemented by uqmi
or umbim, in the modemmanager protocol handler the 'device' option
does not specify a device node in /dev. Therefore, we shouldn't flag
the option as 'device' type (dt_type_device).

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-27 09:28:10 +01:00
Aleksander Morgado
a684cdbab0 modemmanager: fix device unplug handling
When a USB modem device is unplugged, we had to do two different
things: first, cleanup the sysfs cache; and second, set interface as
unavailable.

Those two things were never being done properly due to several
different issues:

 * The parent sysfs path retrieval logic relies on checking for which
 sysfs path has the vid/pid files. This logic obviously only works
 when the device is available, and cannot be used on e.g. removal
 events.

 * The command to cleanup the modem wait status from the sysfs cache
 was not removing the previous state properly, because the sysfs path
 variable wasn't escaped properly for the sed command.

This patch handles those issues in order to have a proper device
removal handling, by making sure the sysfs path is properly escaped in
the sed command, and by introducing a new hotplug script that runs
when the full USB device is removed.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-27 09:28:10 +01:00