#!/sbin/openrc-run
# Bring up the Qualcomm modem subsystem (and with it the WLAN firmware) with the userspace helpers
# this downstream kernel needs: QRTR name service, PD mapper, rmtfs, TFTP server.
description="modem subsystem + WLAN firmware bring-up"
depend() { need localmount; after udev; before networkmanager; }
start() {
	ebegin "Starting modem helpers and the modem subsystem"
	/usr/local/bin/wifi-up.sh > /var/log/wifi-up.log 2>&1
	/usr/local/bin/audio-up.sh > /var/log/audio-up.log 2>&1
	eend $?
}
stop() {
	ebegin "Stopping modem"
	for n in modem-holder qtftp rmtfs pd-mapper qrtr-ns; do kill $(cat /run/$n.pid 2>/dev/null) 2>/dev/null; rm -f /run/$n.pid; done
	eend 0
}
