ublox-config: Add recipe to configure ublox modem on first boot

BugzID: 54242
This commit is contained in:
Alexandre Bard 2018-11-12 17:14:43 +01:00
parent 3e846da125
commit 876663971c
3 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,11 @@
[Unit]
Before=ModemManager.service
[Service]
Type=oneshot
ExecStart=/usr/bin/ublox-config.sh
[Install]
WantedBy=ModemManager.service

View File

@ -0,0 +1,25 @@
#!/usr/bin/env sh
ifconfig wwan0 > /dev/null 2> /dev/null
if [ "$?" = "0" ]; then
echo "Modem already configured"
exit 0;
fi
ModemManager --debug > /dev/null 2> /dev/null &
mmcli -m 0 > /dev/null 2> /dev/null
while [ "$?" != "0" ]; do
mmcli -m 0 > /dev/null 2> /dev/null
done
echo "Configuring modem"
mmcli -m 0 --command "AT+UBMCONF=2"
mmcli -m 0 --command 'AT+UUSBCONF=2,"ECM",0'
echo "Resetting modem"
mmcli -m 0 -r
killall ModemManager

View File

@ -0,0 +1,36 @@
SUMMARY = "Ublox gsm configuration"
DESCRIPTION = "Configure ublox gsm modem on first boot"
AUTHOR = "Alexandre Bard"
SECTION = "connectivity"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
PR = "r2"
inherit systemd
SRC_URI = " \
file://ublox-config.service \
file://ublox-config.sh \
"
S = "${WORKDIR}"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
SYSTEMD_SERVICE_${PN} = "ublox-config.service"
SYSTEMD_AUTO_ENABLE ?= "enable"
FILES_${PN}_append = " \
/lib \
/usr \
"
do_install () {
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ublox-config.service ${D}${systemd_unitdir}/system/
install -d ${D}/usr/bin
install -m 0755 ublox-config.sh ${D}/usr/bin
}