Commit Graph

8330 Commits

Author SHA1 Message Date
Richard Hughes
ae80ba6d16 Fix SMBIOS struct parsing when there are three NULs in a row
We need to be careful detecting the end of a string section when the struct
ends with NUL NUL NUL.

Fixes https://github.com/fwupd/fwupd/issues/5509
2023-02-10 13:11:25 +00:00
Valentin David
d911ca60c5 snap: allow fwupdmgr to shutdown
When installing a capsule, optional reboot is done by fwupdmgr instead
of fwupd. This means fwupdmgr needs the permission to do that.
2023-02-10 06:55:12 -06:00
Richard Hughes
910f58d9ce cros-ec: Fix an uninitialized buffer warning from valgrind 2023-02-10 11:02:34 +00:00
Richard Hughes
eff7bfed8e analogix: Do not check the endpoints before selecting an interface
My Analogix USB device has a Billboard interface, with bNumEndpoints=0.

When emulating the interface is NULL, and in runtime the array can *never* be
NULL, so I think this check was added in error.
2023-02-10 10:52:58 +00:00
Richard Hughes
390796c0d3 ti-tps6598x: Fix a small memory leak when flashing new firmware 2023-02-10 10:52:09 +00:00
Richard Hughes
fb4e8446c1 wacom-usb: Use the device proxy functionality
The wacom-usb plugin was created in a simpler time, before we had the concept
of `FuDevice.proxy`. Switch to the shared code to modernize the code, and also
because setting the proxy conveys other semantics that we need to emulate the
device successfully in the future.
2023-02-09 16:43:52 +00:00
Richard Hughes
41544e62a3 trivial: Remove the now-unused FWUPD_WAC_EMULATE check 2023-02-09 16:43:52 +00:00
Richard Hughes
7c10fb0e12 Ensure composite devices all share the same acquiesce delay
We go to great pains to set the parent to the MAX of the child delays, but we
don't actually set the children to have the new parent value.

This means if you update the child device without the parent in the transaction
we don't always wait for all the USB devices to come back -- which is what the
acquiesce delay is designed to do.

Fixes an intermittant device test for the Wacom USB tablet.
2023-02-09 13:29:59 +00:00
Richard Hughes
fa72578666 trivial: Ignore device requests when emulated 2023-02-09 09:17:16 +00:00
Richard Hughes
0e0504cc64 ccgx: Add support for the CalDigit Element Hub 2023-02-09 08:46:52 +00:00
Richard Hughes
58cbb15e64 ccgx: Detect factory mode and set a non-zero version
The Element Hub (and several other docks that use the CCGX5 DMC reference
design) is in "factory mode" out of the box, displaying a version of `0.0.0.0`

Detect factory mode and set a non-zero version -- using the "real" version if
possible by matching the CCG5 devx base firmware firmware.
2023-02-09 08:46:52 +00:00
Mario Limonciello
57282a5903 trivial: Disable the automatic snap stable promotion
The snap is converted into a confined version, but we need to make
sure that the snapd has promoted into a stable release so that fwupd
snap also works.

We should revert this after that happens.
2023-02-08 23:34:47 -06:00
Richard Hughes
d621511c3e Fix fwupdtool firmware-convert to work with image-less formats
Converting 'simple' non-nested formats like Intel Hex into nested formats like
DfuSe needs us to create a binary child firmware to avoid missing data.

Fixes https://github.com/fwupd/fwupd/issues/5493
2023-02-08 08:58:40 +00:00
Richard Hughes
101f72537f trivial: Do not return the internal libxmlb error back to the user 2023-02-08 08:23:29 +00:00
Richard Hughes
5aec024d33 Print errors as JSON objects when using --json
For example:

	$ fwupdmgr local-install --json foo.zip
	{
	  "Error" : {
	    "Domain" : "FwupdError",
	    "Code" : 7,
	    "Message" : "failed to open foo.zip"
	  }
	}

Fixes https://github.com/fwupd/fwupd/issues/5499
2023-02-08 08:23:29 +00:00
Valentin David
70eed3cb9b snap: read the host os-release instead of base snap
This should fix #5485. Depends on https://github.com/snapcore/snapd/pull/12545
2023-02-08 04:21:18 +00:00
Richard Hughes
c7368c5ce7 Optimise getting the list of upgrades using the legacy API
We use GetReleases for all the *possible* releases that could be installed
(although the device might be in UPDATABLE_HIDDEN), and the legacy GetUpgrades
API just wants to know what can be done right now.
2023-02-08 04:20:57 +00:00
Richard Hughes
fbb6f7fd66 Speed up regenerating the MOTD
This is regenerated on every device hotplug event, and although infrequent
there is no point doing all that CPU-heavy requirement checking for no reason.
2023-02-08 04:20:57 +00:00
Richard Hughes
9fdfcfe499 wistron-dock: Use only-wait-for-replug to speed up device replug
Also, set the progress steps correctly.
2023-02-07 11:24:03 +00:00
Richard Hughes
70417a3aee wistron-dock: Fix critical warning during update 2023-02-07 11:24:03 +00:00
Richard Hughes
9b75eb9e34 trivial: Only use clang-format on C source files 2023-02-07 11:01:22 +00:00
Richard Hughes
4257d5f451 Add support for Quit() in fwupdmgr
This allows us to only shut down the P2P daemon in the installed tests.
The easy fix would have been to use something like:

    gdbus call --address unix:path=/run/fwupd.sock --object-path / --method org.freedesktop.fwupd.Quit'

...but the daemon does not implement an ObjectManager, which gdbus requires.

This worked correctly for so long because the p2p tests were being run after
the bus tests, so shutting down the system daemon had no effect.

Fedora 37 seems to have flipped the order for some reason -- and now it
*sometimes* matters that we were doing the worng thing...
2023-02-07 11:00:53 +00:00
Richard Hughes
d4109b9f79 trivial: Fix Fedora CI when it cannot autostart udisks 2023-02-07 11:00:53 +00:00
Richard Hughes
7116ff94c2 cros-ec: Clear the bulk transfer buffer to zero before using
This allow us to emulate the device as the buffer contents are now 100%
predictable and replayable.
2023-02-07 09:30:51 +00:00
Richard Hughes
986b811b3d trivial: Fix a tiny coverity-spotted memory leak on error 2023-02-06 10:24:03 +00:00
Richard Hughes
255ca3d513 Move the Fedora CI job to F37 2023-02-04 17:28:07 +00:00
Richard Hughes
4edf2c5079 Use the correct range check when parsing SMBIOS
The SMBIOS specification says:

    Maximum size of SMBIOS Structure Table, pointed to by the
    Structure Table Address, in bytes. The actual size is guaranteed
    to be less or equal to the maximum size.

So, the firmware is actually allowed to return a DMI blob smaller than the
specified size.

Fixes https://github.com/fwupd/fwupd/issues/5486
2023-02-04 12:55:22 +00:00
Richard Hughes
aef162223f nvme: Detect and warn users with the broken firmware 3B2QGXA7 2023-02-03 17:31:42 +00:00
Richard Hughes
f3bf12dd1c trivial: Fix fu-self-test with libgusb from the main branch 2023-02-03 17:25:03 +00:00
Richard Hughes
c6a3a6e82c trivial: Fix critical warning when loading an emulated DFU device 2023-02-03 16:53:48 +00:00
Richard Hughes
d2082a5f3b Revert "trivial: Fix clang-format of JSON files for newer versions of clang"
This reverts commit 2eb4357a70.
2023-02-03 15:43:04 +00:00
Richard Hughes
2eb4357a70 trivial: Fix clang-format of JSON files for newer versions of clang
This explains why Mario and I had different precommit settings.
2023-02-03 14:28:44 +00:00
Richard Hughes
b3343755a4 ti-tps6598x: Ignore the 'wrong' USB device class before calling ->setup()
No functional change, but a few less i/o operations when inserting the dock.
2023-02-02 08:18:28 +00:00
Valentin David
845425c34a snap: Use common directory for vendor path 2023-02-01 20:44:56 -06:00
Valentin David
995c3210b1 snap: Use strict confinement 2023-02-01 20:44:56 -06:00
Valentin David
df2569f2c3 snap: Fix a meson parameter 2023-02-01 20:44:56 -06:00
Valentin David
d703580411 snap: Remove some unused/redundant dependencies 2023-02-01 20:44:56 -06:00
Valentin David
f647b38e11 snap: Remove dconf 2023-02-01 20:44:56 -06:00
Valentin David
13d6b671ab snap: Add missing libraries 2023-02-01 20:44:56 -06:00
Valentin David
429c4ff2a6 Optionally disable Polkit check with an environment variable
When running in a confined snap, it is not possible to check whether a
policies have been installed.
2023-02-01 20:44:56 -06:00
Valentin David
5ce5080844 Allow overriding lock directory with an environment variable 2023-02-01 20:44:56 -06:00
Richard Hughes
b8631d5e4d dfu: Use more const buffer data when writing to AVR chips 2023-02-01 18:20:26 +00:00
Richard Hughes
add087966d dfu: Clear the buffer before getting the status
This makes emulation of DFU devices work as the control transfer data is then
predictable.
2023-02-01 18:20:26 +00:00
Richard Hughes
8ed6a52ca4 trivial: Enable USB debugging when backend debugging is enabled 2023-02-01 16:42:51 +00:00
Richard Hughes
e3197cc71e trivial: Use new API in libgusb to better detect USB replug 2023-02-01 16:42:51 +00:00
Richard Hughes
99df74f0c2 Add API to wait for a device
This allows us to ignore all the delays when the device is emulated, with the
idea being to do dozens of device emulations in the CI tests.

Also, do not call fu_progress_sleep() when the device is emulated.
2023-02-01 09:42:08 +00:00
Richard Hughes
654dd756b7 Do not invalidate the probe for emulated devices
If the device does not replug, and we change the GUsbDevice because the phase
changed we don't want reprobe the hardware.

If we reprobe then the emulated device will request extra data compared to the
real device, which will cause emulation to fail.
2023-01-31 16:58:31 +00:00
Richard Hughes
b44ee4cf54 trivial: Require --force to overwrite files with 'fwupdmgr download' 2023-01-31 16:28:00 +00:00
Richard Hughes
914f636aa6 Return an error when the pending db could not be updated 2023-01-31 13:27:56 +00:00
dependabot[bot]
3df5bf7bde build(deps): bump docker/build-push-action from 3 to 4
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3 to 4.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 08:25:11 +00:00