Commit Graph

130 Commits

Author SHA1 Message Date
Xavier Del Campo
6b2f0e8fbd at.c: fix misleading g_message 2021-10-02 13:59:22 +02:00
Arnaud Ferraris
082cf996d1 Use a more meaningful message on AT send failure 2021-10-02 13:58:32 +02:00
Xavier Del Campo
5102902692 at_send_command: call write(2) in a loop
write(2) might return less than expected due to various reasons.
Therefore, unless we are dealing with a critical error, it must be
called in a loop until all bytes are written.
2021-10-02 13:58:29 +02:00
Arnaud Ferraris
5c61d41090 Merge branch 'gnss_upload_doublefree' into 'master'
gnss: fix double free introduced by !29

See merge request mobian1/devices/eg25-manager!33
2021-09-30 23:19:57 +00:00
ArenM
1a65947176 gnss: fix double free introduced by !29
!29 changed the url varible in fetch_assistance_data to use g_autofree,
but didn't remove all calls to free it.
2021-09-30 14:23:21 -04:00
Arnaud Ferraris
3d29617977 Merge branch 'gnss_cleanup' into 'master'
Fix various small issues in the gnss assistance data upload code

Closes #20

See merge request mobian1/devices/eg25-manager!29
2021-09-29 21:05:08 +00:00
ArenM
36ac57b627 gnss: Gracefully handle failure to access xtra data file 2021-09-29 15:24:33 -04:00
ArenM
ee10cafa00 gnss: flush tmp_file after downloading gpsOneXtra data 2021-09-29 14:37:23 -04:00
ArenM
2fcb5852ae gnss: better error handling and messages when fetching data
This will print the error message from curl instead of just the http
status code if downloading gpsOneXtra data fails. It also adds checks
for other errors that are likely to occur.
2021-09-29 14:37:23 -04:00
Arnaud Ferraris
86372093d7 Merge branch 'gnss-disable-after-fetch' into 'master'
gnss: disable GPS only after fetching assistance data

Closes #21

See merge request mobian1/devices/eg25-manager!32
2021-09-29 07:33:34 +00:00
Arnaud Ferraris
34ec02cd34 gnss: disable GPS only after fetching assistance data
Fixes #21
2021-09-29 01:31:54 +02:00
Arnaud Ferraris
3f4dd9ac79 Merge branch 'snprintf' into 'master'
at.c: use snprintf(3)

See merge request mobian1/devices/eg25-manager!28
2021-09-28 21:31:53 +00:00
Xavier Del Campo
6f91389496 at_send_command: improve logging when snprintf(3) fails 2021-09-28 23:25:19 +02:00
Xavier Del Campo
771e9f8316 at_send_command: call at_next_command on failure 2021-09-28 23:17:25 +02:00
Xavier Del Campo
9e0d97d2e2 at.c: use snprintf(3)
snprintf(3) is preferred over insecure sprintf(3) in order to avoid
buffer overrun vulnerabilities.
2021-09-28 22:53:54 +02:00
ArenM
593db8aa67 gnss: include error messages directly from curl
This will print the error message from curl instead of just the http
status code if downloading gpsOneXtra data fails. This also removes the
need to check to check the size of the file curl downloaded.
2021-09-28 16:48:11 -04:00
ArenM
ad1d6e5d3e gnss: increase upload timeout to 10 seconds
The timeout for QFUPL defaults to 5 seconds which is about how long it
takes to upload data under ideal circumstances.

I'm not sure if this will actually have an effect, the docs say
"<timeout> The time waiting for data to be inputted to USB/UART. The
default value is 5. Unit: s." which could be the time before the first
byte is received.
2021-09-28 16:48:11 -04:00
Arnaud Ferraris
2bf63376d7 Merge branch 'conditional-modemmanager' into 'master'
gnss: Support using ofono when compiled with HAVE_MMGLIB

Closes #16

See merge request mobian1/devices/eg25-manager!26
2021-09-27 18:01:26 +00:00
ArenM
6177c7167c gnss: use sendfile to upload xtra data
This should make the data upload much faster because it handles
incomplete writes better, and because it the kernel copies the data
between the files directly, and it doesn't get sent to userspace and
back.
2021-09-27 13:57:57 -04:00
ArenM
750c41cbb5 gnss: rearrange enable_mm_gnss so it doesn't noop 2021-09-27 13:57:57 -04:00
Arnaud Ferraris
0d2b0e326a Merge branch 'gnss-upload-failure' into 'master'
gnss: properly clean temporary file before downloading assistance data

Closes #17

See merge request mobian1/devices/eg25-manager!27
2021-09-27 17:51:22 +00:00
ArenM
f7c655c297 gnss: Support using ofono when compiled with HAVE_MMGLIB 2021-09-12 17:56:45 -04:00
Dylan Van Assche
41511cbc5f gnss: truncate temporary file before download
A temporary file is used to download the GNSS assistance data.
It's created and truncated at initialization, but not truncated
when a re-upload is necessary (when data expires).
This causes to corrupt the GNSS assistance data if the new downloaded
data is smaller than the previous download.
2021-09-07 09:02:48 +02:00
Dylan Van Assche
8913300997 gnss: open temporary file as read/write
Opening as write-only may cause undefined behavior when reading the file
2021-09-07 07:28:34 +02:00
Dylan Van Assche
7b96296938 at: fix indentation 2021-09-03 21:33:05 +02:00
Arnaud Ferraris
c11f68f402 meson.build: release v0.4.0 0.4.0 2021-09-01 00:40:38 +02:00
Arnaud Ferraris
e6df81778e Merge branch 'handle-sim-unlock' into 'master'
gnss: handle locked SIM

See merge request mobian1/devices/eg25-manager!25
2021-08-12 10:17:02 +00:00
Dylan Van Assche
ef94492b30 gnss: handle locked SIM
ModemManager Location service is only available after SIM unlock
and network registration.
Track service separately to avoid an assert error and crashes.
GNSS assistance data is uploaded when the service becomes available.
2021-08-12 11:19:45 +02:00
Dylan Van Assche
75570e45da gpio: extend softsleep wake time
50ms is way to short for the Quectel firmware to react, increase to 200ms
2021-08-12 11:19:21 +02:00
Arnaud Ferraris
34c3b19f70 Merge branch 'modem-power-cfgs' into 'master'
config: synchronize with modem-power

See merge request mobian1/devices/eg25-manager!18
2021-08-11 13:43:06 +00:00
Dylan Van Assche
10ec1119fb at: fast/poweroff is only available in newer firmware versions
Do not retry the AT command of the fast/poweroff setting as it may not be supported by the firmware
2021-08-11 12:58:06 +02:00
Dylan Van Assche
898c0dc79c config: synchronize with modem-power
We cannot assume default factory values if other drivers change them
2021-08-11 12:56:42 +02:00
Arnaud Ferraris
6b3bc5660a Merge branch 'gps-support' into 'master'
gnss: GNSS assistance support

Closes mobian1/issues#253 and #2

See merge request mobian1/devices/eg25-manager!15
2021-08-10 20:58:26 +00:00
Arnaud Ferraris
128483354b udev: remove reset quirk
It seems to work just fine with MM's quick suspend/resume.
2021-08-10 22:27:07 +02:00
Dylan Van Assche
9cfe782f74 gnss: add GNSS assistance support
Automatically fetch the GNSS assistance data from the Web
to heavily reduce the time to acquire a GNSS lock by uploading
the assistance data to the modem.
This feature is optional and can be disabled in the configuration
as people may prefer to not download the assistance data from
the Quectel/Qualcomm servers.
Also configure the GNSS engine to optimize the performance
and power consumption.
2021-06-21 07:54:39 +02:00
Dylan Van Assche
5da7c88fc4 at: allow custom callbacks for AT command response processing 2021-06-21 07:53:44 +02:00
Dylan Van Assche
dac50e34eb at: log expected result before setting it to NULL
Otherwise the log contains NULL instead of the expected value, making it hard to debug
2021-06-21 07:53:39 +02:00
Dylan Van Assche
9646e0e8df at: make next_at_command, send_at_command, process_at_result, and append_at_command public methods
Allows other modules to send AT commands as well
2021-06-21 07:53:33 +02:00
Dylan Van Assche
9c4a934a51 at: g_free doesn't require NULL checking
From the docs: If mem is NULL it simply returns, so there is no need to check mem against NULL before calling this function.
2021-06-21 07:53:28 +02:00
Arnaud Ferraris
f2593b62b1 Merge branch 'soft-sleep-runtime' into 'master'
at: wake only when sending AT commands

Closes #12

See merge request mobian1/devices/eg25-manager!21
2021-06-17 09:35:39 +00:00
Arnaud Ferraris
73fb60e0ad Merge branch 'fix-parallel-build' into 'master'
Fix parallel build issue

Closes #14

See merge request mobian1/devices/eg25-manager!22
2021-06-17 09:34:01 +00:00
Natanael Copa
63ba5e2d60 Fix parallel build issue
Tell meson that the generated gdbofono headers are needed at compile
time.

fixes https://gitlab.com/mobian1/devices/eg25-manager/-/issues/14
2021-06-03 17:51:57 +02:00
Dylan Van Assche
e690e2a17d at: wake only when sending AT commands
Allow the modem to enter soft sleep when
we don't talk to the modem using AT commands.
This was already the case in suspend, but
not during runtime. By only waking the modem
from soft sleep when we need to send
an AT command, we can save some power.
2021-05-23 20:13:16 +02:00
Arnaud Ferraris
64145acbae Merge branch 'mm-cleanup' into 'master'
mm-iface: clean out modem_iface if mm disappears

See merge request mobian1/devices/eg25-manager!17
2021-04-15 15:48:02 +00:00
Bhushan Shah
705950bb39 mm-iface: clean out modem_iface if mm disappears
otherwise we will be stuck in state where restarting of mm will not
reset the modem_iface and it will loop through hard resetting modem
2021-04-15 11:08:06 +05:30
Arnaud Ferraris
73e16f7699 meson.build: release version 0.3.0 0.3.0 2021-04-09 11:29:26 +02:00
Arnaud Ferraris
3d21b0fc9e Merge branch 'direct-udev' into 'master'
udev: use the udev rules directly to set attr

See merge request mobian1/devices/eg25-manager!12
2021-04-09 09:23:51 +00:00
Bhushan Shah
0d46f42d78 udev: match only USB device and not USB interfaces
Interfaces can not have a power control, only usb devices.
2021-04-09 14:39:53 +05:30
Arnaud Ferraris
1fd9d7d634 Merge branch 'no-urc-cache' into 'master'
config: drop URC cache

Closes #9

See merge request mobian1/devices/eg25-manager!14
2021-04-09 09:08:22 +00:00
Dylan Van Assche
d665ea9639 config: drop URC cache
In some internal discussions between me,
the ModemManager maintainer and a Quectel engineer,
the URC cache we use is unnecessary.
I did some testing and removed the URC cache
from the configs and it works reliable without affecting
the functionality.
2021-04-09 10:35:27 +02:00