Commit Graph

32 Commits

Author SHA1 Message Date
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
Richard Hughes
c5384e9173 Allow aborting early when using fu_archive_iterate() 2019-11-08 09:30:09 -06:00
Aleksander Morgado
0066195a2c modem-manager: increase re-enumeration delay to 20000ms
The default of 10000ms was a bit too close to the real time seen in
e.g. the DW5821e/eSIM.
2019-11-07 21:34:35 +00:00
Richard Hughes
6e3e62bee8 Use fu_common_string_append_kv() in subclassed device
Also define the indent level in the the ->to_string vfunc so we can correctly
print client devices in all cases.
2019-08-14 16:48:37 +01:00
Richard Hughes
7afd7cba0d Use FuFirmware as a container for firmware images
In many plugins we've wanted to use ->prepare_firmware() to parse the firmware
ahead of ->detach() and ->write_firmware() but this has the limitation that it
can only return a single blob of data.

For many devices, multiple binary blobs are required from one parsed image,
for instance providing signatures, config and data blobs that have to be pushed
to the device in different way.

This also means we parse the firmware *before* we ask the user to detach.

Break the internal FuDevice API to support these firmware types as they become
more popular.

This also allows us to move the Intel HEX and SREC parsing out of the dfu plugin
as they are used by a few plugins now, and resolving symbols between plugins
isn't exactly awesome.
2019-08-08 13:10:57 +01:00
Richard Hughes
ebe1d43122 modem-manager: Never set NULL device name 2019-05-24 12:57:56 +01:00
Richard Hughes
dfa9e11bb2 Allow handling FORCE for devices that subclass FuDevice
Pass FwupdInstallFlags down to the vfunc to allow us to check the flags when
parsing the firmware and updating the device.
2019-05-05 15:29:00 -05:00
Richard Hughes
5079f26f0e Never guess the version format from the version string
This leads to madness, as some formats are supersets of the detected types,
e.g. 'intel-me' is detected as 'quad' and 'bcd' is detected as 'pair'.

Where the version format is defined in a specification or hardcoded in the
source use a hardcoded enum value, otherwise use a quirk override.

Additionally, warn if the version does not match the defined version format
2019-04-30 09:25:41 +01:00
Aleksander Morgado
8a1dce9472 modem-manager: increase the timeout to wait for modem after uninhibited
The timeout to wait for the modem after being uninhibited was until
now exclusively to cover the port probing time, because the device
would be already available and ready to be used as soon as the
inhibition was removed.

With the change to include carrier config selection as part of the
fwupd upgrade process, the time to wait for the modem after being
uninhibited should now cover a full reboot of the module, and so the
original timeout of 45s could be a bit tight under some circumstances
(e.g the MM device probing logic is quite slow when there is no SIM
card detected by the module).

We increase this timeout to a much safer value of 120s, which is
extremely long for most cases, but should also be enough to cover even
the worst case scenario.
2019-04-09 07:54:46 -04:00
Aleksander Morgado
ffb8fd5edc modem-manager: implement qmi pdc active config selection as attach()
When we install the MCFG carrier config files with QMI PDC, we were
not explicitly selecting one, and that would end up reporting the
"DF" (default) config is in use. Instead, we should explicitly select
the carrier configuration that we were using before the firmware
upgrade operation.

For example, if the device originally was running with the Vodafone
specific carrier configuration (e.g. T77W968.F1.0.0.3.7.VF.009) and we
trigger the upgrade to the next available firmware associated to
the Vodafone carrier (e.g. T77W968.F1.0.0.3.8.VF.009), we would want
the device to boot with the Vodafone carrier config selected, instead
of booting without any config selected (T77W968.F1.0.0.3.8.DF.009).

This also fixes several upgrade problems detected by fwupd, because it
may end up complaining that the target firmware that was selected to
be installed (e.g. VF variant) is not the one actually reported by the
device after the upgrade (e.g. DF variant).

The selection of which is the config to activate is based on mapping
the mcfg file name with the firmware version reported by the module
before the upgrade. E.g. if the VF variant is reported by the module
(T77W968.F1.0.0.3.7.VF.009), fwupd will look for a MCFG file named
with the "mcfg.VF." prefix.
2019-04-09 07:54:46 -04:00
Aleksander Morgado
fc8093626c modem-manager: implement support for qmi-pdc
If a device reports that qmi-pdc is supported (e.g. DW5821e that
supports both fastboot and qmi-pdc), we'll end up first running the
fastboot installation before doing the qmi-pdc installation procedure.

These changes also make sure that the MM device inhibition is kept for
as long as the whole process is ongoing. Only after the last method is
run, the inhibition will be removed.

In order to handle devices being exposed in the system while the MM
inhibition is in place, e.g. to be able to run qmi-pdc after fastboot,
a simple udev based watcher is included, which will take care of
creating the FuMmDevice that is not associated to any modem currently
exposed by MM, but that shares all the details of the original device.

This new logic assumes that the devices don't change their USB layout
during a firmware upgrade, which is not a very good assumption, but it
works for the case at hand. If this is not the case, we may need to
end up doing some custom AT port probing instead of relying on the
original one reported by MM being still valid (note that we don't rely
on the device name, as that may change if some other device is plugged
in the system while we're doing the update, we rely on the USB
interface number).
2019-02-27 16:09:13 +00:00
Richard Hughes
ffa3b84706 Add a plugin to support ModemManager hardware 2019-02-27 16:09:13 +00:00