The uconsole-4g-cm5 script seems overengineered and for some use cases too specific. For example, it seems to be completely unusable for non-systemd systems. It also seems to assume I want to restart modem manager, and other rather narrow assumptions.
The cm4 script is somehow way simpler, but doesn't work on a cm5 for me. However, here is what I found to work for the CM5 and I think something like this might make sense to provide as a simpler uconsole-4g-cm5 script:
#!/usr/bin/env sh
function tip {
echo "use mmcli -L to see 4G modem or not"
}
function enable4g {
echo "Power on 4G module on uConsole cm4"
gpioset -t0 -p2s -c "gpiochip0" "24=1"
gpioset -t0 -p2s -c "gpiochip0" "15=1"
sleep 5
gpioset -t0 -p2s -c "gpiochip0" "15=0"
echo "waiting..."
sleep 20
echo "done"
}
function disable4g {
echo "Power off 4G module"
gpioset -t0 -p1s -c "gpiochip0" "24=0"
gpioset -t0 -p5s -c "gpiochip0" "24=1"
gpioset -t0 -p20s -c "gpiochip0" "24=0"
sleep 5
echo "Done"
}
if [ "$#" -ne 1 ] ; then
echo "$0: enable/disable"
exit 3
fi
if [ $1 == "enable" ]; then
enable4g;
tip;
fi
if [ $1 == "disable" ]; then
disable4g
tip;
fi
(You may need to install libgpiod first, if you haven't. Most systems have it, even those that aren't based on Raspberry Pi OS.)
The uconsole-4g-cm5 script seems overengineered and for some use cases too specific. For example, it seems to be completely unusable for non-systemd systems. It also seems to assume I want to restart modem manager, and other rather narrow assumptions.
The cm4 script is somehow way simpler, but doesn't work on a cm5 for me. However, here is what I found to work for the CM5 and I think something like this might make sense to provide as a simpler
uconsole-4g-cm5script:(You may need to install
libgpiodfirst, if you haven't. Most systems have it, even those that aren't based on Raspberry Pi OS.)