Please note this file may only work on A06 (and prehaps A04 also) models. CM4 models is using a different script so this systemd unit file need to adjusted accordingly to work on CM4 model.
uConsole is a nice machine that made by ClockworkPi, which is having an optional LTE module. It came with a shell script pre-installed to manage LTE module's power. But it requires user action to enable, everytime. This thing is the solution for LTE module automatic start on boot.
uConsoleLTE.service
is a systemd unit file that being translated from the included shell script uconsole-4g
in the uConsole A06 system image.
This unit file can power on and safe power down the LTE module inside uConsole A06 model.
Provided ModemManager.service
is a modified service unit file of Modem Manager, which added BindsTo
directive to allow Modem Manager to start and stop with LTE module service.
If LTE module powered on before Modem Manager started, most of time Modem Manager will have issue detecting the modem. The reason is simple: The USB UART of LTE module came up earlier than the LTE module became ready, and Modem Manager detected the port early, so Modem Manager timed out on port detection, and it just give up and never try again. A service restart is required to work. So this BindTo
can make sure Modem Manager is only started if LTE module is enabled, and the Before
directive in uConsoleLTE.service
make sure Modem Manager is started after LTE Module is powered on and ready.
- Put those files in
/etc/systemd/system/
directory with their filename accordingly. - run
sudo systemctl daemon-reload
. - run
sudo systemctl start uConsoleLTE.service
to start modem. - If you want it automatically start on boot, run
systemctl enable uConsoleLTE.service
.
This service unit can delay the shutdown up to about 30s.
Because systemd doesn't have a way to ignore the service stop on shutdown, every time system goes shutdown it will safely power off the modem first, which is actually a good thing I guess.
Dude, this is a such simple thing... Just copy already!
If you insist on one, fine, WTFPL 2.0.