Commit Graph

394 Commits

Author SHA1 Message Date
Daniel Campello
9fbd7fe65d Allow to filter get-updates on device-id
This change allows to get available updates for a given device. This is
similar to what is done for the update and activate commands.
2020-09-28 16:43:42 -05:00
Richard Hughes
fbd8b5d325 Add fu_device_dump_firmware()
Conceptually we were trying to stuff subtly different actions into one vfunc:

 * Read firmware from the device to update the verification checksums

 * Read a firmware blob from the device for debugging

For the first action we might want to mask out the sections of the flash with
serial numbers (so the verification hashes match the ones published on the LVFS)
and for the second we want just a raw ROM file from the hardware with no
pre-processing that we can compare against an external SPI dumper.

Split out ->dump_firmware to get the raw blob, and allow plugins to also
implement ->read_firmware() if they have to mask out specific offsets or remove
specific images from the FuFirmware container.

In the common case when masking is not required, fall back to using a 'binary'
FuFirmware automatically to make most plugins simpler.
2020-09-24 10:54:27 -05:00
Richard Hughes
0924c93422 Do not use firmware-convert to build firmware
Copying the images from the src to the destination meant we could never set
properties on the new FuFirmware instance or subclass.
2020-09-23 15:22:31 +01:00
Richard Hughes
dd65344dde Add firmware-extract subcommand to fwupdtool 2020-09-22 12:11:38 +01:00
Richard Hughes
34f7d9d8fb Allow binding and unbinding kernel drivers 2020-09-21 20:07:54 +01:00
Richard Hughes
7ef2dea271 optionrom: Test if the PCI device has ROM in probe
This means we make things a simpler by not relying on udev to stat the file.
It also reduces the number of added *unused* GUIDs by one per device too.
2020-09-20 19:11:44 +01:00
Richard Hughes
b9ef4399c9 Remove unused udev rules
We used these before we had the quirk files, and now with all the VLI devices
supported in the quirk files these entries do nothing at all.
2020-09-20 19:11:44 +01:00
mendel5
75810207dc flag_require_ac: System requires external power source 2020-09-20 12:08:52 -05:00
Richard Hughes
5c82b94322 Do not show HSI obsoleted attributes by default
When one result is obsoleted by another, then do not show the old result by
default.

Additionally hide the HSI URLs as this was designed more for GUI clients like
gnome-firmware than CLI tools such as fwupdmgr.
2020-09-14 09:58:46 -05:00
Mario Limonciello
5de5dd3582 Install the installed tests
Move binaries out of fwupd tree to https://github.com/fwupd/fwupd-test-firmware

Fixes some of https://github.com/fwupd/fwupd/issues/1956
2020-08-28 10:10:43 -05:00
Richard Hughes
a83deb42b5 Add commands to fwupdtool for interacting with the ESP 2020-08-12 18:35:15 +01:00
Richard Hughes
3120683143 Allow blocking specific firmware releases by checksum
Fixes https://github.com/fwupd/fwupd/issues/2280
2020-08-10 17:14:15 +01:00
Richard Hughes
b76b4f8deb trivial: Make the bash completion script reflect reality 2020-07-29 15:05:15 +01:00
Richard Hughes
5bfa7bf808 trivial: Add a device test for the Thelio Io device 2020-07-28 16:01:47 +01:00
Richard Hughes
ff0dc24e54 trivial: Add some documentation for the ApprovedFirmware config key 2020-07-09 12:52:38 +01:00
Richard Hughes
85226fd9d1 Remove potentially problematic language
Red Hat wants to drive an initiative in correcting problematic and potentially
divisive language in open source projects. These naming conventions and
descriptive phrases are hurtful and offensive to many of our colleagues across
the open source universe.

See https://www.redhat.com/en/blog/making-open-source-more-inclusive-eradicating-problematic-language
2020-06-30 17:31:17 +01:00
Richard Hughes
9bc9debd98 Allow uploading security attributes to the LVFS
We sign the data with the client cert to allow users with LVFS accounts to
publish 'official' HSI ratings.
2020-05-21 11:48:09 +01:00
Richard Hughes
196c6c69db Add support for the Host Security ID
The HSI specification assigns a simple text ID to the current state of firmware
security. As new vulnerabilities are found, and as protection measures are
updated, new requirements will be added to the required firmware behaviours for
each HSI value.

The HSI specification is currently incomplete and in active development, and
so the --force flag is required in all command line tools. The current ID value
will probably change on a given platform so please do not start using the result
for any kind of compliance requirements.
2020-05-11 22:11:49 +01:00
Mario Limonciello
3838b22a7c trivial: add missing changelog entry for 1.3.9
This release came out after 1_3_X branched but long before 1.40 release
so these entries are confusing to be missing.
Fixes: #2059
2020-05-05 13:14:22 -05:00
Richard Hughes
86f6324a26 Switch the default of EnumerateAllDevices to false
This was causing dozens of regressions to be reported.
2020-05-03 06:47:40 +01:00
Richard Hughes
ad113b931f Release fwupd 1.4.1 2020-04-27 11:05:41 +01:00
Jan Tojnar
463db5162f build: Allow overriding prefix for systemd file installation
It is a good practice to install files relative to our own variables
https://www.bassi.io/articles/2018/03/15/pkg-config-and-paths/
and it is required on systems like NixOS.

Unfortunately, systemd allows overriding the root prefix,
see also 1c2c7c6cb3,
so we cannot just do that.

Let's at least make the systemd installation prefix overridable.

This will also allow us to drop `systemdsystemunitdir` option since
systemd hardcodes it to `${rootprefix}/lib/systemd/system`.
2020-04-18 15:22:10 +01:00
Jan Tojnar
0f035013df build: Install bash-completion relative to datadir
Since bash-completion 2.9, it was no longer possible to override
the completionsdir through prefix. [1] In 2.10, the overridability
was re-estabilished but this time through datadir variable. [2]

This should not really matter except for developers installing the project
into a custom prefix or distros using per-package prefixes like NixOS.

[1]: 81ba2c7e7d
[2]: https://github.com/scop/bash-completion/pull/344
2020-04-16 12:45:19 -05:00
Mario Limonciello
c727742df3 trivial: remove references to hardware.py (Fixes: #2007) 2020-04-15 20:27:21 -05:00
Jan Tojnar
2f12e38e61 build: Re-use installed tests directory
It will make it easier for downstreams to patch the path.
2020-04-15 20:16:46 +01:00
Richard Hughes
a3d6ee0e29 Release fwupd 1.4.0 2020-04-14 10:27:32 +01:00
Richard Hughes
b47d347823 trivial: Add some more self tests 2020-04-09 16:55:17 +01:00
Richard Hughes
0e8ee75890 trivial: Add some more device regression tests 2020-04-09 09:55:30 +01:00
Richard Hughes
d668225685 trivial: Allow filtering the device-test by the protocol
This allows us to run the device tests with all 4 supported types of unifying
dongles plugged in at the same time.
2020-04-09 09:07:13 +01:00
Richard Hughes
b452c752aa trivial: Add some more device regression tests 2020-04-08 16:52:22 +01:00
Richard Hughes
854e6f6362 Add some more device regression tests 2020-04-08 13:55:39 +01:00
Richard Hughes
372565aef8 trivial: Show what device test is being run right now 2020-04-08 13:55:39 +01:00
Richard Hughes
f3966c784d Modularize the hardware tests 2020-04-07 16:09:47 +01:00
Ross Burton
d783c3a531 Install the installed-tests only if tests are enabled
The README says: "A test suite that can be used to interact with a fake device is installed when configured with `-Ddaemon=true` and `-Dtests=true`", so actually only install these tests when tests are enabled.
2020-04-06 12:16:52 -05:00
Paul Menzel
bf1b876e56 data/motd/fwupd-refresh: Only order after network.target
From [Lennart’s answer on systemd-devel][1]:

> fwupd.target should not list the various network management solutions,
> that is unnecessary, and ordering after network.target should be
> sufficient to achieve the same, in a generic fashion. i.e. network
> managers should order themselves before network.target, so that
> ordering yourself after that automatically orders you after all
> implementations at once...

So, remove the unneeded targets. As the service unit is not
installed/enabled, and instead called by a timer, the system will most
probably be online already.

[1]: https://lists.freedesktop.org/archives/systemd-devel/2020-March/044205.html
     "Best practices for starting unit only if network is online"
2020-04-01 13:14:41 -05:00
Mario Limonciello
4fa95a7b51 Add a new daemon configuration option to control EnumerateAllDevices
For plugins that are configured to only enumerate devices supported
by metadata this will allow showing them in all contexts

Fixes: #1877
2020-03-31 13:05:57 -05:00
Filipe Laíns
674478d4b8 bash: add completion for fwupdtool reinstall
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-03-31 10:46:40 +01:00
Richard Hughes
d5aab65f30 Use Jcat files in firmware archives and for metadata
A Jcat file can be used to store GPG, PKCS-7 and SHA-256 checksums for multiple
files. This allows us to sign a firmware or metadata multiple times (perhaps
by the OEM and also then the LVFS) which further decentralizes the trust model
of the LVFS.

The Jcat format was chosen as the Microsoft catalog format is nonfree and not
documented. We also don't want to modify an existing .cat file created from WU
as this may make it unsuitable to use on Windows.

More information can be found here: https://github.com/hughsie/libjcat
2020-03-23 19:55:12 +00:00
exploide
b3c8bc4010 trivial: update command consumes device ids in fish shell completion 2020-03-17 19:12:00 +00:00
Richard Hughes
bca63edccf Add 'firmware-convert' subcommand to fwupdtool
This is a useful function that allows us to use all the fwupdplugin loaders.
2020-03-09 21:12:01 +00:00
Mario Limonciello
789d308f79 trivial: only install bash-completion for fwupdmgr if compiled with agent
`fwupdmgr`'s bash completion now uses `fwupdagent` for at least one command.
2020-03-06 18:42:00 +00:00
Mario Limonciello
b87d48a042 When TPM PCR0 measurements fail, query if secure boot is available and enabled
If the measurements are missing but it's a UEFI system, it's a good indication
that the user has secure boot turned off.
Notify the user on the UEFI device through a non-fatal `UpdateMessage`

To accomplish this, move fu-uefi-vars into the plugin library for other plugins to use
2020-03-05 07:54:15 -06:00
Dennis Kadioglu
d9597df863 fix fwupd.shutdown.in according to the movement of fwupdtool to bindir 2020-03-05 07:09:25 -06:00
Mario Limonciello
428ed8a0b2 trivial: Fix bash completion
`get-devices` and `get-remotes` output changed in the past.
It would be ideal to use `jq` instead, but it's not available by
default in most distros.
2020-03-04 08:03:19 -06:00
exploide
dfd7870697 improved fish shell completion 2020-03-03 13:01:50 -06:00
exploide
c33fbb5002 added completion script for fish shell 2020-02-29 16:31:50 +00:00
Richard Hughes
ffa9e6ce25 Release fwupd 1.3.8 2020-02-13 14:30:35 +00:00
Richard Hughes
4f28afb6e7 trivial: Only install the udev rules file if GUdev is enabled 2020-02-05 09:54:12 +00:00
Mario Limonciello
9dce1f7011 Detect kernel lockdown status
Disable superio when kernel lockdown in effect.
2020-02-04 10:08:25 -06:00
Mario Limonciello
5d8c244b2e trivial: correct a fwupd-refresh.service filling error 2020-02-02 11:27:20 +00:00
Richard Hughes
ca3cdaef43 Release fwupd 1.3.7 2020-01-31 13:13:57 +00:00
Richard Hughes
4959baa65b Add 'refresh' to fwupdtool
This actually makes 'get-updates' do something useful when using the flatpak.
2020-01-17 16:33:07 +00:00
Richard Hughes
fd7e994971 Add 'get-remotes' to fwupdtool 2020-01-17 16:33:07 +00:00
Mario Limonciello
315fd4dee9 trivial: motd: correct the systemd path to include package name 2020-01-16 21:00:47 -06:00
Mario Limonciello
4fdbb118a4 trivial: correct systemd motd directory variable
fixes the blank variable in systemd unit
2020-01-16 20:50:13 -06:00
Richard Hughes
56d0d51e00 trivial: Actually install daemon.conf for the standalone build too
The name is a bit of a misnomer, it really affects anything that loads FuEngine.
2020-01-16 12:23:08 -06:00
Mario Limonciello
d81ea2e3fc Move MOTD population into the daemon
This allows it to be refreshed anytime the daemon updates rather
than once a day by a systemd job.

As part of this change, remove the logging from `fwupdmgr` which
was only used for motd purposes.
2020-01-16 10:33:43 -06:00
Richard Hughes
0e830d9c10 trivial: Fix typo in fwupdtool bash completion command name 2020-01-14 12:25:41 +00:00
Richard Hughes
3c314e3b83 Allow getting the list of updates in JSON format from fwupdagent 2020-01-14 12:25:41 +00:00
Richard Hughes
af14073522 Allow applying all releases to get to a target version
Some hardware does not handle upgrading from version 1.2.2 to 1.2.4 and instead
needs to be upgraded from 1.2.2->1.2.3->1.2.4 so that on-device metadata can be
migrated correctly.

Add a new per-device flag `install-all-releases` which causes the daemon to not
skip directly to the newest release. This is designed to be set from a quirk
file.

This can obviously only be used for devices that can apply firmware "live" and
thus do not need a reboot or system shutdown to actually apply the firmware.
This also needs the cabinet archive to ship multiple versions of the firmware,
and for the metainfo.xml file to refer to multiple release objects.
2020-01-07 15:33:12 +00:00
Richard Hughes
1ac566bc09 Release fwupd 1.3.6 2019-12-30 09:19:41 +00:00
Mario Limonciello
62b8336383 trivial: fu-remotes-list: drop usage of FU_SELF_TEST_REMOTES_DIR
Instead use `CONFIGURATION_DIRECTORY`, which already supported by
`fu-common`.
2019-12-12 13:23:13 -06:00
Richard Hughes
297d1598ef trivial: Only dlopen the test plugin once
This causes problems in the self tests when not lazy-loading symbols.

Also use g_build_filename() for the paths to be more portable and readable.
2019-12-01 20:59:19 +00:00
Mario Limonciello
19d948ea39 trivial: installed-tests: try to display journal for failed tests
This should help make debugging from CI infrastructures such as
autopkgtest easier.
2019-12-01 06:23:27 -06:00
Mario Limonciello
708f490075 trivial: installed-tests: explicitly choose webcam device ID
In some CI infrastructures other devices show up and so the webcam
is not automatically picked.

```
Enabling fwupd-tests remote...
Successfully enabled remote
Update the device hash database...
Choose a device:
0.	Cancel
1.	08d460be0f1f9f128413f816022a6439e0078018 (Integrated Webcam™)
2.	bbbf1ce3d1cf15550c3760b354592040292415bb (Virtio network device)
Request canceled
FAIL: fwupd/fwupdmgr.test (Child process exited with code 2)
SUMMARY: total=1; passed=0; skipped=0; failed=1; user=0.0s; system=0.0s; maxrss=11736
FAIL: fwupd/fwupdmgr.test (Child process exited with code 2)
autopkgtest [22:09:32]: test ci: -----------------------]
ci                   FAIL non-zero exit status 2
autopkgtest [22:09:33]: test ci:  - - - - - - - - - - results - - - - - - - - - -
autopkgtest [22:09:33]: @@@@@@@@@@@@@@@@@@@@ summary
ci                   FAIL non-zero exit status 2
```
2019-12-01 06:23:27 -06:00
Richard Hughes
713d20f79f Release fwupd 1.3.5 2019-11-29 12:56:50 +00:00
Leo
6640b571bf Fix shebangs on scripts 2019-11-24 18:51:56 -06:00
Richard Hughes
342a38b432 Release fwupd 1.3.4 2019-11-22 16:00:40 +00:00
Ken VanDine
d5988a5339 Allows confined snaps to activate fwupd via D-Bus 2019-11-12 12:40:08 -06:00
Mario Limonciello
5123d4333e Rename unifying plugin to logitech-hidpp (Fixes: #1329) 2019-11-04 13:35:36 -06:00
Richard Hughes
f6526ddb63 Release fwupd 1.3.3 2019-11-01 15:06:16 +00:00
Richard Hughes
02792c0ba3 trivial: Fix up some typos from codespell 2019-11-01 14:21:20 +00:00
Mario Limonciello
98b951688a Use device safety flags to show prompts before installing updates 2019-10-30 11:30:36 -05:00
Richard Hughes
a58510b246 Allow verifying the device image itself from fwupdtool
To debug flashing failures it's sometimes requried to get a SPI dump of the
hardware to analysis.

Add a debug-only command that lets us dump the device from the engine.
2019-10-30 13:55:55 +00:00
Richard Hughes
51a869a01d Use XMLb to query quirks
During startup we do 1898 persistent allocations to load the quirk files, which
equates to ~90kb of RSS. Use libxmlb to create a mmap'able store we can query
with XPath queries at runtime.
2019-10-30 08:29:58 -05:00
Richard Hughes
95c98a95b6 Allow fwupdtool to dump details of common firmware formats
To do this, the plugins have to register the GType(s) they are using for
firmware, along with a short 'id' that can be used in CLI scripts.
2019-10-22 12:36:15 -05:00
Mario Limonciello
0b9bfec150 Add a systemd preset file for fwupd-refresh.service
Makes `fwupd-refresh.service` strictly opt-in.

Some distros are defaulting to all systemd services on and causing
more refreshes than desirable by default, especially when using
both `gnome-software` and `fwupd-refresh.service`
2019-10-20 14:31:13 -05:00
Mario Limonciello
561751faff trivial: don't try to enable LVFS from systemd 2019-10-18 09:21:19 -05:00
Mario Limonciello
80d6581be8 trivial: fwupd-refresh: activate motd if using systemd v243 or later
It turns out there is some bug in systemd v242 or less that runtime
directories can't be used.  So only populate motd when we know that
we have a newer systemd
2019-10-15 15:56:33 -05:00
Mario Limonciello
2a4fa179ff trivial: fwupd-refresh: allow exit code 2 for success
This is no supported devices, and shouldn't cause systemd failures
for fwupd-refresh.
2019-10-15 15:56:33 -05:00
Richard Hughes
c0695320c8 Add a generic DFU firmware object for plugins to use 2019-10-11 13:19:46 +01:00
Mario Limonciello
d837ca8c28 fu-util: add support for a reinstall command 2019-10-03 08:16:41 -05:00
Mario Limonciello
34c366aab2 Add support for automatically uploading reports 2019-09-30 16:21:23 -05:00
Mario Limonciello
4f13bbc7e3 trivial: motd: disable updating motd for now
It looks like a systemd bug is happening, but let it be diagnosed upstream
systemd first.

https://github.com/systemd/systemd/issues/13688
2019-09-30 14:09:18 -05:00
Mario Limonciello
dc7e7c3808 trivial: fwupd-refresh: fix a clash with fwupd.service (Closes: #941360)
`fwupd-refresh.service` uses `DynamicUser=true` which causes systemd
to make `/var/cache/fwupd` a symlink to `/var/cache/private/fwupd`.

Individual units aren't allowed to access this directory, only the ones
with the directive.  This means that `fwupd.service` stops working as
soon as a user tries to start `fwupd-refresh.service`.

The bug details are present in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941360
2019-09-30 14:09:18 -05:00
Richard Hughes
0d8efd2373 Release fwupd 1.3.2 2019-09-26 11:05:06 +01:00
worldofpeace
41a25be6f4 Move D-Bus conf file to datadir/dbus-1/system.d
Since D-Bus 1.9.18 configuration files installed by third-party should
go in share/dbus-1/system.d. The old location is for sysadmin overrides.
2019-09-16 16:37:06 +01:00
Richard Hughes
67ad8d0d22 Release fwupd 1.3.1 2019-09-13 10:58:38 +01:00
Richard Hughes
fbff921b35 Allow disabling all plugins
This allows us to easily build just libfwupd in a flatpak manifest without
installing dozens of deps to build things we're just going to delete anyway.
2019-09-13 10:27:57 +01:00
Richard Hughes
0e46b22728 Allow disabling SSL strict mode for broken corporate proxies 2019-09-05 19:14:38 +01:00
Mario Limonciello
dfff18e3e8 Add aliases for get-upgrades and upgrade
Mostly for consistency purpose.  Details:
* It's confusing that internally the functions for `FwupdClient` use
`upgrade` in the name.
* The logical antonym of `downgrade` is `upgrade` not `update`
* People who don't use the tool frequently may try `get-upgrades`
2019-08-29 19:14:55 +01:00
Mario Limonciello
921e426f5a Use more systemd directives for directories
systemd will automatically create these directories if missing
and also will set permissions accordingly on them.
2019-08-27 06:08:06 -05:00
Mario Limonciello
71d2f62dc2 trivial: update references of hughsie/fwupd to fwupd/fwupd 2019-08-22 09:47:52 -05:00
Mario Limonciello
b390b14f8f Add support to integrate into the motd (Fixes: #1270)
Fixes Debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=921820

Introduce a new --log option to fwupdmgr that will log stdout to an argument.
If run under systemd, prefix that argument with $RUNTIME_DIRECTORY.

Add a new systemd unit and associated timer to regularly refresh metadata.
After the metadata refresh is complete, save the output to the motd location.

The timer and service are disabled by default and can be enabled by an admin.
2019-08-22 06:39:02 +01:00
Richard Hughes
7afd7cba0d Use FuFirmware as a container for firmware images
In many plugins we've wanted to use ->prepare_firmware() to parse the firmware
ahead of ->detach() and ->write_firmware() but this has the limitation that it
can only return a single blob of data.

For many devices, multiple binary blobs are required from one parsed image,
for instance providing signatures, config and data blobs that have to be pushed
to the device in different way.

This also means we parse the firmware *before* we ask the user to detach.

Break the internal FuDevice API to support these firmware types as they become
more popular.

This also allows us to move the Intel HEX and SREC parsing out of the dfu plugin
as they are used by a few plugins now, and resolving symbols between plugins
isn't exactly awesome.
2019-08-08 13:10:57 +01:00
Richard Hughes
747f570310 Allow filtering devices when using the command line tools 2019-08-06 20:59:28 +01:00
Mario Limonciello
00aabbf78b trivial: add cache directory into systemd unit rw paths 2019-08-01 07:50:02 +01:00
Richard Hughes
80e02dfe21 Release fwupd 1.2.10 2019-07-15 19:25:54 +01:00
Richard Hughes
4808c0ebad Release fwupd 1.2.9 2019-05-20 11:17:42 +01:00
Mario Limonciello
e1b4b20978 Dynamically read path to use for /system-update
This allows `fwupdoffline` to work in installations that don't use
`/var/lib/fwupd`.
2019-05-01 09:24:55 -05:00