Commit Graph

124 Commits

Author SHA1 Message Date
Mario Limonciello
eb7be16bf0 fu-util/fu-tool: Group devices in get-updates/update calls
Fixes: #1840
2020-07-03 11:58:34 -05: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
df89cd566e Allow firmware to require specific features from front-end clients
At the moment we just blindly assume the capabilities of the front-end client
when installing firmware. We can somewhat work around by requiring a new enough
fwupd daemon version, but the client software may be older or just incomplete.

This would allow, for instance, the firmware to specify that it requries the
client to be able to show a detach image. This would not be set by a command
line tool using FwupdClient, but would be set by a GUI client that is capable
of downloading a URL and showing a PNG image.

Clients that do not register features are assumed to be dumb.
2020-06-27 15:43:57 +01:00
Richard Hughes
c5710d91bd Be more defensive when remotes are missing required keys
Fixes half of https://github.com/fwupd/fwupd/issues/2223
2020-06-26 12:29:08 +01:00
Richard Hughes
56e7ae503a trivial: Remove the GError from fu_engine_get_host_security_attrs()
It cannot fail.
2020-05-18 11:24:50 +01:00
Richard Hughes
f58ac7316c hsi: Abstract out the list of FwupdSecurityAttr objects for plugins
This exports FuSecurityAttrs into libfwupdplugin so that we can pass the plugins
this object rather than a 'bare' GPtrArray. This greatly simplifies the object
ownership, and also allows us to check the object type before adding.

In the future we could also check for duplicate appstream IDs or missing
properties at insertion time.

This change also changes the fu_plugin_add_security_attrs() to not return an
error. This forces the plugin to handle the error, storing the failure in the
attribute itself.

Only the plugin know if a missing file it needs to read indicates a runtime
problem or a simple failure to obtain a specific HSI level.
2020-05-12 16:47:24 +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
890963108e Clarify invalid arguments display (Fixes: #2045)
Avoid a wall of text and instead direct people to `--help` output.
Also sync up this section of code between `fu-util.c` and `fu-tool.c`
2020-04-30 14:20:36 -05:00
Richard Hughes
9c09e2c9bc trivial: Fix some recent NULL/FALSE confusion 2020-04-22 10:53:59 +01:00
Mario Limonciello
c6009f59fe trivial: fu-util/fu-tool: check for '-' in arguments
Make sure if something doesn't look like a duck that it's not a duck.
2020-04-21 09:04:50 +01:00
Mario Limonciello
9917bb44bc trivial: fu-tool: correct a reference to wrong device ID when using GUID
When finding the device by GUID we need to do a lookup first.
2020-04-20 13:42:31 -05:00
Mario Limonciello
aac9c74ec6 trivial: fu-tool: correct an infinite loop from 3aaf53c6f0 2020-04-20 13:39:17 -05:00
Richard Hughes
3aaf53c6f0 Allow specifying the device on the command line by GUID
The GUID is the only stable identifier, and allowing using the GUID makes it
much easier to test specific devices.
2020-04-20 18:45:45 +01:00
Richard Hughes
ee562b5164 Ignore indirect devices that replug during the composite firmware update
This fixes the confusing case where installing the CCGX firmware on a dock
would reboot the hub, leading to this output:

Installing on USB-I2C Bridge…                                    ]
Installing on USB2.0 Hub…[************************************** ]
Installing on USB3.1 Hub…[************************************** ]
Installing on USB2.0 Hub…[************************************** ]
Installing on USB3.1 Hub…[************************************** ]
Installing on ThinkPad USB-C Dock Gen2 USB Audio…*************** ]
Installing on USB-I2C Bridge…*********************************** ]
Restarting device…       [***************************************]

With the patch, this is now:

Installing on USB-I2C Bridge…                                    ]
Restarting device…       [***************************************]
2020-04-07 15:04:01 +01:00
Richard Hughes
f1fa73e349 trivial: Allow using --force with install-blob 2020-04-06 14:36:46 -05:00
Filipe Laíns
b2f377a00c fu-tool: add reinstall command
Closes #1914

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
Richard Hughes
09a4f7559c Add the optional device-id to the update --help output
Fixes https://github.com/fwupd/fwupd/issues/1870
2020-03-17 13:03:16 +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
537da0e98b fu-engine: Make two passes of requirements checking
Resolves installation for local CAB files that have `VersionFormat`
    set but not yet also set from metadata.

    In the first pass ignore the version format. This will rule out all
    other checks such as GUID and protocol.

    Then apply version format to the device if specified in the CAB.
    Lastly do a second pass with all requirements set.
2020-03-09 15:54:30 -05:00
Mario Limonciello
2a0c066a2f trivial: remove unused variables 2020-03-05 09:40:05 -06:00
Mario Limonciello
984e29ca33 fu-tool: Correctly append the release to devices in get-details
Previously the device would helpfully show nothing about the CAB
when you ran `get-details` using `fwupdtool`.
2020-02-26 08:47:43 -06:00
Mario Limonciello
dc0608dea4 For the get-details command make sure to always show devices
This was likely an existing bug; but if running `get-details` on a CAB
for a device not in your system it would be filtered by default device
filters.
2020-02-26 08:47:43 -06:00
Mario Limonciello
dc9a1a8512 trivial: fwupdtool: fix tree title
The title isn't initialized until the engine is started, so don't
try to read it too early.
2020-02-20 14:31:14 -06:00
Mario Limonciello
27164b70b6 Discard the reason upgrades aren't available (Fixes: #1678)
Also fixes: #1792
2020-02-20 09:40:52 -06: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
Richard Hughes
429f72b214 Fix display of UTF-8 characters on Windows 2020-01-16 12:23:08 -06:00
Mario Limonciello
234c864ea4 trivial: fu-util/fu-tool: Unify usage of - and _ in help output (Fixes: #1662) 2020-01-08 20:07:29 -06:00
Richard Hughes
0ef47201eb Set the FwupdDevice parents in fwupdtool
This requires splitting out a helper function as a new symbol so it can be used
without fwupd_device_array_from_variant().
2020-01-06 15:16:48 +00:00
Mario Limonciello
7e4949c4f8 Clarify error messages when no upgrades available 2019-12-09 10:45:49 -06:00
dkadioglu
1db7e987ae Throw exit status 0 (instead of 2) if there is no firmware to be updated
see #1635
2019-12-04 14:42:13 -06:00
Richard Hughes
45a00738d8 Allow building on Windows with MinGW
Add various fixes to enable us to build a selection of useful USB plugins.
Also, skip tests that don't make sense on WIN32 or that will not work.

With much help from Mario Limonciello <mario.limonciello@dell.com> -- Thanks!
2019-12-03 16:33:43 +00:00
Mario Limonciello
6b0e66354b Convert libfwupdprivate to a shared library libfwupdplugin 2019-11-27 11:32:43 +00:00
Richard Hughes
7d82a09808 trivial: Fix under-include to define O_RDONLY 2019-11-26 17:15:45 +00:00
Richard Hughes
9e5675e1b4 trivial: Allow compiling without <glib-unix.h> 2019-11-26 17:15:45 +00:00
Richard Hughes
668ee21567 trivial: Use prefixes for DATADIR in config.h for portability
DATADIR is an enumerated type in MinGW, and the other names are very generic.
2019-11-24 14:17:38 -06:00
Richard Hughes
01c0badd38 trivial: Allow compiling without getuid() 2019-11-23 17:07:53 +00:00
Mario Limonciello
0f109b0d97 trivial: fu-util/fu-tool: explicitly block unsupported flags
Recently had a discussion on the expected behavior of calling
`#fwupdmgr update`/`fwupdtool update` with `--allow-reinstall`
in place.

It wasn't working which was confusing to the reporter, but I
feel that flag should only be usable with `install`.  Upgrades
are for upgrades and downgrades are for downgrades.  Reinstalls are
for reinstall.
2019-11-14 11:06:11 -06: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
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
a61b4d88c9 trivial: fu-tool: Allow detach/attach to prompt for device
Makes using `fwupdtool detach` easier to use.
2019-10-22 09:12:26 -05:00
Mario Limonciello
8692d01cf9 trivial: fu-tool: typo 2019-10-13 07:30:43 +01:00
Mario Limonciello
350fc4c787 trivial: fu-util/fu-tool: update re-install help text to reinstall 2019-10-03 08:16:41 -05:00
Mario Limonciello
ce94d163f8 fu-util/fu-tool: Map out changelogs from remotes
If the data is there, try to show the changelog that matches the
release.
2019-09-20 16:02:55 -05:00
Mario Limonciello
3be596b907 fu-util/fu-tool: Better display historical information
* When firmware has been modified use the device key "Previous version"
  instead of "Current version".
* Show release as a child node when looking at history
* Don't output empty flags for release
* Use the key "New version" for releases

Sample output from `get-history`
```
├Integrated Webcam™:
│ │   Device ID:           08d460be0f1f9f128413f816022a6439e0078018
│ │   Previous version:    1.2.2
│ │   Update State:        success
│ │   Flags:               updatable
│ │   Last modified:       2019-09-20 14:53
│ │   GUID:                b585990a-003e-5270-89d5-3705a17f9a43
│ │
│ └  New version:       1.2.3
│
└Integrated Webcam™:
  │   Device ID:           08d460be0f1f9f128413f816022a6439e0078018
  │   Modified version:    1.2.2
  │   Update State:        success
  │   Flags:               updatable
  │   Last modified:       2019-09-20 14:53
  │   GUID:                b585990a-003e-5270-89d5-3705a17f9a43
  │
  └  New version:       1.2.4
```

Sample output from `get-updates`
```
Integrated Webcam™:
  │   Device ID:           08d460be0f1f9f128413f816022a6439e0078018
  │   Summary:             A fake webcam
  │   Current version:     1.2.2
  │   Previous Version:     1.2.0
  │   Bootloader Version:  0.1.2
  │   Vendor:              ACME Corp. (USB:0x046D)
  │   Flags:               updatable|supported|registered
  │   GUID:                b585990a-003e-5270-89d5-3705a17f9a43
  │
  ├FakeDevice Firmware:
  │     New version:       1.2.4
  │     Remote ID:         fwupd-tests
  │     Summary:           Firmware for the ACME Corp Integrated Webcam
  │     License:           GPL-2.0+
  │     Size:              17 bytes
  │     Vendor:            ACME Corp
  │     Flags:             is-upgrade
  │     Description:       Fixes another bug with the flux capacitor to prevent time going backwards.
  │
  └FakeDevice Firmware:
        New version:       1.2.3
        Remote ID:         fwupd-tests
        Summary:           Firmware for the ACME Corp Integrated Webcam
        License:           GPL-2.0+
        Size:              17 bytes
        Vendor:            ACME Corp
        Flags:             is-upgrade
        Description:       Fixes a bug with the flux capacitor to avoid year 2038 overflow.
```
2019-09-20 16:02:55 -05:00
Filipe Laíns
e091427993 trivial: fix wget command in fu-tool.c
-o <arg> will redirect stdout to <arg>, -O <arg> what we want to be
using, it saves the file to <arg>.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-09-20 10:08:56 +01:00
Richard Hughes
0e46b22728 Allow disabling SSL strict mode for broken corporate proxies 2019-09-05 19:14:38 +01:00