Commit Graph

324 Commits

Author SHA1 Message Date
Richard Hughes
e076d48afb trivial: Fix some invalid error handling in fwupdmgr
If somehow we forget to add a case section, return with an error as the code
suggests, rather than always returning TRUE. Found with Coverity.
2020-02-07 15:16:39 +00: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
Mario Limonciello
eb442ea9a5 fu-util: Discourage metadata refreshes more than once per day
As the motd timer may be activated to run on a system, ensure that
it hasn't actually stepped on the user running an update manually
or another client such as gnome-software refreshing metadtata.

Users can override this behavior with `--force`.
2020-01-16 10:33:43 -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
Mario Limonciello
7e4949c4f8 Clarify error messages when no upgrades available 2019-12-09 10:45:49 -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
Francois Berder
15daf69ad9 Fix shifting integer by more than 31 in fu_util_filter_device
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
2019-11-29 06:33:09 -06:00
Richard Hughes
9e5675e1b4 trivial: Allow compiling without <glib-unix.h> 2019-11-26 17:15:45 +00:00
Richard Hughes
1665837e78 Make gudev a compile-time option
This should make it nearly possible to build fwupd on FreeBSD.
2019-11-25 09:29:46 +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
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
Mario Limonciello
eb4c76416c Add a new property Interactive to the daemon
Clients can use this as a hint whether the daemon is running on
a terminal.

`fwupdmgr` uses this to bypass the systemd service check.
2019-11-11 11:16:21 -06:00
Mario Limonciello
429a5128d3 Dynamically determine release version
This is inspired by a change in flashrom to read the version string for meson
dynamically.

No need for "post release version bump", this happens automatically from git
now by there being a dirty commit.
2019-11-08 09:52:02 -06:00
Richard Hughes
9fcd29f92e trivial: Fix fwupdmgr get-history if the firmware was not installed from the LVFS
If you install a local .cab file that's not available on the LVFS then none
of the history for any devices is available.
2019-11-01 08:16:18 -05:00
Mario Limonciello
98b951688a Use device safety flags to show prompts before installing updates 2019-10-30 11:30:36 -05:00
Mario Limonciello
0a956799ed trivial: fu-util: fix typo 2019-10-25 09:16:11 -05:00
Mario Limonciello
561751faff trivial: don't try to enable LVFS from systemd 2019-10-18 09:21:19 -05:00
Mario Limonciello
326950cd68 trivial: fu-util: break out of automatic reports if one is not automatic
Currently this is controlled by the order of remotes enumerated and might
return the wrong result with too many remotes.
2019-10-16 10:13:10 -05:00
Mario Limonciello
1d01d3bb38 Fix device flag filtering
When multiple flags were passed, they made combinations that would never
exist in the daemon causing advanced filtering to not work.
2019-10-14 12:41:09 -05:00
Mario Limonciello
8fa0b382fa Add new flags can-verify and can-verify-image
These are used to indicate that the device can verify checksums or
can dump an image for checksumming.
2019-10-14 12:41:09 -05:00
Mario Limonciello
49556a3948 trivial: make verify and verify-update safer
Don't show output for all devices - it doesn't work for most of them.

I also found that running verify on my Synaptics touchpad device puts it
into a pretty bad state until reboot.  That's of course a problem on
it's own, but at least prompting for it will prevent it from easily
happening.
2019-10-14 12:41:09 -05:00
Mario Limonciello
e202a39851 trivial: fu-util: add some extra checks around automatic reports
Avoid some extra roundtrips to the daemon if user has poked at some
files.
2019-10-13 07:34:09 +01:00
Mario Limonciello
d70260692f trivial: fu-engine: fix never reporting remotes
```
Uploading firmware reports helps hardware vendors to quickly identify failing and successful updates on real devices.
Upload report now? (Requires internet connection):
0.	Do not upload reports at this time, but prompt again for future updates
1.	Do not upload reports, and never ask to upload reports for future updates
2.	Upload reports just this one time, but prompt again for future updates
3.	Upload reports this time and automatically upload reports after completing future updates
1
key ReportUri not supported
```
2019-10-07 05:36:22 -05:00
Mario Limonciello
9213c5c7bf trivial: fu-util: don't show warnings for no reports to upload
```
(fwupdmgr:5605): FuMain-WARNING **: 22:16:06.048: No reports require uploading
```
2019-10-07 05:36:22 -05:00
Mario Limonciello
d837ca8c28 fu-util: add support for a reinstall command 2019-10-03 08:16:41 -05: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
f59cc375ae trivial: fu-util: remove double printed message about succesful firmware update 2019-10-03 08:16:41 -05:00
Mario Limonciello
d122facc09 trivial: fu-util: show no updatable devices error for update command
This makes it mirror the behavior of `get-updates` command.
2019-10-03 08:16:41 -05:00
Mario Limonciello
2b69098d89 trivial: fu-util: output newline after prompt.
Before:
```
Uploading firmware reports helps hardware vendors to quickly identify failing and successful updates on real devices.
Upload report now? (Requires internet connection):0.	Do not upload reports at this time, but prompt again for future updates
1.	Do not upload reports, and never ask to upload reports for future updates
2.	Upload reports just this one time, but prompt again for future updates
3.	Upload reports this time and automatically upload reports after completing future updates
```

After:
```
Uploading firmware reports helps hardware vendors to quickly identify failing and successful updates on real devices.
Upload report now? (Requires internet connection):
0.	Do not upload reports at this time, but prompt again for future updates
1.	Do not upload reports, and never ask to upload reports for future updates
2.	Upload reports just this one time, but prompt again for future updates
3.	Upload reports this time and automatically upload reports after completing future updates
```
2019-10-01 16:07:48 -05:00
Mario Limonciello
fac50a8eef trivial: fix %u output in report upload
Don't bother showing the numbers, they were listed right above.
2019-10-01 16:07:48 -05:00
Mario Limonciello
34c366aab2 Add support for automatically uploading reports 2019-09-30 16:21:23 -05:00
Richard Hughes
c56d2bd046 Add some success messages when CLI tasks have completed
Updating firware is sometimes scary, and for user-facing CLI tools we ought to
show some kind of reassurance than it went well.

Fixes some of https://github.com/fwupd/fwupd/issues/1409
2019-09-27 12:20:00 -05:00
Richard Hughes
bcee63a52d trivial: Put the boolean prompt on the same line as the text 2019-09-27 12:20:00 -05:00
Richard Hughes
f1accad201 Do not ask the user to upload a report if ReportURI is not set
Fixes https://github.com/fwupd/fwupd/issues/1400
2019-09-25 05:05:31 -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
Richard Hughes
0e46b22728 Allow disabling SSL strict mode for broken corporate proxies 2019-09-05 19:14:38 +01:00
Richard Hughes
c4ee883ea4 trivial: Allow ignoring the daemon version check by using --force 2019-09-05 18:13:05 +01:00
Mario Limonciello
20cc9eebc5 Try to only show DMI product name once
* libfwupd: export new property HostProduct
* clients: Use this property for setting the title of trees

Before:
```
○
├─XPS 13 7390 TPM 2.0:
│     Device ID:           c56e9f77cfee65151bdef90310776f9d62827f5a
│     Summary:             Platform TPM device
│     Current version:     7.2.1.0
│     Vendor:              Dell Inc.
│     Update Error:        Updating disabled due to TPM ownership
│     Flags:               internal|require-ac|registered
└─XPS 13 7390 System Firmware:
      Device ID:           b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2
      Current version:     0.1.1.1
      Minimum Version:     0.1.1.1
      Vendor:              Dell Inc.
      Flags:               internal|updatable|require-ac|registered|needs-reboot

```

After:
```
XPS 13 7390
│
├─TPM 2.0:
│     Device ID:           c56e9f77cfee65151bdef90310776f9d62827f5a
│     Summary:             Platform TPM device
│     Current version:     7.2.1.0
│     Vendor:              Dell Inc.
│     Update Error:        Updating disabled due to TPM ownership
│     Flags:               internal|require-ac|registered
└─System Firmware:
      Device ID:           b6c08fb9e5384d9d101853cc1ca20cf0ce2df2e2
      Current version:     0.1.1.1
      Minimum Version:     0.1.1.1
      Vendor:              Dell Inc.
      Flags:               internal|updatable|require-ac|registered|needs-reboot
```
2019-09-05 11:22:39 -05:00
Mario Limonciello
8e14544d37 fu-util: show release output in get-details again
This was lost in the move to tree output
```
$ fwupdmgr get-details tpm.cab
Decompressing…           [***************************************]
○
└─XPS 13 9380 TPM 2.0:
  │   Device ID:           1a433daa3acb71e6befadcf2b1a783c1549663b1
  │   Description:         Updating the system firmware improves performance.
  │
  │   Flags:               internal|updatable|require-ac|registered|needs-reboot
  │
  └─TPM 2.0 Update:
        Version:           7.2.0.2
        Summary:           Firmware for the Dell TPM 2.0
        License:           proprietary
        Size:              1.1 MB
        Vendor:            Dell Inc.
        Flags:             none
```
2019-09-05 00:09:40 -05:00
Mario Limonciello
4250d9da62 fu-util/fu-tool: Print devices, remotes, releases using a tree
This brings consistency to all fwupd output and allows stuff like
this:

```
    No upgrades for Thunderbolt controller in Dell dock, current is 43.00: 40.00=older
    No upgrades for Package level of Dell dock, current is 01.00.08.01: 01.00.04.01=older
    No upgrades for RTS5413 in Dell dock, current is 01.21: 01.21=same
    No upgrades for RTS5487 in Dell dock, current is 01.47: 01.47=same
    No upgrades for VMM5331 in Dell dock, current is 05.04.00: 05.03.10=older
    No upgrades for WD19TB, current is 01.00.00.02: 01.00.00.00=older
    ○
    └─XPS 13 9380 System Firmware:
      │   Device ID:           6c24a747f97668873b761558e322398a91dbf394
      │   Current version:     0.1.6.0
      │   Minimum Version:     0.1.6.0
      │   Vendor:              Dell Inc.
      │   Flags:               internal|updatable|require-ac|supported|registered|needs-reboot
      │
      └─XPS 13 9380 System Update:
            Version:           0.1.7.0
            Remote ID:         lvfs
            Summary:           Firmware for the Dell XPS 13 9380
            License:           proprietary
            Size:              0x1563d67
            Vendor:            Dell Inc.
            Flags:             is-upgrade
            Description:       This stable release fixes the following issues:

           Fixed the issue where the Dell Power Manager displays an error when a 130W Type-C adapter is connected to the system.

           new functionality has also been added:

           Added a new feature to automatically suspend BitLocker before upgrading the firmware. After the firmware upgrade is complete, BitLocker is automatically enabled.
```
2019-08-29 13:58:00 -05: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
1a9127d676 Make get-devices and get-topology aliases for one another
Since get-topology can now show all the details while in a topology,
just make both commands point to the same code.
2019-08-27 15:39:29 +01:00
Mario Limonciello
b76960efe0 trivial: fu-util: fix debug output for devices
I noticed this was only actually working for fwupdtool, and that's
because fwupdmgr doesn't set FWUPD_VERBOSE currently in the environment.
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
Mario Limonciello
fee8f499fc Simplify get-devices output to not show un-useful fields
This prevents showing things not generally useful to most people:
Created
Modified
Icon
Plugin
FlashesLeft
2019-08-21 16:12:17 -05:00
Mario Limonciello
d2afb59b42 trivial: If no devices support updates, show messaging (Closes: #1295)
Normally the flag 'supported' is used to indicate that devices can
update from a remote such as LVFS.

Running `#fwupdmgr get-updates` in this situation will show a message
for each device that is already up to date as well as messages for
devices that have updates available.

If no devices contain the supported flag, `# fwupdmgr get-updates`
will show no output, which is confusing to some people.

Show "No updatable devices" instead for those situations.
2019-08-21 22:05:24 +01:00
Richard Hughes
747f570310 Allow filtering devices when using the command line tools 2019-08-06 20:59:28 +01:00
Richard Hughes
7565baf3c0 Never show AppStream markup on the console 2019-07-31 16:34:02 +01:00