diff --git a/device/testing/soc-qcom-msm8909/APKBUILD b/device/testing/soc-qcom-msm8909/APKBUILD new file mode 100644 index 000000000..e8eef0d11 --- /dev/null +++ b/device/testing/soc-qcom-msm8909/APKBUILD @@ -0,0 +1,35 @@ +pkgname=soc-qcom-msm8909 +pkgdesc="Common package for Qualcomm MSM8909 devices" +pkgver=1 +pkgrel=0 +url="https://postmarketos.org" +license="GPL-3.0-or-later" +arch="armv7" +options="!check !archcheck" +depends="soc-qcom-msm8916" +subpackages=" + $pkgname-modem +" + +source=" + msm8909-modem-wwan-port.initd + " + +package() { + mkdir -p "$pkgdir" +} + +modem() { + pkgdesc="Modem support for Qualcomm MSM8909 devices" + install_if="soc-qcom-msm8909 soc-qcom-msm8916-rproc-all" + depends="qmi-utils" + install="$subpkgname.post-install" + mkdir -p "$subpkgdir" + + install -D -m755 "$srcdir"/msm8909-modem-wwan-port.initd \ + "$subpkgdir"/etc/init.d/msm8909-modem-wwan-port +} + +sha512sums=" +4a11a35f766af798ca6052dd236094b9aed46cc8761a38437c42d58ab6de6247943c1186d50f70c405df0b73d3d72b6e378a054429505e98c5204391165a4a3a msm8909-modem-wwan-port.initd +" diff --git a/device/testing/soc-qcom-msm8909/msm8909-modem-wwan-port.initd b/device/testing/soc-qcom-msm8909/msm8909-modem-wwan-port.initd new file mode 100644 index 000000000..75e40ee0b --- /dev/null +++ b/device/testing/soc-qcom-msm8909/msm8909-modem-wwan-port.initd @@ -0,0 +1,48 @@ +#!/sbin/openrc-run + +# Based on msm-modem-uim-selection.initd + +name="Modem WWAN port" +description="Activate the WWAN port on the embedded QMI modem" + +depend() { + need rmtfs + before ofono + before modemmanager +} + +# All of the logic is placed in the service start method as we want to block +# other services while the modem isn't ready yet. +start() { + # libqmi must be present to use this script. + if ! [ -x "$(command -v qmicli)" ] + then + eend 1 'qmicli is not installed.' + return 1 + fi + + # Prepare a qmicli command with desired modem path. + # The modem may appear after some delay, wait for it. + count=0 + while [ -z "$QMICLI_MODEM" ] && [ "$count" -lt "45" ] + do + # Check if QRTR is available + if qmicli --silent -pd qrtr://0 --uim-noop > /dev/null + then + QMICLI_MODEM="qmicli --silent -pd qrtr://0" + veinfo "Using qrtr://0" + fi + sleep 1 + count=$((count+1)) + done + veinfo "Waited $count seconds for modem device to appear" + + if [ -z "$QMICLI_MODEM" ] + then + eend 2 'No modem available.' + return 2 + fi + + $QMICLI_MODEM --dpm-open-port=hw-data-ep-type=bam-dmux,hw-data-ep-iface-number=1,hw-data-rx-id=1,hw-data-tx-id=1 > /dev/null + eend $? +} diff --git a/device/testing/soc-qcom-msm8909/soc-qcom-msm8909-modem.post-install b/device/testing/soc-qcom-msm8909/soc-qcom-msm8909-modem.post-install new file mode 100644 index 000000000..4a4eeb2ac --- /dev/null +++ b/device/testing/soc-qcom-msm8909/soc-qcom-msm8909-modem.post-install @@ -0,0 +1,2 @@ +#!/bin/sh +rc-update add msm8909-modem-wwan-port default