Commit Graph

101 Commits

Author SHA1 Message Date
Richard Hughes
be271f8213 modem-manager: Fix a small leak and critical warning on failed update 2022-05-26 10:50:54 +01:00
Richard Hughes
061b377977 modem-manager: Fix one critical warning when updating 2022-05-26 10:50:54 +01:00
Richard Hughes
d3d7cfa816 Add plugin quirk keys earlier in the startup process
This allows creating the silo when starting the engine with custom
plugin keys such as WacomI2cFlashBaseAddr.

If we move the plugin initialization earlier then we don't get the
HwID matches, so we really do have to split this into a 4-stage startup,
e.g. ->load(), ->init(), ->startup() and ->coldplug().
2022-05-09 11:13:52 +01:00
Richard Hughes
45b1a0bbe3 modem-manager: Remove unused variable 2022-04-23 10:28:16 +01:00
Richard Hughes
035490d39e modem-manager: Remove the cache item and use a shadow device instead
Fixes https://github.com/fwupd/fwupd/issues/4394
2022-04-12 09:59:19 +01:00
Richard Hughes
7f6605cf8d Revert "modem-manager: uninhibit modem after upgrade"
This reverts commit e3b62e643b which
fixes a crash when updating devices.
2022-03-28 20:19:09 +01:00
Richard Hughes
17854099d0 modem-manager: Add signed-payload metadata for some Quectel devices 2022-03-28 08:47:02 +01:00
Richard Hughes
ed247d32b2 modem-manager: Use the correct icon name
The list is specified in https://lvfs.readthedocs.io/en/latest/metainfo.html
2022-03-24 13:05:23 +00:00
Richard Hughes
e8e94b5c63 modem-manager: Quirk a vendor name to be less shouty 2022-03-24 11:12:13 +00:00
Ivan Mikhanchuk
e3907a116e modem-manager: add Quectel EM05 firwmare update support
EM05 switches to the EDL mode over MBIM port, then uses
Sahara to load a firehose binary. The firmware is loaded to
the modem using Firehose protocol.
2022-03-22 14:26:49 +00:00
Ivan Mikhanchuk
6fa82b10bc modem-manager: add Sahara IO functions to Firehose 2022-03-22 14:26:49 +00:00
Ivan Mikhanchuk
27a68de8ee modem-manager: add Sahara protocol 2022-03-22 14:26:49 +00:00
Ivan Mikhanchuk
716a47db8c modem-manager: move firehose related functions to one 2022-03-22 14:26:49 +00:00
Ivan Mikhanchuk
ee71e5ffa9 modem-manager: fix fu_chunk padding in firehose 2022-03-22 14:26:49 +00:00
Ivan Mikhanchuk
387b797c6f modem-manager: add get_mbim_device method for MbimQdu 2022-03-22 14:26:49 +00:00
Richard Hughes
2085a2a1c3 modem-manager: Detect presence of modem-power driver
Quectel EG25-G modem in the Pine64 PinePhone and PinePhone Pro can be
booted with the eg25-manager (user space) or modem-power (kernel space).

We only support the eg25-manager for upgrading these modems.

Based on a patch by Dylan Van Assche <me@dylanvanassche.be>, thanks.
2022-03-02 13:36:19 +00:00
Mario Limonciello
661990ed98 Convert build system to use meson tristate features
tristate features will automatically disable if dependencies marked
as required are missing.

Packagers can manually override using `auto_features`.

Link: https://mesonbuild.com/Build-options.html#features
2022-02-28 08:34:48 -06:00
Richard Hughes
ccc897e574 modem-manager: Copy the AT retry behaviour in ModemManager
Fixes https://github.com/fwupd/fwupd/issues/4319
2022-02-23 07:14:24 +00:00
Richard Hughes
675c5f41a6 modem-manager: Assign the FuUsbDevice to the FuMmDevice
This allows protocol code like Sahara to use GUsb.
2022-02-16 16:07:23 +00:00
Richard Hughes
4b48b2ea27 trivial: Fix a warning in the latest clang release 2022-01-31 14:36:38 +00:00
Dylan Van Assche
b5077745a7 modem-manager: use version format from metadata
Some modems use a plain string as version while others use a
standardized version format. If such a format is provided by
the metadata, set it.
2022-01-30 20:01:52 +00:00
Richard Hughes
0264c29bda modem-manager: Only try to get the branch if there exists an AT port
Fixes https://github.com/fwupd/fwupd/issues/4190
2022-01-19 20:06:25 +00:00
Richard Hughes
4329ddbd76 modem-manager: Fix a segfault on startup for some MBIM-QDU devices
Works around https://github.com/fwupd/fwupd/issues/4190 although we
still need to find the root cause.
2022-01-19 13:46:05 +00:00
Dylan Van Assche
e3b62e643b modem-manager: uninhibit modem after upgrade
When fastboot is used, the modem is rediscovered through udev
after upgrading. However, the modem-manager plugin did not mark
the modem as unhibited with ModemManager. This resulted into
ModemManager not exposing the modem without restarting ModemManager or
rebooting the device.

Mark the modem as uninhibited and do not take ownership over the
plugin data as this caused segfaults.
2022-01-13 20:30:09 +00:00
Richard Hughes
e17a107ce1 trivial: Cast the g_signal_connect() object to allow static analysis
This is useful when using https://gitlab.freedesktop.org/tartan/tartan
2022-01-03 22:46:23 +00:00
Richard Hughes
2e99055d1e trivial: Add some more annotations for language bindings 2022-01-03 22:46:23 +00:00
Dylan Van Assche
9d7e4309a3 modem-manager: add firmware branch AT command for Quectel EG25-G
Alternative firmwares implement AT+GETFWBRANCH to get the current firmware branch
2021-12-29 14:33:02 +00:00
Dylan Van Assche
f0016cf11e modem-manager: add firmware branch support
Some modems such as the Quectel EG25-G have alternative firmwares available.
Read the firmware branch if supported by the firmware and set it,
if not, fall back to the default branch.
2021-12-29 14:33:02 +00:00
Dylan Van Assche
e0f7087bfb modem-manager: log when modem is added
Modem removals are logged, but nothing is logged when a modem is added.
2021-12-26 11:10:13 -06:00
Dylan Van Assche
f6833f96c3 modem-manager: add context for fu_mm_device_udev_new
After upgrading a modem, the FuContext was missing when the modem comes back
2021-12-20 10:02:36 +00:00
Dylan Van Assche
df3b139a0e modem-manager: require AC power
Updating modems is less risky when AC power is present.
2021-12-15 22:07:23 +00:00
Dylan Van Assche
90baeaabbc modem-manager: add Quectel EG25-G no response quirk 2021-12-14 22:46:04 +00:00
Dylan Van Assche
a489191c38 modem-manager: add support for AT fastboot detach commands without response
Normally each AT command is ended with either OK or ERROR,
but that's not the case for the Quectel EG25-G's AT command to enter fastboot.
As soon as AT+QFASTBOOT is sent, the modem switches to fastboot mode without replying OK.
2021-12-14 22:46:04 +00:00
Dylan Van Assche
3eead7aa60 modem-manager: add quirk for Quectel EG25-G
Allow fwupd to detect the switch between modem-manager and fastboot plugins
 as it appears under a different vendor and device ID.
2021-12-14 22:46:04 +00:00
Richard Hughes
e21fb7630a modem-manager: Set the context when the device is constructed 2021-12-13 15:21:43 -06:00
Richard Hughes
8fc8539146 trivial: Remove some unused variables 2021-12-10 16:00:07 +00:00
Richard Hughes
e87fc05ab9 Speed up the daemon startup by ~2% by doing dlsym much less
We were calling g_module_symbol() 2703 times, which is actually more
expensive than you'd think.

It also means the plugins are actually what we tell people they are:
A set of vfuncs that get run. The reality before that they were dlsym'd
functions that get called at pretty random times.
2021-11-09 12:02:07 +00:00
Jarvis Jiang
8d6dbd9009 modem-manager: Add the logic of inhibiting modemmanager device in mbim-qdu
It may make sense to have the modem not doing anything during the upgrade,
so the inhibition would make total sense.

Signed-off-by: Jarvis Jiang <jarvis.w.jiang@gmail.com>
2021-10-25 09:23:44 +01:00
Richard Hughes
1ff96eb4b3 Restore the ABI for fu_device_detach() and provide new symbols
Quite a few plugins are using a FuDeviceLocker to detach then attach in
the error path, and finding them isn't easy as we explicitly cast to a
FuDeviceLockerFunc.

For sanity, just provide both symbols so we can do the right thing in
both cases. It seems like a sensible thing to allow.

Fixes https://github.com/fwupd/fwupd/issues/3771
2021-09-17 16:35:21 +01:00
Richard Hughes
40cd18fa97 Allow using a per-device global percentage completion
It's actually quite hard to build a front-end for fwupd at the moment
as you're never sure when the progress bar is going to zip back to 0%
and start all over again. Some plugins go 0..100% for write, others
go 0..100% for erase, then again for write, then *again* for verify.

By creating a helper object we can easily split up the progress of the
specific task, e.g. write_firmware().

We can encode at the plugin level "the erase takes 50% of the time, the
write takes 40% and the read takes 10%". This means we can have a
progressbar which goes up just once at a consistent speed.
2021-09-13 14:28:15 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Jarvis-Jiang-G
cc388dba5a modem-manager: Fix the report that failed to get device after update
Module may not have been re-probed and exposed in MM when the FW version was successfully obtained, which leads to the report that failed to get device after update. In fact, FW has been uodated successfully, it needs to add 150s to wait for the module to be re-probed and exposed in MM.

Signed-off-by: Jarvis Jiang <jarvis.w.jiang@gmail.com>
2021-08-09 10:19:45 -05:00
Richard Hughes
a5a978b3f6 Rename some confusing API
More than one person has asked about 'why call fu_plugin_update() for a
reinstall or downgrade' and I didn't have a very good answer.

The plugin API is not officially stable, and we should fix things to be
less confusing. Use the same verbs as the FuDevice vfuncs instead.
2021-08-06 19:49:53 +01:00
Thomas Deutschmann
bd6adc8beb modem-manager: Fix compiling with old versions of libxmlb
Closes: https://github.com/fwupd/fwupd/issues/3600
2021-08-04 18:16:18 +01:00
Mario Limonciello
798d1ed3ee trivial: update markdown for pre-commit style 2021-07-18 14:42:47 -05:00
Ivan Mikhanchuk
db8a9927f4 modem-manager: add firehose update method
Adds firehose update protocol, qcdm port handling, program file copy to the cache directory
2021-07-13 21:57:08 +01:00
Jarvis Jiang
6b79e9201d modem-manager: Add MBIM QDU support for firmware downloading in the MM plugin
Add the mbim-qdu support for firmware downloading, it will be used for T99W175 module of Foxconn.

Signed-off-by: Jarvis Jiang <jarvis.w.jiang@gmail.com>
2021-06-28 10:11:15 +01:00
Richard Hughes
bda57e8c9d modem-manager: Do not convert instance IDs to GUIDs manually
This already happens during setup, there shouldn't be a need to depend
on the private header to accomplish this.
2021-06-15 09:14:39 -05:00
Mario Limonciello
73cdf067ed trivial: fixup includes for a variety of plugins 2021-06-14 10:12:45 +01:00
Richard Hughes
b34b88226c modem-manager: Only shutdown the IO channel if it was created 2021-05-18 11:07:02 +01:00