Commit Graph

61 Commits

Author SHA1 Message Date
Richard Hughes
4105768a01 Remove the 'common' prefix when parsing version numbers 2022-06-14 14:36:52 -05:00
Richard Hughes
067d7d8088 Split out the path helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
7f86ffab6f Split out the dump helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
3f77af3cd4 Split out the kernel helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
4b1313b406 Split out the GByte helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
9d33c29e92 Split out the string helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
dc91d59f8e Remove the recently added fu_progress_add_step_full()
Just break API instead.
2022-06-03 13:47:11 -05:00
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
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
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
716a47db8c modem-manager: move firehose related functions to one 2022-03-22 14:26:49 +00: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
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
Richard Hughes
2e99055d1e trivial: Add some more annotations for language bindings 2022-01-03 22:46:23 +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
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
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
Richard Hughes
e21fb7630a modem-manager: Set the context when the device is constructed 2021-12-13 15:21:43 -06: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
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
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
Aleksander Morgado
3417128704 modem-manager: add generic support for PCI based modems
No longer rely on the modems being USB based, we can also support PCI
based devices with the same protocols.
2021-05-01 15:43:38 +01:00
Richard Hughes
1981c63d58 Remove FuFirmwareImage and just use FuFirmware instead
This allows us to 'nest' firmware formats, and removes a ton of duplication.

The aim here is to deprecate FuFirmwareImage -- it's almost always acting
as a 'child' FuFirmware instance, and even copies most of the vfuncs to allow
custom types. If I'm struggling to work out what should be a FuFirmware and
what should be a FuFirmwareImage then a plugin author has no hope.

For simple payloads we were adding bytes into an image and then the image into
a firmware. This gets really messy when most plugins are treating the FuFirmware
*as* the binary firmware file.

The GBytes saved in the FuFirmware would be considered the payload with the
aim of not using FuFirmwareImage in the single-image case.
2021-03-09 21:14:12 +00:00
Richard Hughes
b3f9841924 Support more than one protocol for a given device
Devices may want to support more than one protocol, and for some devices
(e.g. Unifying peripherals stuck in bootloader mode) you might not even be able
to query for the correct protocol anyway.
2021-03-01 16:14:36 +00:00
Richard Hughes
078beafb2d Add a new internal flag to opt-in to GUID matching
It is far too easy to forget to set FWUPD_DEVICE_FLAG_NO_GUID_MATCHING for new
plugins, and without it it all works really well *until* a user has two devices
of the same type installed at the same time and then one 'disappears' for hard
to explain reasons. Typically we only need it for replug anyway!

Explicitly opt-in to this rarely-required behaviour, with the default to just
use the physical and logical IDs. Also document the update behavior for each
plugin to explain why the flag is being used.

This allows you to have two identical Unifying plugged in without one of them
being hidden from the user, at the same time allowing a HIDRAW<->USB transition
when going to and from bootloader and runtime modes.

This removes the workaround added in 99eb3f06b6.

Fixes https://github.com/fwupd/fwupd/issues/2915
2021-02-25 15:47:25 +00:00
Richard Hughes
eddaed0c11 Allow specifying more than one VendorID for a device
Asking the user for the UID mapping isn't working very well, as it requires lots
of manual handholding. It also doesn't work very well when the device vendor
does not actually have a PCI ID or if the vendor has split into two entities.

Just use the OUI address as an additional VendorID and match any of the device
IDs against any of the metadata-supplied values.
2021-01-04 22:30:20 +00:00
Aleksander Morgado
512685fcb8 modem-manager: validate firmware update method combinations
The plugin currently supports Fastboot and QMI/PDC methods, but given
that QMI/PDC is exclusively used for carrier config installations,
there is no need for QMI/PDC-only updates, so make sure that
combination is right away forbidden.

This validation will also be useful when adding additional update
methods, as we'll be able to clearly specify which are the
combinations expcted.
2020-11-29 07:08:05 +00:00
Aleksander Morgado
c0fb40b7e8 modem-manager: remove unused byte counts in QMI/PDC update logic 2020-11-29 07:08:05 +00:00
Aleksander Morgado
fab3ee97c7 modem-manager: make sure the correct interface number is used for QMI
The upgrade process requires that the USB interface layout is not
changed between upgrades, something that we require for AT and we also
require now for QMI. We store the USB interface number of the QMI port
as soon as the device is probed, and we use it to match the interface
number once the Udev based device is created.

squash! modem-manager: make sure the correct interface number is used for QMI
2020-11-29 07:08:05 +00:00
Mario Limonciello
bfd57c6ee1 trivial: modem-manager: chomp vendor string
Reading the sysfs file seemed to have also eaten the `\n` as mentioned
on a bug.

```
├DW5821e Snapdragon X20 LTE:
│     Device ID:           fa707b9af86ff44bc17316b6c3e5ea82aab3ce86
│     Summary:             Mobile broadband device
│     Current version:     T77W968.F1.0.0.4.2.GC.010
│     Vendor:              Dell Inc. (USB:0x413c
│     )
│     GUIDs:               64da2d58-8d1b-5e5b-b793-f88ba5a25a8f
│                          761d6124-0002-5185-b767-9adf67bf1a5e
│                          795e079d-093b-5503-aa59-35b832480e95
│     Device Flags:        • Updatable
```
2020-06-23 14:12:08 -05:00
Mario Limonciello
f7d83a2f45 trivial: modem-manager: fix a logic error 2020-06-23 08:44:21 -05:00
Mario Limonciello
50638657cc modem-manager: read the vendor ID directly from sysfs attribute
Fixes: #2209
2020-06-23 07:57:22 +01:00
Mario Limonciello
e2a77fc10b trivial: modem-manager: add a protocol for updating the devices 2020-06-23 07:57:22 +01:00
Richard Hughes
f50ff2c27e Decouple the version format from the version itself
If we say that the version format should be the same for the `version_lowest`
and the `version_bootloader` then it does not always make sense to set it at
the same time.

Moving the `version_format` to a standalone first-class property also means it
can be typically be set in the custom device `_init()` function, which means we
don't need to worry about *changing* ther version format as set by the USB and
UDev superclass helpers.
2020-02-25 14:00:09 +00:00
Aleksander Morgado
705f5b64e3 modem-manager: explicitly use plain version format
The devices managed by this plugin expose version strings that are to
be treated as plain ASCII and compared just as plain ASCII.
2019-11-13 17:41:22 +00:00