204 Commits

Author SHA1 Message Date
Egor Shestakov
0d5117d4e3 set proper version 2025-01-14 18:11:11 +07:00
Arnaud Ferraris
9f8ae70cba gitlab-ci: add static analysis check
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.
2024-11-12 13:10:43 +01:00
Arnaud Ferraris
f978b775e0 src: fix issues reported by clang-tidy
Some of those are simply ignored as they're false positives.
2024-11-12 13:10:43 +01:00
Arnaud Ferraris
2c311b9022 add clang-tidy configuration
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.
2024-11-12 13:10:43 +01:00
Arnaud Ferraris
c785f7cb8d add gitlab CI pipeline
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
2024-11-12 13:10:43 +01:00
Arnaud Ferraris
9f6178dafd src: format using clang-format 2024-10-30 12:01:46 +01:00
Arnaud Ferraris
57142c2c11 add clang-format configuration
This will ensure our coding style is more clearly defined and allow
contibutors to auto-format their code, bringing some more consistency.
2024-10-30 11:59:45 +01:00
Aren Moynihan
99aa7e2bf7 gpio: remove handling of W_DISABLE pin
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.
0.5.2
2024-10-28 16:08:37 -04:00
Aren Moynihan
ce0fc25892 at: don't clear the resetting state on sequence end
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.
2024-10-28 12:48:08 -04:00
Aren Moynihan
ec96153b0f at: fix indentation
A few tabs slipped in here, convert them to spaces.
2024-10-28 12:47:24 -04:00
Arnaud Ferraris
b000a75238 meson.build: release version 0.5.1 0.5.1 2024-10-28 09:37:49 +01:00
Aren Moynihan
541aa00198 gpio: disable airplane mode when starting the modem
I'm not sure why this was being done when disabling the modem, move it
to the powerup sequence for more consistency.
2024-10-21 16:54:58 -04:00
Aren Moynihan
b53702ad0b manager: modem_reset: fix file descriptor leek
fd wasn't being closed if the write failed. Theoretically if a system
with an unstable modem ran for long enough, this could bring down
eg25-manager.
2024-10-21 16:54:58 -04:00
Aren Moynihan
1482899888 manager: reset using gpio pins if the mode is unresponsive
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.
2024-10-21 16:54:58 -04:00
Aren Moynihan
c4b3b75047 manager: always set the reset line when exiting
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.
2024-10-04 17:11:26 -04:00
Aren Moynihan
3c5d455f20 gpio: toggle the RESET_N pin before booting the modem to ensure it is actually off 2024-10-04 17:08:45 -04:00
Arnaud Ferraris
1acd15ca2f src: gnss: fix build on 32-bit architectures
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.
2024-08-27 11:01:08 +02:00
Arnaud Ferraris
012c09e630 meson.build: release version 0.5.0 0.5.0 2024-08-27 09:45:45 +02:00
Arnaud Ferraris
40623d1572 src: gpio: small cleanups following the port to libgpiod 2.x 2024-08-27 09:44:52 +02:00
marcin
93bdfbdfa2 libgpiod 2.0: specify that we need at least libgpiod 2.0 2024-05-13 23:19:28 +02:00
marcin
bc5a25b17e gpio: libgpiod 2.0: port gpiod_line_{get,set}_value 2024-05-13 23:16:35 +02:00
marcin
b1bb871eb7 gpio: libgpiod 2.0: port gpiod_chip_num_lines 2024-05-13 23:16:35 +02:00
marcin
88e85ae7c2 gpio: libgpiod 2.0: port gpio_get_{input,output}_line 2024-05-13 23:16:27 +02:00
marcin
b8ff1ef3d4 gpio: libgpiod 2.0: port gpiod_chip_open_by_label 2024-05-13 23:02:58 +02:00
Arnaud Ferraris
e7790f941c meson.build: release version 0.4.6 0.4.6 2022-11-01 15:26:17 +01:00
ArenM
6b41ae6b3b udev rules: fix detection of community firmware
`!=` 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"
2022-10-24 19:07:00 -04:00
Arnaud Ferraris
5b4f9bcc12 meson.build: release version 0.4.5 0.4.5 2022-09-19 02:09:51 +02:00
joerg
2218a908ab replace DRIVER w/ DRIVERS in 80-modem-eg25.rules 2022-09-19 02:08:13 +02:00
Arnaud Ferraris
be6a924f8d meson.build: release version 0.4.4 0.4.4 2022-07-26 12:27:59 +02:00
Arnaud Ferraris
34472a5cff udev: allow different attribute values for the community firmware
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.
2022-06-30 02:02:50 +02:00
Arnaud Ferraris
ee70cf7d2f meson.build: release version 0.4.3 0.4.3 2022-02-19 15:17:40 +01:00
Arnaud Ferraris
0e2311fb36 Rename executable to eg25-manager
This brings more consistency with how other components are named
(repo, package, service file, manpages...).
2022-02-19 15:17:27 +01:00
Arnaud Ferraris
5e4c797695 meson: bump minimum version
`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.
2022-02-19 15:05:31 +01:00
Arnaud Ferraris
be1ae18592 Move manpages to doc/ subfolder 2022-02-19 15:02:43 +01:00
Arnaud Ferraris
19eb488e29 gpio: fix init for BH edition PinePhone
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.
2022-02-19 13:50:41 +00:00
ArenM
a3c51fc513 Add manpages for eg25-manager and it's config file 2022-02-18 18:54:47 -05:00
Arnaud Ferraris
75400fb9c0 data: add USB vendor/product IDs to all configs
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.
2022-02-07 12:43:49 +01:00
Arnaud Ferraris
97b1878ebc manager: disable reset timers once reset sequence starts
`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.
2022-02-07 12:43:49 +01:00
Arnaud Ferraris
9e6bccdf37 udev: use USB vendor/product ID to determine behavior
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.
2022-02-07 12:43:49 +01:00
Arnaud Ferraris
df79247821 manager: populate USB vendor/product ID's with default values
We'll need those in the `udev` module, but never made it a mandatory
config option. This commit makes sure those values are properly filled
in.
2022-01-04 15:24:01 +01:00
Dylan Van Assche
61c89a003a udev: cancel reset if modem is already back
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.
2022-01-04 14:41:54 +01:00
Arnaud Ferraris
9cf51b9529 pinephone-pro: switch to 16K audio
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.
2021-12-24 15:14:43 +00:00
Arnaud Ferraris
50b4c00c16 data: add 'monitor_udev' parameter to existing configs
We disable dev monitoring only for the PinePhone Pro, it remains enabled
for all variants of the OG PinePhone.
2021-12-24 15:14:43 +00:00
Arnaud Ferraris
fedce7298b manager: start udev monitoring module conditionally
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).
2021-12-24 15:14:43 +00:00
Rafael Diniz
8665f8a4a6 Fix compile error when not using Modem Manager. 2021-12-23 21:12:24 +03:00
Kai Lüke
88c68b9933 suspend: actually check if the modem is found before resetting
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
2021-12-15 22:47:40 +00:00
Arnaud Ferraris
a91bc71e23 meson.build: release version 0.4.2 0.4.2 2021-12-08 18:21:48 +01:00
Arnaud Ferraris
b21c4b0fa4 data: add PinePhone Pro config
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).
2021-11-27 13:12:17 +01:00
Arnaud Ferraris
abf60b793a gpio: make more generic
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.
2021-11-24 01:34:14 +01:00
Arnaud Ferraris
f8b3e28434 config: add config_get_table helper function 2021-11-24 01:20:54 +01:00