Commit Graph

2222 Commits

Author SHA1 Message Date
Richard Hughes
8bdd868c58 Do not build fwupdcethelper if noinline,noclone fails 2021-05-17 16:42:58 +01:00
Richard Hughes
7a8c61a5c3 rts54hub: Allow updating the RTD21xx devices in background mode
Original code by Ricky Wu <ricky_wu@realtek.com>
2021-05-17 16:38:29 +01:00
Richard Hughes
769cbbf8af Add support for the PHAT table
On Alterlake and newer hardware the Platform Health Assessment Record
data can be used by the IHV to debug why a specific capsule update
failed. Any custom firmware loaded by the OEM can be identified and
used to further debug the root cause.
2021-05-12 12:02:33 +01:00
Richard Hughes
ddc40ab595 fastboot: Add some trivial error prefix for the getvar failure 2021-05-12 10:10:57 +01:00
Richard Hughes
355fd54e15 upower: Fix critical warning introduced recently 2021-05-11 20:10:58 +01:00
Richard Hughes
e8f95bc26d Do not prevent firmware updates on desktop hardware
Fixes https://github.com/fwupd/fwupd/issues/3236
2021-05-10 14:36:51 +01:00
Richard Hughes
20ef071b3c trivial: Style fixes to lots of gtk-doc 2021-05-10 14:35:10 +01:00
JackZhang-Primax
6e2ee2113c Update pixart-rf.quirk
Add black Mocha vendor & product id in pixart-rf qurik.
2021-05-06 09:48:46 -05:00
Richard Hughes
0ad70b9be4 trivial: Skip the swap tests when the system bus cannot be started 2021-05-04 09:45:03 +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
Jason Gerecke
99b4475777 wacom_usb: Fail parsing if wac firmware sections are not in sorted order
The code currently assumes that the firmware sections are in sorted
order (e.g. using images_cnt as the current index). This seems to
be the case with real firmware images, but is not actually guaranteed
by anything. Rewriting the code to use the actual index from the WA
header is a little difficult so just assert this condition for now.
2021-04-30 20:42:28 +01:00
Jason Gerecke
1ddac4447b wacom_usb: Read current firmware index before finding image to write
The value of `self->firmware_index` is not valid until we call
`fu_wac_device_ensure_firmware_index`. Because of this, we would always
request the firmware for index 0. If that slot is currently active then
our attempt to program it will fail since the pages are write-protected.
Annoyingly the only signs that something has gone wrong are that the
flash completes almost instantly and the firmware version never changes.

To fix this we re-order our usage of the variable to be after it
becomes valid. We also add a noisy failure message that is triggered
if no blocks are written.

Fixes: 7afd7cba0d ("Use FuFirmware as a container for firmware images")
2021-04-30 20:42:28 +01:00
Jason Gerecke
50a4ec70e6 wacom_usb: Firmware versions are packed BCD, not "decimal"
Version numbers used by Wacom firmware are typically coded as packed BCD
numbers. The minor version numbers are typically rendered with leading
zeros in the wild, though it appears fwupd doesn't follow this same
visual convention.

Some example versions:

  * { 0x00, 0x05 } --> 0.05 (Wacom rendering) / 0.5 (fwupd rendering)
  * { 0x01, 0x01 } --> 1.01 (Wacom rendering) / 1.1 (fwupd rendering)
  * { 0x01, 0x23 } --> 1.23 (Wacom rendering) / 1.23 (fwupd rendering)

Fixes: 872ec1b68f (Add an experimental plugin to update some new Wacom tablets)
2021-04-30 20:42:28 +01:00
Richard Hughes
89d45a0d91 trivial: Standardize on introspection for @error and @cancellable
Also standarize on `Returns:` for the result.
2021-04-28 16:19:50 +01:00
Richard Hughes
5ad6fb2a27 dfu: Do not show an invalid warning on attach
For some hardware, it is quite expected the device just resets.
2021-04-26 19:38:13 +01:00
Richard Hughes
0a37abfce8 dfu: Do not require wildcard-pid when flashing a raw binary file 2021-04-26 19:38:13 +01:00
Richard Hughes
584f1d4c6a dfu: Fall back to binary files when flashing stm32 hardware 2021-04-26 19:38:13 +01:00
Richard Hughes
1ac05ef3bd trivial: Codespell fixes 2021-04-26 10:29:39 +01:00
Richard Hughes
4fe318bd54 dfu: Fix up some overzealous replacement when renaming the DFU files 2021-04-23 13:59:44 -05:00
Richard Hughes
88eef48f36 trivial: Use g_memdup2() on newer GLib versions 2021-04-23 13:59:28 -05:00
Mario Limonciello
99832622e1 uefi-capsule: Move EFI binary into a subproject
This will allow distributions to package and distribute the unsigned
EFI binary separately, similar to what has been done for GRUB.
2021-04-23 13:59:10 -05:00
Peter Marheine
72a273e0ff flashrom/lspcon: probe for actual active partition
While the flag bytes in Flash on the PS175 indicate which partition it is
desired the device boot, the device may actually boot something else
because it performs some kind of integrity check on firmware images before
booting them. If the image specified by the flag bytes fails validation,
the device instead boots partition 3 which should be treated as read-only.

The device provides a register on I2C that indicates which partition is
actually running, so probe that register rather than assuming the device
is running the image that the flag bytes specify.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2021-04-23 07:03:49 +01:00
Peter Marheine
a8e9802271 flashrom/lspcon: make flash layout non-global
Having a mutable global flash layout makes it difficult to reason about which
flash regions will be affected by any given flashrom operation. Make copies of
the layout from a template instead, and default-exclude regions from
operations.
2021-04-23 07:03:49 +01:00
Richard Hughes
a87440947d flashrom: Do not attempt to change the physical ID after setup() 2021-04-22 15:37:24 +01:00
Dirk-Jan C. Binnema
cd474377d5 fu_dfu_tool_get_default_device: Avoid use-after-free
fu_dfu_tool_get_default_device returns a newly create FuDfuDevice
'device'; but since it is marked as g_autoptr, it is destroyed when
leaving the scope and the caller receives garbage.

So steal the pointer before leaving the scope.

,----
| ==697985== Invalid read of size 8
| ==697985==    at 0x4B50F49: g_type_check_instance_is_fundamentally_a (gtype.c:4080)
| ==697985==    by 0x4B3A988: g_object_unref (gobject.c:3421)
| ==697985==    by 0x406CF3: glib_autoptr_clear_GObject (gobject-autocleanups.h:27)
| ==697985==    by 0x406DD5: glib_autoptr_clear_FwupdDevice (gusb-autocleanups.h:17)
| ==697985==    by 0x406E9C: glib_autoptr_clear_FuDevice (fu-device.h:18)
| ==697985==    by 0x406EE3: glib_autoptr_clear_FuUsbDevice (fu-usb-device.h:22)
| ==697985==    by 0x406F6A: glib_autoptr_clear_FuDfuDevice (fu-dfu-device.h:19)
| ==697985==    by 0x406F88: glib_autoptr_cleanup_FuDfuDevice (fu-dfu-device.h:19)
| ==697985==    by 0x40898D: fu_dfu_tool_read (fu-dfu-tool.c:577)
| ==697985==    by 0x407518: fu_dfu_tool_run (fu-dfu-tool.c:162)
| ==697985==    by 0x4097E0: main (fu-dfu-tool.c:959)
| ==697985==  Address 0x67fbfe0 is 640 bytes inside a block of size 672 free'd
| ==697985==    at 0x48430E4: free (vg_replace_malloc.c:755)
| ==697985==    by 0x4BD124C: g_free (gmem.c:199)
| ==697985==    by 0x4BEB76F: g_slice_free1 (gslice.c:1180)
| ==697985==    by 0x4B4FDBB: g_type_free_instance (gtype.c:1993)
| ==697985==    by 0x406CF3: glib_autoptr_clear_GObject (gobject-autocleanups.h:27)
| ==697985==    by 0x406DD5: glib_autoptr_clear_FwupdDevice (gusb-autocleanups.h:17)
| ==697985==    by 0x406E9C: glib_autoptr_clear_FuDevice (fu-device.h:18)
| ==697985==    by 0x406EE3: glib_autoptr_clear_FuUsbDevice (fu-usb-device.h:22)
| ==697985==    by 0x406F6A: glib_autoptr_clear_FuDfuDevice (fu-dfu-device.h:19)
| ==697985==    by 0x406F88: glib_autoptr_cleanup_FuDfuDevice (fu-dfu-device.h:19)
| ==697985==    by 0x407762: fu_dfu_tool_get_default_device (fu-dfu-tool.c:191)
| ==697985==    by 0x408736: fu_dfu_tool_read (fu-dfu-tool.c:592)
| ==697985==  Block was alloc'd at
| ==697985==    at 0x484086F: malloc (vg_replace_malloc.c:380)
| ==697985==    by 0x4BD4938: g_malloc (gmem.c:106)
| ==697985==    by 0x4BEC1F4: g_slice_alloc (gslice.c:1069)
| ==697985==    by 0x4BEC85D: g_slice_alloc0 (gslice.c:1095)
| ==697985==    by 0x4B5511A: g_type_create_instance (gtype.c:1893)
| ==697985==    by 0x4B3CB8C: g_object_new_internal (gobject.c:1939)
| ==697985==    by 0x4B3E107: g_object_new_valist (gobject.c:2282)
| ==697985==    by 0x4B3E63C: g_object_new (gobject.c:1782)
| ==697985==    by 0x40B0CF: fu_dfu_device_new (fu-dfu-device.c:571)
| ==697985==    by 0x407723: fu_dfu_tool_get_default_device (fu-dfu-tool.c:230)
| ==697985==    by 0x408736: fu_dfu_tool_read (fu-dfu-tool.c:592)
| ==697985==    by 0x407518: fu_dfu_tool_run (fu-dfu-tool.c:162)
`----
2021-04-21 10:57:51 +01:00
Richard Hughes
08aeda737a flashrom: Remove the call to fu_plugin_cache_add() as it is not required
This also means we don't need to lazy-create the GHashTable either.
2021-04-20 15:09:58 +01:00
Richard Hughes
147ad17a84 pci-bcr: Use fu_device_inhibit() rather than removing UPDATABLE 2021-04-20 15:09:58 +01:00
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