modem/msm-modem-wwan-port: new package

Add new package for create wwan interface for MSM8909
and MSM89x7 devices.

Signed-off-by: Barnabás Czémán <barnabas.czeman@postmarketos.org>
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6774
This commit is contained in:
Barnabás Czémán 2025-07-13 18:40:41 +02:00 committed by Oliver Smith
parent e0a9749818
commit 16885b7f42
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
4 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,37 @@
# Maintainer: Barnabas Czeman <barnabas.czeman@postmarketos.org>
pkgname=msm-modem-wwan-port
pkgver=1
pkgrel=0
pkgdesc="Open wwan port for older Qualcomm SoCs."
url="https://postmarketos.org/"
arch="armhf armv7 aarch64"
license="GPL-3.0-or-later"
depends="rmtfs"
subpackages="
$pkgname-openrc
"
source="
msm-modem-wwan-port
msm-modem-wwan-port.initd
"
options="!check"
package() {
install -Dm755 "$srcdir"/msm-modem-wwan-port \
-t "$pkgdir"/usr/libexec/
}
openrc() {
install_if="$pkgname=$pkgver-r$pkgrel openrc"
depends="openrc rmtfs-openrc"
install="$subpkgname.post-install"
install -Dm755 "$srcdir/$pkgname.initd" \
"$subpkgdir/etc/init.d/$pkgname"
}
sha512sums="
14b91d616d796d89c3b7497b85ddd998f6108546118aee44531eb26183d3d09b0f6bb3f6a47840afbfc7bed115c4d6ac31369046b7281cfb3dc8a54f0fc8c58e msm-modem-wwan-port
133a18b2fb5a1753a9a1b7ff37faf69642f90be451484ba85235bba60394d66b875574bcc6461c0dffbf2bb80f37b9e95f280858f8893c7b79070bb7261305b3 msm-modem-wwan-port.initd
"

View file

@ -0,0 +1,39 @@
#!/bin/sh
set -eu
QMICLI_MODEM=
if command -v systemd-notify > /dev/null; then
trap '[ $? -eq 0 ] && systemd-notify --ready' EXIT
fi
# libqmi must be present to use this script.
if ! [ -x "$(command -v qmicli)" ]
then
echo 'qmicli is not installed.'
exit 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"
echo "Using qrtr://0"
fi
sleep 1
count=$((count+1))
done
echo "Waited $count seconds for modem device to appear"
if [ -z "$QMICLI_MODEM" ]
then
echo 'No modem available.'
exit 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
exit $?

View file

@ -0,0 +1,2 @@
#!/bin/sh
rc-update add msm-modem-wwan-port default

View file

@ -0,0 +1,19 @@
#!/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() {
/usr/libexec/msm-modem-uim-selection
eend $?
}