modemmanager: remove cellularifupdown script
The cellular interface is now managed by NetworkManager, so there is no need for this custom script. Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
parent
9329e5681b
commit
092305e8f6
|
|
@ -1,65 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
RETRIES=12
|
|
||||||
POLLING_WAIT=5
|
|
||||||
|
|
||||||
# Run only for cellular network interfaces
|
|
||||||
[ -z "${IF_APN}" ] && exit 0
|
|
||||||
|
|
||||||
background_connect() {
|
|
||||||
# The XBee Cellular needs more time to settle down before MM is able
|
|
||||||
# to detect it. As the XBee is connected to a 'ttymxc' serial port,
|
|
||||||
# we check those ports to conditionally delay the launch of MM.
|
|
||||||
if echo "${IF_PORT}" | grep -qs ttymxc; then
|
|
||||||
sleep 25
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure ModemManager is running
|
|
||||||
killall -0 ModemManager 2>/dev/null || ModemManager --log-file=/var/log/modemmanager.log &
|
|
||||||
|
|
||||||
# Wait for modem detection
|
|
||||||
while [ "${RETRIES}" -gt "0" ]; do
|
|
||||||
mmcli -m 0 > /dev/null 2>&1 && break
|
|
||||||
sleep ${POLLING_WAIT}
|
|
||||||
RETRIES="$((RETRIES - 1))"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Abort if no modem detected
|
|
||||||
if [ "$RETRIES" -eq "0" ]; then
|
|
||||||
logger -s -p error -t modemmanager "No modem detected";
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARGS="apn=${IF_APN}"
|
|
||||||
[ -n "${IF_PIN}" ] && ARGS="${ARGS},pin=${IF_PIN}"
|
|
||||||
|
|
||||||
[ -n "${IF_USER}" ] && ARGS="${ARGS},user=${IF_USER}"
|
|
||||||
[ -n "${IF_PASSWORD}" ] && ARGS="${ARGS},password=${IF_PASSWORD}"
|
|
||||||
[ -n "${IF_PORT}" ] && ARGS="${ARGS},number=*99#"
|
|
||||||
|
|
||||||
# Enable the modem and connect to provider
|
|
||||||
mmcli -m 0 --simple-connect=${ARGS} > /dev/null 2>&1
|
|
||||||
|
|
||||||
# For serial modems, pppd creates the network interface
|
|
||||||
# Otherwise, get an IP with udhcpc
|
|
||||||
if [ -n "${IF_PORT}" ]; then
|
|
||||||
pppd ${IF_PORT} call mm_cellular > /dev/null 2>&1
|
|
||||||
else
|
|
||||||
udhcpc -q -i ${IFACE} >/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
ifconfig ${IFACE} up
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$MODE" = "start" ]; then
|
|
||||||
background_connect &
|
|
||||||
elif [ "$MODE" = "stop" ]; then
|
|
||||||
# If a call number was used, destroy the network interface
|
|
||||||
[ -n "${IF_PORT}" ] && poff mm_cellular
|
|
||||||
|
|
||||||
ifconfig ${IFACE} down
|
|
||||||
|
|
||||||
# Disconnect and disable the modem
|
|
||||||
mmcli -m 0 -d > /dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
|
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
|
||||||
|
|
||||||
SRC_URI += " \
|
SRC_URI += " \
|
||||||
file://cellularifupdown \
|
|
||||||
file://78-mm-digi-xbee-cellular.rules \
|
file://78-mm-digi-xbee-cellular.rules \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
@ -13,11 +12,6 @@ SRC_URI += " \
|
||||||
PACKAGECONFIG_remove = " polkit"
|
PACKAGECONFIG_remove = " polkit"
|
||||||
|
|
||||||
do_install_append() {
|
do_install_append() {
|
||||||
# Install ifupdown script for cellular interfaces
|
|
||||||
install -d ${D}${sysconfdir}/network/if-pre-up.d/ ${D}${sysconfdir}/network/if-post-down.d/
|
|
||||||
install -m 0755 ${WORKDIR}/cellularifupdown ${D}${sysconfdir}/network/if-pre-up.d/
|
|
||||||
ln -sf ../if-pre-up.d/cellularifupdown ${D}${sysconfdir}/network/if-post-down.d/cellularifupdown
|
|
||||||
|
|
||||||
# Install udev rules for XBee cellular
|
# Install udev rules for XBee cellular
|
||||||
install -d ${D}${nonarch_base_libdir}/udev/rules.d
|
install -d ${D}${nonarch_base_libdir}/udev/rules.d
|
||||||
install -m 0644 ${WORKDIR}/78-mm-digi-xbee-cellular.rules ${D}${nonarch_base_libdir}/udev/rules.d/
|
install -m 0644 ${WORKDIR}/78-mm-digi-xbee-cellular.rules ${D}${nonarch_base_libdir}/udev/rules.d/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue