modemmanager: add systemd unit to force a late scan of modems

Some modems take a lot of time to initialize and ModemManager won't
see them on its first scan.
This service will force a rescan 40 seconds after boot, to give
enough time for those lazy modems.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://jira.digi.com/browse/DEL-6366
This commit is contained in:
Hector Palacios 2019-04-10 17:23:14 +02:00
parent 2778713ef8
commit db57343ed4
3 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,8 @@
[Unit]
Description=Late modems scan
Requires=ModemManager.service
After=ModemManager.service xbee-init.service time-sync.target
[Service]
Type=oneshot
ExecStart=mmcli --scan-modems 1>/dev/null 2>&1

View File

@ -0,0 +1,8 @@
[Unit]
Description=Late modems scan timer
[Timer]
OnActiveSec=40s
[Install]
WantedBy=multi-user.target

View File

@ -5,6 +5,8 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI += " \
file://78-mm-digi-xbee-cellular.rules \
file://80-mm-net-device-blacklist.rules \
file://late-modems-scan.service \
file://late-modems-scan.timer \
"
# 'polkit' depends on 'consolekit', and this requires 'x11' distro feature. So
@ -19,6 +21,14 @@ do_install_append() {
# Install udev rules for ModemManager blacklist devices
install -m 0644 ${WORKDIR}/80-mm-net-device-blacklist.rules ${D}${nonarch_base_libdir}/udev/rules.d/
# Install systemd service for scanning late modems
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/late-modems-scan.service ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/late-modems-scan.timer ${D}${systemd_unitdir}/system/
}
SYSTEMD_SERVICE_${PN}_append = " late-modems-scan.timer"
FILES_${PN}_append = " late-modems-scan.timer"
PACKAGE_ARCH = "${MACHINE_ARCH}"