Commit Graph

4748 Commits

Author SHA1 Message Date
Richard Hughes
84781f41cf trivial: Fix a segfault when installing without PolicyKit 2020-10-16 15:25:27 +01:00
Richard Hughes
65698015ae Do not fix up the version on post-update mismatch
We already set a update error if the fu_common_vercmp_full() fails to match,
and trying to do anything else would just be papering over the issue.
2020-10-16 14:02:10 +01:00
Richard Hughes
0357881c42 elantp: Implement the ->reload action to get the new firmware version 2020-10-16 10:06:45 +01:00
Mario Limonciello
61ba02ae16 trivial: increase debugging for for fu-uefi-bootmgr.c
See #2169 for more context
2020-10-15 17:02:04 -05:00
Daniel Campello
edab096c64 trivial: Fix build error on build=standalone and polkit=true
This fixes error introduced by 11b71f4978
2020-10-15 14:05:23 -06:00
Richard Hughes
1c62adec69 Get the list of unique branch names for 'switch-branch' 2020-10-15 18:05:29 +01:00
Richard Hughes
88fdc59330 Set _HAS_MULTIPLE_BRANCHES when release differs from device
Enable switch-branch any time a branch other than the default exists.

Based on a patch by Evan Lojewski <github@meklort.com>, many thanks.
2020-10-15 18:05:29 +01:00
Richard Hughes
1f6a1520fb elantp: Fix three impossible to hit bugs spotted by Coverity
If somehow chk->data_sz is bigger than blksz then we would write past the end
of the allocated buffer.
2020-10-14 15:11:31 +01:00
Mario Limonciello
11b71f4978 Offer to compile daemon without polkit support
Based on a patch from Daniel Campello at
https://chromium-review.googlesource.com/c/chromiumos/third_party/fwupd/+/2354521
2020-10-14 07:58:16 -05:00
Richard Hughes
f27e19beac Parse the HEX version before comparing for equality
This fixes the error: 'Update Error: device version not updated on success,
0x00000002 != 0x0002' -- it seems a bit crazy to have to specify 32 bits of
zero digits in the firmware.metainfo.xml
2020-10-13 15:57:03 -05:00
Tomas Winkler
f994813858 contrib: fwupd.spec : install tests only when enabled.
Install tests in the rpm package only when tests are enabled.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
2020-10-13 11:51:19 -05:00
Richard Hughes
7bcb8d4385 Export FwupdPlugin so we can convey enumerated system errors to the end user
For instance, we can tell the user that UEFI UpdateCapsule is disabled in the
system firmware, or that efivarfs is not mounted. This is much better than
creating "dummy" devices which are really just hacks around the problem because
no better API existed. THe dummy devices cause as many problems as they solve.

Plugins have to set FWUPD_PLUGIN_FLAG_USER_WARNING if a warning should be shown
to the user, and only one warning will be shown of each failure type.

It is expected that GUI clients like gnome-software and gnome-firmware would use
this API to notify the user the localized message for why firmware updates are
not being shown.

Fixes https://github.com/fwupd/fwupd/issues/2456
2020-10-13 15:56:49 +01:00
Mario Limonciello
02d9d23f13 trivial: fix shutdown error on fwupdtool activate
EXIT_NOTHING_TO_DO needs to be caught by the shutdown script too.
Fixes: #2463
2020-10-12 09:06:30 -05:00
Richard Hughes
e8e7a16c2e trivial: Fix aarch64 Fedora build 2020-10-12 09:17:47 +01:00
Benson Leung
42f2e22dd2 cros-ec: Add support for quiche and gingerbread boards
Add quirks for PID 5048 and 5049, which are cros-ec devices
that update via USB endpoint. Notable about these two are
they support rw_sig, for RW region signature verification.
2020-10-11 07:34:49 +01:00
Benson Leung
343613954b cros-ec: Increase remove delay for reenumeration to 20s. 2020-10-11 07:34:49 +01:00
Benson Leung
e8fd2cdfa4 cros-ec: Restructure to allow RO update first
Our update flow prior to this was:
1. On detach, reboot to RO.
2. From Old RO, Update RW.
3. Reboot to New RW
4. From New RW, Update RO.
5. Reboot to finish

This flow has a flaw, which is that the Old RO may be buggy (especially
during development, before it's actually locked down and actually Read-Only).

This change will do the following instead:
1. On detach, do not reboot to RO if RO is writeable, and we are in RW
2. From old RW, Update RO
3. Reboot to new RO
4. From New RO, update RW
5. Reboot to finish.

This has a speed advantage as well, as we save one reboot cycle (2 vs 3).
2020-10-11 07:34:49 +01:00
Benson Leung
2c5558e51d cros-ec: Log error paths, and trigger flushes
In case of a failure during the bulk transfer sequence, flush out
before trying again.
2020-10-11 07:34:49 +01:00
Benson Leung
af07f32c0f cros-ec: Send a start message after the stay-in-ro
The extra command (stay-in-ro) consumes the start message, so we
need to issue another one before write firmware.
2020-10-11 07:34:49 +01:00
Benson Leung
c516724278 cros-ec: Set another write required if we immediate reset back into RO
As a result of the previous change, where we send an immediate reset to
devices in order to transition back to rw, we will end up reenumerating
as RO briefly, although the destination we wanted to get to was RW.

In that case, basically skip the write firmware step, set another write
required and allow the RO firmware to complete rw_sig and jump to the rw
partition.
2020-10-11 07:34:49 +01:00
Benson Leung
08c396b31c cros-ec: Send an immediate reset after jump to rw
Some devices don't do the jump, so an immediate reset is required to get us
into RW.
2020-10-11 07:34:49 +01:00
Benson Leung
b093de999a cros-ec: Fix reboot to RO sequence
Previously, we sent a 'stay-in-ro' subcommand when we are in
fu_cros_ec_usb_device_reset_to_ro, which is called from the detach phase,
in other words, we are currently sitting in RW.
This is incorrect, since stay-in-ro only interrupts an RO's
rw_sig process if it is in progress.

Instead, 'stay-in-ro' must be issued when the device reenumerates in RO,
immediately before the writing sequence starts. On devices that implement
rw_sig, they will briefly enumerate as RO before self-issuing a jump to RW
on the signature check being valid. In order to stay in RO to perform a RW
partition update, we must interrupt it as soon as we see the RO version
enumerate.
2020-10-11 07:34:49 +01:00
Richard Hughes
cc2f6aa1b2 Add fu_device_sleep_with_progress helper()
This makes the console a bit more helpful than just 'hanging'...
2020-10-11 07:34:00 +01:00
Érico Rolim
0651aeef24 Fix header names.
- <sys/poll.h> should be <poll.h>
- <sys/errno.h> should be <errno.h>
2020-10-10 12:33:56 +01:00
Érico Rolim
acd95c661b uefi: add configuration option for objcopy utility. 2020-10-10 12:32:13 +01:00
Evan Lojewski
44361fa14e bcm57xx: Improve reliability when flashing
- Use pci function 0 instead of 1 when flashing firmware.
  In certain situations, the BCM5719 NVM controller can lockup if
  a function other than 0 is used to read from NVM word-by-word like
  the kernel driver does.
- Fix APE_MODE offset in BAR[2] to enable proper resetting of the APE.
- Remove unnededed NVRam lock when resetting the APE.

Signed-off-by: Evan Lojewski <github@meklort.com>
2020-10-09 07:37:33 +01:00
Richard Hughes
4123885c81 bcm57xx: Add a plugin that can update the BCM5719 network adapter 2020-10-08 16:49:07 +01:00
jingle.wu
4f2cb4598c elantp: Modify firmware update flow
1. Check FW in bootloader mode, need send reset command to firmware.
 2. IAP Type register parameter is defind as how many bytes/page to be written.
 3. Write IAP Type function in detach function.
 4. Remove IAP Type function in setup function.
 5. Modify page format for i2c-device
 6. Modify firmware bin file size.
 7. Modify firmware update flow when the firmware in bootloader mode.
 8. Add another instance ID which corresponds to the IC type & module ID
   * `ELANTP\ICTYPE_09&MOD_1234`
 9. Add Lenovo ThinkPad X1 nano gen1 to elantp.quick
10. Add recovry device - lenovo thinkpad x1 nanao gen 1
11. Add elan touchpad device - vid:04f3 pid:314f
12. Set the firmware version when the firmware is incorrect.
2020-10-08 10:43:06 -05:00
Richard Hughes
f4c206d319 libfwupd: Do not export the HSI AppStream IDs
The clients don't need to know this, and exporting them means we paint-ourselves
into a corner if we want to change the 'namespace' or how HSI actually works.
2020-10-08 16:36:56 +01:00
Richard Hughes
9d1372a928 trivial: Do not build the HSI documentation
We can re-enable this once we have concrete buy-in from more than just Intel.
2020-10-08 16:36:56 +01:00
Richard Hughes
e6eb913b74 uefi: Only set the version format for ESRT entries
Setting the default to number unconditionally causes problems when the device
is created using _register_proxy_device().

Based on a patch by Mario Limonciello <mario.limonciello@dell.com>, many thanks.
2020-10-08 10:34:23 -05:00
Mario Limonciello
5a83563701 uefi: Correct a logic error with FuVolume
Fixes: #2443
2020-10-08 09:16:32 -05:00
Mario Limonciello
e8a2fc8c57 uefi: Make udisks2 errors more apparent
When support for dynamically mounting disks was added for 25ba41579f
udisks2 became a harder dependency and it was less obvious to users.

Create devices but show an error in why devices aren't updatable if
it's not found.

Users can still configure ESP manually in `uefi.conf`

Fixes: #2444
2020-10-08 09:16:32 -05:00
Richard Hughes
f083af3e71 Download the metadata first when using 'fwupdtool refresh'
This allows us to use fwupd_remote_load_signature_bytes() to enable all the
JCat mirror-fix features.
2020-10-07 15:38:08 +01:00
Richard Hughes
27b399ce27 libfwupd: Actually use the JCat file to select the metadata file
This recent regression was caused when porting libfwupd to the async model.

Fixes https://github.com/fwupd/fwupd/issues/2360
2020-10-07 15:38:08 +01:00
Richard Hughes
738e3f01e1 trivial: Ensure config.h is included in all C files 2020-10-07 13:46:33 +01:00
Richard Hughes
6450d0deb4 Add FwupdInstallFlags of _IGNORE_CHECKSUM, _IGNORE_VID_PID and _IGNORE_POWER
The FWUPD_INSTALL_FLAG_FORCE flag has really unclear semantics, and ignoring a
file CRC, checksum or model ID should only be done when using fwupdtool actually
debugging a plugin or firmware parser.

Use the existing --force flag when we want a "gentle nudge" like reuploading
previously processed reports.
2020-10-07 13:15:09 +01:00
Richard Hughes
5bbf013879 Add a --allow-branch-switch to fwupdmgr
This allows us to turn off the tests like version format differences and
checking for downgrades.
2020-10-07 13:15:09 +01:00
Richard Hughes
a1bc349dba spec: Split out a fwupd-plugin-flashrom subpackage
This is installed by default, but means it can be excluded from the minimal
CoreOS image. It's highly unlikely that anything running CoreOS has anything
unlocked that can be flashed using flashrom.

This drops inclusion of dmidecode, libftdi, pciutils-libs and flashrom as hard
dependencies from the package set.
2020-10-07 13:08:54 +01:00
Richard Hughes
8d850db5cd spec: Split out a fwupd-plugin-modem-manager subpackage
This is installed by default, but means it can be excluded from the minimal
CoreOS image. It's highly unlikely that anything running CoreOS has mobile
broadband hardware attached.

This drops inclusion of libmbim, libqmi and ModemManager-glib as hard
dependencies from the package set.
2020-10-07 13:08:54 +01:00
Mario Limonciello
e8946a74d1 fwupdtool/fwupdmgr: make return code different for get-updates with no updates
This allows other tools to depend on it when checking for updates rather than
reading the output.
2020-10-06 13:34:41 -05:00
Mario Limonciello
406025ba56 trivial: ci: fix installed-tests for test plugin
This has been broken for a while and missed various changes.
* Reading firmware version
* Passing `-y` into build
* New verify / verify-image split
2020-10-06 13:34:41 -05:00
Richard Hughes
488a8a76d4 trivial: Fix 'returning FALSE in a pointer function' warning 2020-10-05 22:14:31 +01:00
Richard Hughes
ad69dbbe48 trivial: Fix 'returning FALSE in a pointer function' warning 2020-10-05 22:13:51 +01:00
Richard Hughes
26e57dd4e2 Do not auto-detach when dumping firmware
This allows us to handle this in the plugin, which might mean detaching the
*proxy* device. It's also very important as a few plugins reboot the device
in ->attach() to get the new firmware version, which isn't required for a dump.

This partially reverts a58510b246 and does the
detach and attach in the few plugins where actually required.
2020-10-05 19:44:44 +01:00
Richard Hughes
2428147659 trivial: Show a single line for each plugin state at startup 2020-10-05 15:42:00 +01:00
Richard Hughes
9ed4d47040 trivial: Remove more debugging when disabling plugins
We already have a list of enabled and disabled plugins, don't tell the user
hundreds of times that 'optionrom is not found'.
2020-10-05 15:42:00 +01:00
Mario Limonciello
933e43005f trivial: fu-engine: don't show information for disabled remotes 2020-10-03 06:58:13 -05:00
Mario Limonciello
39bd45f4f7 trivial: don't show quirk directories skipped 2020-10-03 06:58:13 -05:00
Mario Limonciello
2195237f12 trivial: don't show OS release paths checked 2020-10-03 06:58:13 -05:00