Similar to the formatting check job, take advantage of the `clang-tidy`
configuration we just created to add a new job running this tool.
Running `clang-tidy` requires the following:
* build dependencies must be present on the system so it can resolve the
includes
* the build folder must be configured as it relies on the
`compile_commands.json` to get build flags (such as the include paths)
This could be run in the `build` job, but it would make it harder to
understand the actual underlying issue, so this is executed as a new,
separate job, re-using the artifacts from the `build` job.
This will allow us to run a static analysis tool, catching the most
obvious issues (use-after-free, potential NULL dereference...) and
(hopefully) increasing this software's overall robustness.
The current pipeline (from Mobian) just doesn't work, we should get to
a more efficient, simpler one.
With the `clang-format` config now in place, this pipeline has 2 jobs:
* ensure the code is properly formatted
* run a test build to make sure it won't break
The PinePhone has circuitry that makes this pin active-high, but the
PinePhone Pro doesn't appear to, which means we would need read active
high / active low from the config file. Since the modem works fine
without setting this pin, remove the logic to handle the W_DISBALE pin.
If the reset sequence fails, we don't want to transition to the powered
state, instead we should stay in the resetting state so we eventually
timeout and try a gpio reset. If the reset command succeeds the modem
will eventually send RDY and transition the state to STARTED.
Since this might take longer to change the modem state, add 15 seconds
(for a total of 45) to the at reset timeout just in case. It looks like
the modem typically takes about 20 between sending "AT+CFUN=1,1" and
receiving "RDY", so this should be plenty.
If the modem doesn't respond to the at reboot sequence, this will
attempt reboot the modem using both the power pin and then the reset pin
in case that doesn't work.
This splits the logic from gpio_check_poweroff into two separate
functions, allowing the caller more control over when the reset line is
asserted to force the modem to turn off.
Previously if the modem didn't respond to the power key sequence in
quit_app, gpio_check_poweroff wouldn't set the reset pin, and
eg25-manager could leave the modem running after exiting.
It seems `off_t` is now 64-bits wide on 32-bit architectures, so using
`glong` causes a build failure in this case. Switch to using the correct
type from the `sendfile()` prototype to fix this.
`!=` doesn't seem to be the exact inverse of `==`. To prove this I added
the following to the udev rules. On a system with the community firmware
both COMM_FW and NOT_COMM_FW were set to true, with the quectel firmware
only NOT_COMM_FW was true.
ATTRS{serial}=="community_fw", ENV{COMM_FW}="true"
ATTRS{serial}!="community_fw", ENV{NOT_COMM_FW}="true"
When using the community-maintained firmware, some attributes need to be
set with different values than what works best with the stock firmware:
this is the case of the `power/control` attribute which should be set to
"on". Similarly, on the PPP `power/persist` should be set to "1".
This commit reworks the udev rules so we can differentiate between
firmwares and host devices.
`doc/meson.build` used currently-deprecated functions. Replace those
with the proper alternatives, which were introduced in a newer meson
version than our requirement. As a consequence, bump minimal version.
BH PinePhone don't have the modem's `STATUS` pin connected to the SoC,
and as such require using `libusb` for checking the modem power state.
We didn't handle this case previously due to lack of on-device testing,
causing BH phones to fail with newer versions.
This patch ignores the `status` GPIO for devices relying on `libusb`,
which are only pre-CE PinePhones.
PP 1.2 and PPP configs were lacking this parameter. Although it's not a
problem as `eg25-manager` will then use a default value, adding them
won't harm and make them more consistent with other config files.
`modem_reset()` can be called from multiple places, both tied to a
specific timer. In order to prevent calling this function multiple times
in a row, disable all related timers as soon as we enter this function.
When going into firmware upgrade mode, the modem comes back with
different IDs than in normal use. We should make sure we cancel the
reset sequence when that happens, and not start a new one.
Cancel reset if modem is back before reset sequence is started.
When upgrading the modem through fwupd, it will enter fastboot.
Therefore, it disappears from the USB bus for a few ms.
However, the eg25-manager considers this as an issue and
resets the modem a bit later during the upgrade process.
To avoid this, cancel the reset sequence if the modem is already
back before the reset sequence is started. This will take less than 3
seconds.
As the modem is connected to a dedicated audio codec, we can select any
sample rate. Let's go for 16K as it should improve call audio quality.
Note: the bitclock's frequency is left untouched due to a bug in the
EG25 kernel, so we can't take advantage of the recommended higher
frequency.
The problem addressed by monitoring the modem status through udev seems
tied to the specific USB controller used by the A64. On RK3399 devices,
this quirk is apparently unneeded, and actually harmful as it resets the
modem USB connection while ModemManager is already configuring it.
This commit adds an optional config parameter for disabling this module
(enabled by default).
The timeout was meant to give more time to find the modem, yet the
callback didn't actually check if it came back but blindly issued a
reset.
Add a check to the callback to see if the modem was found and only
reset if not.
Fixes https://gitlab.com/mobian1/devices/eg25-manager/-/issues/28
The PinePhone Pro uses the same EG25 modem as the OG PinePhone, but with
a different SoC. It also uses an ALC5616 audio codec directly hooked up
to the modem (which is I2S master in this case).
The config is therefore almost identical to the PinePhone rev1.2 except
for the gpios, UART port used and `AT+QDAI` config (to account for the
different audio setup).
Instead of assuming we're running on the PinePhone (and therefore
hardcoding gpiochip labels and line numbers), make all of those
configurable. Legacy config files will still be parsed as long as they
lack the `chips` key.
Existing config files are also updated to match the new config format.