eg25-manager v0.4.3
IMPORTANT: this release renames the executable to `eg25-manager` (added
dash). Make sure existing scripts are updated to reflect this change.
Changes:
* improve udev monitoring:
- filter based on vendor/product ID
- disable udev monitoring for the PinePhone Pro
* add manpages for `eg25-manager` and its configuration files
- this adds an optional build dependency on `scdoc`
* Fix build when not using ModemManager
* Fix GPIO module initialization for BraveHeart Edition PinePhones
* Various build system improvements (now requires meson >= 0.58.0)
`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.
Previously this code checked if the buffer was full after writing to it,
which meant that the buffer could overflow.
This checks for an overflow before copying into the buffer and only
copies the data that will fit.
Executing a reset each time the modem is unbound is a bit too extreme:
the modem sometimes recovers by itself and only needs a "soft" reset
sequence (unbind/bind).
This commit introduces a short timer (2s) so we the modem can settle in.
If reset fails after this time, the modem is probably completely broken,
or already rebooting, so we can safely issue a reset AT command.
`modem_reset()` could previously either fail silently, or fall back to
using AT commands without indicating what happened. This commit adds
informative messages and makes sure we fall back to resetting using AT
commands whenever we encounter an error.
By instructing sendfile() to send the whole content of the assistance
data at once results in a big data transfer (> 4kb) first followed by a
huge amount of small transfers (64 or 128b). This "overloads" the modem
which needs to process smaller chunks of data and have more time to do
so (experimentation shows that 1kb need 100ms for processing, or the
upload will subsequently fail).
This commit sets the transfer size to 256b and increase the timeout
between each transfer to 25ms.
If we clear QFUPL right after we finished the file transfer, we will
execute the following commands right away, leading to interleaved
replies from the modem (i.e. the reply to QGPSXTRATIME being received
with the notification of upload completion).
Keeping the command in the queue allows us to use the callback a second
time once the upload is complete and resume assistance data processing
accordingly.
After the modem send "RDY", other messages are received. With the
current implementation, this causes eg25-manager to mark the modem as
configured before it is even picked up by ModemManager. Adding an
additional status check helps preventing this issue.
If a user created a custom config file and we added new fields in a
newer version, `eg25-manager` will crash by assuming all config files
are complete and up-to-date.
Moreover, creating a custom config, even to change only one option,
required copying a complete default config file and then editing the
relevant field(s). This could lead to issues when upgrading, as default
values of fields unrelated to the user change could be modified and not
applied to the user config.
This patch addresses both these issues by:
* making sure at least one config file exists
* requiring only the "default" config file (the one under `/usr/share`)
to include all the required fields
* trying to use user config for each field, falling back to the default
config file if the field isn't present in the user config
* exiting with a meaningful error message in case the default config
file is missing a required field or section
That way, it will be possible to have a minimal user config file
containing only the field(s) needing a different value than the default
one, falling back to the values in the default config file.
Fixes#23