Commit Graph

2195 Commits

Author SHA1 Message Date
Richard Hughes
4a156deee2 flashrom: Do not add GUID manually
It's just not requried; fu_device_add_instance_id() does this at the right time.
2021-04-20 15:09:58 +01:00
Richard Hughes
378aceae7d flashrom: Never add NULL instance IDs
Probably fixes half of https://github.com/fwupd/fwupd/issues/3156
2021-04-20 15:09:58 +01:00
Richard Hughes
759c0d49e2 flashrom: Make using fu_flashrom_device_set_programmer_name() more safe 2021-04-20 15:09:58 +01:00
Richard Hughes
2f1f218a36 flashrom: Remove unused parent_instance struct member 2021-04-20 15:09:58 +01:00
Chang Po-Hung
b885e7827b Add cheetos mouse quirk in pixart-rf 2021-04-20 08:05:31 +01:00
bubbleguuum
751edfab65 Fix /etc/os-release ID_LIKE field parsing
Parse ID_LIKE according to 'man os-release':
"A space-separated list of operating system identifiers in the same
syntax as the ID= setting"
2021-04-19 14:46:54 +01:00
Richard Hughes
faa35e430b Show a warning if the device has no GType and the plugin has no default
This also renames a symbol to make it clear that you can call it more than once.

Fixes https://github.com/fwupd/fwupd/issues/3148
2021-04-15 16:52:56 +01:00
Richard Hughes
48f04721de Call g_type_ensure() when using fu_context_add_firmware_gtype()
This simplifies plugins as it means we don't need to remember to ensure the type just to be able to ->build() the firmware file.
2021-04-15 16:52:56 +01:00
Daniel Campello
ff51287628 REVERT: flashrom/lspcon: avoid parsing sysfs paths
Reverts 53c61754b3

https://review.coreboot.org/c/flashrom/+/51967 has not landed yet nor
the equivalent change in Chromium OS flashrom fork. This revert fixes
the breakage until that happens.
2021-04-15 08:21:09 -06:00
Peter Marheine
53c61754b3 flashrom/lspcon: avoid parsing sysfs paths
sysfs paths don't have strong guarantees about semantics, so attempting
to parse an I2C bus number out of a sysfs path of some device is likely
to be fragile. Instead take advantage of the device layout to find the
I2C bus an LSPCON is on without trying to parse it out of paths.

The bus the device is on is a sibling device of type i2c-dev, so by
locating an i2c-dev device that is a sibling of the detected LSPCON
device, the /dev path of the bus can be found robustly.

Support for specifying an I2C bus by path rather than number is also
required in flashrom, implemented at
https://review.coreboot.org/c/flashrom/+/51967

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2021-04-15 06:53:06 +01:00
Daniel Campello
3426d5788c flashrom: lspcon-i2c-spi: add reload method
Re-read the flag and version flash regions after an update to get the
new device status.
2021-04-14 12:09:11 -06:00
Daniel Campello
9f77608ef7 trivial: flashrom: verify write to flag region
Disable verification on sub-block-size write was not needed after all.
2021-04-14 06:51:51 +01:00
Ross Burton
57961cddac Add option to disable the UEFI capsule splash screen generation
The dependencies to generate the "updating..." splash screen are non-trivial, and
pointless in headless systems.  Add an option to disable the generation entirely.
2021-04-13 12:31:17 +01:00
Analogix
b518c536c7
analogic: Fix various trivial problems to enable successful device update
* Changed CUSTOM Define firmware size. 
* Extended time for transferring data time out.

Co-authored-by: xtcui <xtcui@analogix.corp-partner.google.com>
2021-04-13 08:39:18 +01:00
Richard Hughes
ec3542c1dc Mark the Lenovo VL103 no-power USB-C dongle as dual-image
This fixes flashing when in normal runtime mode.

Resolves https://github.com/fwupd/fwupd/issues/2940
2021-04-13 07:01:40 +01:00
Richard Hughes
7dac6198e7 wacom-raw: Fix a possible crash if the user set WacomI2cFlashBlockSize > 128
Spotted by Coverity, thanks!
2021-04-12 12:48:36 +01:00
Richard Hughes
690607e590 intel-spi: Fix compile error when errno is not available 2021-04-12 12:48:36 +01:00
xtcui
0f7f7f2cb5 Add support for some Analogix hardware
With much help from:

 * Ricardo Cañuelo <ricardo.canuelo@collabora.com>
 * Richard Hughes <richard@hughsie.com>
2021-04-12 11:00:54 +01:00
Richard Hughes
c4bc709359 Do not use help2man to build manual pages
This prevents problems when cross compiling. Using help2man is now also of
limited use; if we can just tell the user to use --help we do not need to keep
the manual in sync.

It also allows us to drop the several other supporting files that we use when
the help2man output isn't actually that useful.

Fixes https://github.com/fwupd/fwupd/issues/3025
2021-04-11 13:42:04 +01:00
Richard Hughes
7f6f525f21 Add fu_bytes_get_data_safe() to check for zero sized data
Fixes https://github.com/fwupd/fwupd/issues/3122
2021-04-10 13:20:07 +01:00
Mario Limonciello
61ef63addc trivial: correct parsing of sample flashrom xml file 2021-04-09 16:02:20 +01:00
Mario Limonciello
9bca3bf53c trivial: correct docstring location for a few python files 2021-04-09 16:02:20 +01:00
Mario Limonciello
1f9c035788 trivial: fix some trailing whitespace problems across the project 2021-04-09 16:02:20 +01:00
Richard Hughes
13524af202 Write BMP data directly without using PIL
This allows us to drop a build-time dep.
2021-04-09 15:59:51 +01:00
Daniel Campello
4483f609f1 flashrom: lspcon-i2c-spi: add write_firmware
Added firmware flash logic.
2021-04-08 18:12:16 -06:00
Daniel Campello
314b94b41f flashrom: lspcon-i2c-spi: read active_partion and version
Reads the active_partition and firmware version from active_partition
2021-04-08 18:12:16 -06:00
Daniel Campello
fe073a304d flashrom: add lspcon-i2c-spi programmer support
Created lspcon-i2c-spi flashrom device that uses udev to detect i2c
devices that can be updated with the lspcon-i2c-spi flashrom programmer.

This change implements the logic from crrev.com/c/2792124 adapted to the
upstream flashrom plugin.
2021-04-08 18:12:16 -06:00
Daniel Campello
08236d839d flashrom: make fu-flashrom-device derive from fu-udev-device
This change allows the flashrom plugin to probe for udev devices.
2021-04-08 18:12:16 -06:00
Mario Limonciello
6d1afc3e87 trivial: reformat all python code with black 2021-04-08 10:43:29 -05:00
Daniel Campello
f37dcd4fab flashrom: make fu-flashrom-device a derivable type
This change allows other device types to derive from common flashrom
code in the flashrom-device type.

Change-Id: Ic963fd586e0a73153c54889fce50055753a1bf5c
2021-04-08 15:40:41 +01:00
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