feat: add WCN3990 Wi-Fi bringup service, battery protection, and bringup automation
Offline project checks / check (push) Canceled after 0s
Offline project checks / check (push) Canceled after 0s
- Add phone-dsp.openrc to initialize Hexagon DSP, rmtfs, pd-mapper, and ath10k_snoc - Update phone-battery-guard threshold to 80% with power supply node fallbacks - Enhance phone-cellular-setup with battery gate checks, RF locks, and unit tests - Include bringup, flashing, and inspection automation scripts for platina - Update candidate IPA v2.6 patches and package locks
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
# Setup robust USB gadget network service for postmarketOS userspace
|
||||
|
||||
mkdir -p /sysroot/usr/local/sbin
|
||||
cat << 'EOF' > /sysroot/usr/local/sbin/platina-usb-gadget
|
||||
#!/bin/sh
|
||||
# Platina USB gadget NCM bringup
|
||||
set -e
|
||||
CONFIGFS=/sys/kernel/config/usb_gadget
|
||||
|
||||
# Mount configfs if not mounted
|
||||
if ! mountpoint -q /sys/kernel/config; then
|
||||
mount -t configfs none /sys/kernel/config 2>/dev/null || true
|
||||
fi
|
||||
|
||||
mkdir -p $CONFIGFS/g1
|
||||
echo "0x18D1" > $CONFIGFS/g1/idVendor
|
||||
echo "0xD001" > $CONFIGFS/g1/idProduct
|
||||
|
||||
mkdir -p $CONFIGFS/g1/strings/0x409
|
||||
echo "Xiaomi" > $CONFIGFS/g1/strings/0x409/manufacturer
|
||||
echo "postmarketOS" > $CONFIGFS/g1/strings/0x409/serialnumber
|
||||
echo "Mi 8 Lite" > $CONFIGFS/g1/strings/0x409/product
|
||||
|
||||
mkdir -p $CONFIGFS/g1/functions/ncm.usb0
|
||||
mkdir -p $CONFIGFS/g1/configs/c.1/strings/0x409
|
||||
echo "USB Network" > $CONFIGFS/g1/configs/c.1/strings/0x409/configuration
|
||||
|
||||
if [ ! -L $CONFIGFS/g1/configs/c.1/ncm.usb0 ]; then
|
||||
ln -s $CONFIGFS/g1/functions/ncm.usb0 $CONFIGFS/g1/configs/c.1/
|
||||
fi
|
||||
|
||||
UDC=$(ls /sys/class/udc | head -1)
|
||||
if [ -n "$UDC" ]; then
|
||||
CURRENT=$(cat $CONFIGFS/g1/UDC 2>/dev/null || true)
|
||||
if [ "$CURRENT" != "$UDC" ]; then
|
||||
echo "$UDC" > $CONFIGFS/g1/UDC
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
chmod +x /sysroot/usr/local/sbin/platina-usb-gadget
|
||||
|
||||
# OpenRC init script
|
||||
cat << 'EOF' > /sysroot/etc/init.d/platina-usb-gadget
|
||||
#!/sbin/openrc-run
|
||||
description="Platina USB Gadget Network"
|
||||
|
||||
depend() {
|
||||
before networkmanager
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting Platina USB gadget network"
|
||||
/usr/local/sbin/platina-usb-gadget
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping Platina USB gadget network"
|
||||
echo "" > /sys/kernel/config/usb_gadget/g1/UDC 2>/dev/null || true
|
||||
eend $?
|
||||
}
|
||||
EOF
|
||||
chmod +x /sysroot/etc/init.d/platina-usb-gadget
|
||||
|
||||
# Enable in boot runlevel before networkmanager
|
||||
ln -sf /etc/init.d/platina-usb-gadget /sysroot/etc/runlevels/boot/platina-usb-gadget
|
||||
# Remove broken usb-moded
|
||||
rm -f /sysroot/etc/runlevels/default/usb-moded
|
||||
Reference in New Issue
Block a user