Commit Graph

4717 Commits

Author SHA1 Message Date
Mario Limonciello
b15f4ab4b1 elantp: Trivial whitespace fixes 2020-10-21 16:54:13 +01:00
Mario Limonciello
0ad124a02b elantp: Match all i2c-hid devices in quirk
In the plugin probe routine, check whether they are actually i2c-hid touchpad
by looking at PID.

Fixes #2494
2020-10-21 16:54:13 +01:00
Richard Hughes
f6a765d251 vli: Remove one of the catch-all PD VID:PID matches
This is already supported using the &APP_ GUID for the Lenovo USB-C Mini dock.
2020-10-21 16:25:12 +01:00
Mario Limonciello
7db8e88d98 When PK is disabled only allow trusted payloads
Loosen the requirement of the user ID to match root for the following
actions:
* Install release
* Activate firmware

For install release action, reject CAB files not signed by LVFS
2020-10-20 15:24:08 -05:00
Richard Hughes
a2a8f8ea70 Add fu_byte_array_set_size()
The GLib g_byte_array_set_size() function does not zero the contents if the
array size is larger, which leads to unpredictable output when using valgrind.
2020-10-20 19:54:07 +01:00
Richard Hughes
92769bfba1 trivial: Use fu_device_sleep_with_progress() in one more place 2020-10-20 18:21:27 +01:00
Richard Hughes
d7e3f09cbf trivial: Show what the device does support if the protocol match fails 2020-10-20 18:21:04 +01:00
Mario Limonciello
c3a8173a12 Show an error when a plugin is missing dependencies (Fixes: #1526)
```
$ sudo mv /usr/lib/x86_64-linux-gnu/libtss2-esys.so.0.0.0 /usr/lib/x86_64-linux-gnu/libtss2-esys.so.0.0.0.renamed
$ sudo fwupdtool get-devices --plugins=uefi
14:15:48:0735 FuEngine             cannot load: failed to open plugin /usr/local/lib/x86_64-linux-gnu/fwupd-plugins-3/libfu_plugin_uefi.so: libtss2-esys.so.0: cannot open shared object file: No such file or directory
Loading…                 [-                                      ]14:15:48:0753 FuEngine             failed to update history database: device ID b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2 was not found
Loading…                 [***************************************]
WARNING: Plugin depdendencies missing
No detected devices
```
2020-10-20 10:57:21 -05:00
Richard Hughes
04d0a1b863 vli: Use the tokenization data for the Intel HEX file 2020-10-20 16:27:15 +01:00
Richard Hughes
6a29672bc3 Do more processing when tokenizing the Intel HEX file 2020-10-20 16:27:15 +01:00
Richard Hughes
c7283ea61e uefi: Drop efivar dependency 2020-10-19 16:13:21 +01:00
Richard Hughes
f019971c00 redfish: Drop efivar dependency 2020-10-19 16:13:21 +01:00
Mario Limonciello
68df30bd2b dell: Drop efivar dependency
Since we removed the ability to turn on/off force power this is dead code, and
an unnecessary dependency.
2020-10-19 16:13:21 +01:00
Richard Hughes
81b5defaa6 uefi: Use fu_efivar_get_data() to fix setting BootNext correctly
Fixes https://github.com/fwupd/fwupd/issues/2169
2020-10-19 16:13:21 +01:00
Richard Hughes
43053d2a13 Do not include fullstops in the --help output
Fixes https://github.com/fwupd/fwupd/issues/2487
2020-10-19 00:43:49 +01:00
Richard Hughes
377feea500 Only show the HSI for sane chassis types
Fixes https://github.com/fwupd/fwupd/issues/2440
2020-10-18 20:24:10 +01:00
Richard Hughes
9f93b8bc66 trivial: Add fu_smbios_get_integer() helper 2020-10-18 20:24:10 +01:00
Richard Hughes
f2a3e01f96 Simplify fu_device_list_wait_for_replug() for sanity
Rather than using a recursive GMainLoop, just run a single iteration of the
mainloop every 1ms while we're waiting.

This simplifies the device lifecycle dramatically as we don't have to worry
about reentrant removals. It's also a lot simpler to debug as we know the only
way to return is the timeout elapsing or FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG being
unset.

If multiple devices got removed and we're waiting for one to re-appear, also
wait for all devices to come back before returning to the main loop.

In the worst case, this causes the device list to wait the full removal_delay
for the device rather than returning when the first device matches. This allows
us to simplify the hub update when we reboot the entire device and various
devices from different plugins come back in an unpredictable order.

Fixes the other half of https://github.com/fwupd/fwupd/issues/2376
2020-10-18 07:35:46 +01:00
Richard Hughes
ae5858ff58 vli: Get the new firmware version when updating the PD device
To do this without rebooting the device implement VliUsbhubPdDevice->reload()
like the other FuVliUsbhubDevice child devices.

Fixes half of https://github.com/fwupd/fwupd/issues/2376
2020-10-18 07:35:46 +01:00
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