Commit Graph

2165 Commits

Author SHA1 Message Date
Richard Hughes
50af03a507 trivial: Set HP battery threshold to 50% 2021-04-08 10:03:24 +01:00
Richard Hughes
b1da502318 trivial: Set Star Labs battery threshold to 30% 2021-04-07 13:50:33 +01:00
Javier Martinez Canillas
f2327011a7 uefi-capsule: Include crt0 for arm and aarch64 that add a SBAT section
Due the lack of pei-aarch64 support in binutils, the gnu-efi crt0 harcodes
the PE32+ sections among other things. These crt0 aren't aware of the SBAT
section and so custom ones have to be used.

In the same vein as commit cfd1f2f42a ("uefi-capsule: Ensure SBAT metadata
is added correctly") included custom linker scripts, this change add a set
of crt0 for arm and aarch64 that hardcode a SBAT section in the PE headers.

These are the crt0 from gnu-efi plus the following fixes from Peter Jones:

* Include .sbat in section headers
* Fix some PE headers
* Calculate the VirtualSize of .sbat separately
* Put .rel* and .dyn* in .rodata
2021-04-07 13:46:58 +01:00
Javier Martinez Canillas
011db8e467 uefi-capsule: Sync linker scripts with latest used by shim
The linker scripts used in the project were copied from the shim project,
but there were a few fixes made after this original copy.

Until binutils have proper pei-aarch64 support, the linker scripts should
be kept in sync to make sure that the PE32+ binaries are built correctly.

The fixes included in this change are the following:

 * Include missing .text sections in PE/COFF binary (Chris Coulson)
 * Put .sbat after _edata (Peter Jones)
 * Fix some PE headers for arm and aarch64 (Peter Jones)
 * Include the aligned part in SizeOfRawData of sbat for arm and aarch64 (Gary Lin)
 * Swizzle some sections to make old sbsign happier for arm and aarch64 (Peter Jones)
 * Put .rel* and .dyn* in .rodata for arm and aarch64 (Peter Jones)
2021-04-07 13:46:58 +01:00
Richard Hughes
4d76d18d35 Set the system battery state and level on the FuContext shared state
This allows plugins to set the battery power state of the *machine* which means
we can automatically inhibit devices with FWUPD_DEVICE_FLAG_REQUIRE_AC set.

It also allows to set the BatteryThreshold to 25% for Lenovo hardware, and we
can override other vendors with further quirks as required.

Fixes https://github.com/fwupd/fwupd/issues/3084
2021-04-07 08:05:15 +01:00
Mario Limonciello
0f50a3186c Add a new internal flag for whether or not to inherit activation
The activation flag is stored into the history database, but not all
plugins will want to inherit it on coldplug the next time the daemon
is started.

For example the Dell Dock plugin will query this information from the
device and it will prevent getting into a bad state as a result.
Fixes: #3106
2021-04-06 14:09:12 -05:00
Mario Limonciello
395856afeb trivial: remove some unused variables
Caught by clang
2021-04-06 14:09:12 -05:00
Dirk-Jan C. Binnema
79536a0265 dfu-tool: Avoid runtime warning (overriding error)
We were seeing:

,----
| (dfu-tool:1139827): GLib-WARNING **: 17:34:42.671: GError set over the top of a previous GError or uninitialized memory.
| This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
| The overwriting error message was: no device matches for 1234:abcd
`----

This is because we were attempting to overwrite libgusb's error with one
for fwupd, and glib rightfully complains. So let's prefix it instead.
2021-04-05 14:42:04 -05:00
Richard Hughes
f3c64adb6c intel-spi: Allow downloading the firmware image from the eSPI controller
Add the IFD regions as child devices and set the region access on the child
devices. Also add read-only SPI descriptor as an HSI attribute and require
FLOCKDN on Intel hardware.

Use the hidden PCI 00:1f.5 device to set the SPIBAR automatically and generate
the quirk file automatically to support more hardware.
2021-04-01 21:56:35 +01:00
Richard Hughes
b333e0045c Split out a shared system context
There is a lot of code in fwupd that just assigns a shared object type to
a FuPlugin, and then for each device on that plugin assigns that same shared
object to each FuDevice.

Rather than proxy several kinds of information stores over two different levels
of abstraction create a 'context' which contains the shared *system* state
between the daemon, the plugins and the daemon.

This will allow us to hold other per-machine state in the future, for instance
the system battery level or AC state.
2021-04-01 21:11:29 +01:00
Richard Hughes
0d4255b589 vli: Remove deprecated quirk prefixes 2021-04-01 18:40:14 +01:00
Daniel Campello
f82ce6ecb6 flashrom: Update plugin to support multiple devices
This change moves many of the logic at the plugin level to the device
level in order to support multiple devices updatable via libflashrom.
2021-04-01 16:40:09 +01:00
Richard Hughes
74ac5ab86d trivial: Add fu_device_remove_flag() as a proper symbol
This allows us to automatically uninhibit() like we do in fu_device_add_flag().
2021-03-31 19:19:46 +01:00
Richard Hughes
b9ac0bc029 Add fu_device_inhibit() to mark the device as non-updatable
We already have two things managing the UPDATABLE_HIDDEN->UPDATABLE transition,
and we're about to add a third.

Add a 'stackable' inhibit-style API so we do not accidentally mark a device as
updatable when it should remain hidden.
2021-03-31 19:19:46 +01:00
Richard Hughes
62a8b0c288
Add fu_device_set_battery_threshold() (#3086)
This allows a device to set a custom 'check battery level is X%' value from
either the plugin or from a quirk.
2021-03-31 16:43:36 +01:00
Richard Hughes
18dcb6f511
wacom-raw: Fix an impossible to hit overflow (#3082)
Spotted by Coverity.
2021-03-31 16:30:59 +01:00
memily
c255034574
vli: Add VL822 device+share-spi-pd
Co-authored-by: Emily Miller <m_emily@berkeley.com>
2021-03-30 13:06:49 +01:00
Richard Hughes
baf10157dd pixart-rf: Retry the SetReport after a successfull firmware update 2021-03-29 10:23:16 +01:00
Richard Hughes
dd61689073 Add fu_device_add_security_attrs() 2021-03-28 17:54:19 +01:00
Steve McIntyre
50348e1104 Tweak the SBAT output for a vendor string
The format is meant to be "<project>.<vendor>" with a period as a
separator.

Signed-off-by: Steve McIntyre <93sam@debian.org>
2021-03-26 15:21:15 +00:00
Benson Leung
ef7262f19f trivial: cros-ec: Fix error string to use inlen
Looks like this error message was copy/pasted from above.
Since we're testing whether actual != inlen, the error message should
output inlen.
2021-03-25 15:12:54 -07:00
Benson Leung
3dba442c1f cros-ec: Fix call to fu_memdup_safe in fu_cros_ec_usb_device_do_xfer
outbuf == NULL is a valid condition in fu_cros_ec_usb_device_do_xfer. That's
how we use this function to specify a read with no outbound buffer, like the
reply at the end of sending a block.
Since 9b11af985f ("Add fu_memdup_safe()"), however, the call to fu_memdup_safe
always fails if outbuf, the dst, is NULL.

Fix this by moving this into the if (outbuf != NULL && outlen > 0)  block below.

Fixes: 9b11af985f ("Add fu_memdup_safe()")
fixes #3064
2021-03-25 21:27:48 +00:00
Richard Hughes
f08491f727 synaptics-cxaudio: Retry GetReport to fix an enumeration failure 2021-03-25 14:30:07 +00:00
JimmyYu
af1e70ad92 pixart: Modify ota retransmit flow 2021-03-22 17:48:08 +01:00
David Chiu
98328679ab synaptics-rmi: Force the hardware into IEP mode as required 2021-03-22 07:51:06 +00:00
David Chiu
02404b0797 synaptics-rmi: Fix regression when setting edpAuxStatusRequest 2021-03-22 07:51:06 +00:00
David Chiu
09ad3a7f93 synaptics-rmi: Allow failure when writing and erasing 2021-03-22 07:51:06 +00:00
David Chiu
f9a0b04389 synaptics-rmi: Validate the firmware signature correctly 2021-03-22 07:51:06 +00:00
David Chiu
b15f393494 synaptics-rmi: Reduce the idle wait time 2021-03-22 07:51:06 +00:00
Richard Hughes
ece778c83d intel-spi: Fix a typo spotted by Coverity 2021-03-20 17:33:18 +00:00
Richard Hughes
276baf12f9 trivial: Rename spi to intel-spi as it's all Intel specific
If we need to export the EFI symbols into libfwupdplugin for other plugins we
can do that when we need them.
2021-03-20 12:24:27 +00:00
Richard Hughes
be83a8eeea spi: Fix a oss-fuzz detected critical warning
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32249
2021-03-19 18:00:59 +00:00
Richard Hughes
a5966f7085 trivial: Codespell fixes 2021-03-19 16:42:33 +00:00
Benson Leung
aad1b98e2c cros-ec: Add D501 Baklava device support
Baklava is based on Quiche and will work with cros-ec plugin.

fixes #3044
2021-03-18 14:29:42 -07:00
Richard Hughes
119d260bd2 trivial: Limit alignment to 2GB to fix a fuzzing crash
This meant defining alignment values in FuFirmware.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32131
2021-03-17 11:14:46 +00:00
Richard Hughes
f0e77fb2ab trivial: Use fu_byte_array_append_bytes() in a few more places 2021-03-17 11:14:46 +00:00
Richard Hughes
220aa3ac42 spi: Only show the flash_master output when debugging 2021-03-17 11:12:52 +00:00
Sean Rhodes
e5c67b0cde Removed PciBcr Quirk 2021-03-15 18:56:54 +00:00
Richard Hughes
aa95f30390 Allow reading the PciBcrAddr quirk from flashrom devices 2021-03-15 18:30:05 +00:00
JimmyYu
bc39faf4cf pixart: Add check result in fw upgrade response
Signed-off-by: Richard Hughes <richard@hughsie.com>
2021-03-15 13:07:13 +00:00
Richard Hughes
52441f28a4 Allow objects to deserialize to XML
This makes a lot more sense; we can parse a firmware and export the same XML
we would use in a .builder.xml file. This allows us to two two things:

 * Check we can round trip from XML -> binary -> XML

 * Using a .builder.xml file we can check ->write() is endian safe
2021-03-15 12:07:30 +00:00
Richard Hughes
278c3998a5 Parse the IFD BIOS section into EFI FV and FFS2 sections 2021-03-15 10:46:39 +00:00
Richard Hughes
408b056984 trivial: Use fu_byte_array_append_bytes() in more places 2021-03-15 09:46:02 +00:00
Richard Hughes
664226a350 spi: Move all the IFD parsing to the new 'spi' plugin
We do not want to export this unfinished API, and it's probably best just to
not compile it by default until it is actually useful.
2021-03-15 09:45:17 +00:00
Richard Hughes
be527a8a60 trivial: Fix up the self test report for the bcm57xx binary 2021-03-13 16:16:27 +00:00
Benson Leung
f7832847f5 cros-ec: Allow a failure to write a section, do another write
The RO partition's USB endpoint has been observed to occasionally hiccup
(usb disconnect and reenumeration) upon reboot and initial attach, causing a
failure to update a section. Rather that making this fatal, let's set
ANOTHER_WRITE_REQUIRED and allow us to handle the new USB device after
this event.

fixes #3012
2021-03-13 07:58:05 -08:00
Richard Hughes
91324a13c0 pixart: Call finalize() on FuFirmware to avoid leaking 2021-03-12 15:51:25 +00:00
Richard Hughes
81d0502f1a cros-ec: Fix up some uses of GError 2021-03-11 13:05:43 -08:00
Richard Hughes
42dcff32ca wacom-usb: Add support for writing firmware 2021-03-11 15:48:02 +00:00
Richard Hughes
e574a942c8 wacom-usb: Fix firmware parse regression from FuFirmwareImage removal 2021-03-11 15:48:02 +00:00