Commit Graph

1348 Commits

Author SHA1 Message Date
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
07184d3822 Never show LicenseRef-proprietary to the end user
Just provide a translated string for this most common of cases.
2019-09-27 12:24:28 +01:00
Richard Hughes
868db4e1a8 Export the instructions for detaching the device
Somewhat embarrassingly we were not actually showing the 8bitdo manual detach
images because... we were not actually exporting them. I don't know how this
ever worked in GNOME Software, but it would also explain the low 'success' rate
of the 8bitdo firmware on the LVFS.

This will also be used by Logitech in the future for the C1 Unifying devices.

To work in gnome-softare, this also needs the matching functionality to call
gs_app_add_screenshot() with the new exported data.
2019-09-26 16:40:12 +01:00
Richard Hughes
f54ddf42d4 Add support for '<name_variant_suffix>' to disambiguate some firmware 2019-09-25 10:20:10 -05:00
Richard Hughes
59593b0c50 thelio-io: Add a plugin to detach the Thelio IO board
This does not use the DFU runtime to detach.
2019-09-25 16:05:32 +01: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
Richard Hughes
e37575192d Do not enumerate physical devices when running the internal self tests
We don't need to enumerate USB and UDev devices in the self tests. In the case
where the probe fails (due to a permissions error, as not running as root) we
don't want the tests to fail.
2019-09-25 04:49:52 -05:00
Richard Hughes
0917fb6aec Export the salted machine ID as a daemon property 2019-09-23 17:34:47 +01:00
Richard Hughes
ae96a1f27f Align the key values to the text *width* not the number of bytes
This fixes the output when using locales like zh_CN.utf-8
2019-09-23 15:17:28 +01:00
Richard Hughes
17c02b8b1f trivial: Fix some NULL/FALSE confusion 2019-09-23 09:59:30 +01:00
Richard Hughes
6f627aba84 trivial: Fix tiny memory leak when using FuSrecFirmware 2019-09-23 09:59:19 +01:00
Mario Limonciello
1dbb82d25e trivial: fu-util-common: fix description wrapping (Fixes: #1378)
Embedded newline characters don't do so well.

Before:
```
└─XPS 13 9380 System Update:
      New version:         0.1.3.2
      Remote ID:           lvfs
      Summary:             Firmware for the Dell XPS 13 9380
      License:             proprietary
      Size:                19.9 MB
      Vendor:              Dell Inc.
      Flags:               is-downgrade|blocked-version
      Description:         This stable release fixes the following issues:

    �� Fixed an issue with Secure Boot Option ROM Signature Verification.
    �� Firmware updates to address security advisory INTEL-SA-00185 (CVE-2018-12188 CVE-2018-12190 CVE-2018-12191 CVE-2018-12192 CVE-2018-12199 CVE-2018-12198 CVE-2018-12200 CVE-2018-12187 CVE-2018-12196 CVE-2018-12185).
    �� Firmware updates to address security advisories INTEL-SA-00191(CVE-2018-12201, CVE-2018- 12202, CVE-2018-12203, CVE-2018-12205).

    me new functionality has also been added:

    �� Removed the option Always Allow Dell Docks from BIOS settings. Dell dock connection and the port behavior will be controlled via the USB and Thunderbolt Adapter configuration settings under operating system environment.
    �� Replaces Absolute Software service from Computrace to Absolute Persistence Module service.
    �� Supports Dell Dock Station WD19.
```

After:
```
└─XPS 13 9380 System Update:
      New version:         0.1.3.2
      Remote ID:           lvfs
      Summary:             Firmware for the Dell XPS 13 9380
      License:             proprietary
      Size:                19.9 MB
      Vendor:              Dell Inc.
      Flags:               is-downgrade|blocked-version
      Description:         This stable release fixes the following issues:

      • Fixed an issue with Secure Boot Option ROM Signature Verification.
      • Firmware updates to address security advisory INTEL-SA-00185 (CVE-2018-12188 CVE-2018-12190 CVE-2018-12191 CVE-2018-12192 CVE-2018-12199 CVE-2018-12198 CVE-2018-12200 CVE-2018-12187 CVE-2018-12196 CVE-2018-12185).
      • Firmware updates to address security advisories INTEL-SA-00191(CVE-2018-12201, CVE-2018- 12202, CVE-2018-12203, CVE-2018-12205).

      Some new functionality has also been added:

      • Removed the option Always Allow Dell Docks from BIOS settings. Dell dock connection and the port behavior will be controlled via the USB and Thunderbolt Adapter configuration settings under operating system environment.
      • Replaces Absolute Software service from Computrace to Absolute Persistence Module service.
      • Supports Dell Dock Station WD19.
```
2019-09-21 12:23:55 +01: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
Mario Limonciello
9ec074332f fu-history: Update device_modified in sql database during updates 2019-09-20 16:02:55 -05:00
Richard Hughes
80eb7bef8b trivial: Add some more defines to the srec parser
This makes it more helpful when subclassing it.
2019-09-20 18:23:49 +01: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
6819f9e461 Allow parsing a raw SREC file
At least two vendors are not using SREC according to the spec. They are using
it like a recipe to write specific values at specific addresses.

All the logic like line lengths and checksumming (and therefore all the various
checks for malicious firmware) are still valid, so provide a new function to
just tokenize the file and to not assign a padded image.
2019-09-20 09:59:32 +01:00
Richard Hughes
3901fa6bae Add some more debugging to the SREC and IHEX parsers
Additionally, change the reported line to be indexed from 1 (rather than 0) as
most text editors show line 1 as the first line.
2019-09-19 08:54:24 +01:00
Richard Hughes
38245ff194 Add fu_common_bytes_compare_raw() for future usage 2019-09-18 17:05:00 +01:00
Richard Hughes
aeb466de42 Call the set_quirk_kv() vfunc for the superclassed object
Although, we have to use the converted instance IDs rather than the GUIDs as
fu_device_setup() has not typically been called at this point.
2019-09-18 17:04:49 +01:00
Richard Hughes
0ad59cbc03 Support <issues> in AppStream metadata
When the LVFS switches over to outputting <issues> rather than appending to the
update description we need to be in a position to display the new data.
2019-09-17 13:48:44 +01:00
Richard Hughes
8b98b1cbd9 Do not crash when starting tpm2-abrmd
The value G_LOG_LEVEL_MASK includes debugging, which tpm2-abrmd is certainly
allowed to use.

Fixes https://github.com/fwupd/fwupd/issues/1353
2019-09-16 16:57:55 +01:00
Richard Hughes
ca8868e9fe trivial: Add fu_io_channel_write_byte_array() for future use 2019-09-16 11:36:59 +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
71db86f466 Re-introduce GUID support to fwupdmgr and fwupdtool
This reverts commit dca4d6a5d6.

I've had two vendors ask me why the GUIDs have disappeared from the device.
2019-09-11 13:00:16 +01:00
Richard Hughes
1984180592 Add a DMI quirk for the Minnowboard Turbot
The fwupd UEFI plugin refuses to start if bit 3 of the "BIOS Characteristics
Extension Byte 2" (13h) is cleared. Bit 3 is UEFI Specification is supported.

Also, double-check that /sys/firmware/efi does not exist before disabling the
plugin as other machines may be affected too. The quirk then acts to supress
the console warning about the broken SMBIOS value.

Fixes https://github.com/fwupd/fwupd/issues/1342
2019-09-10 20:39:45 +01: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
3996af38c8 trivial: fu-util-common: Show unknown devices as interesting devices
This restore `fwupdmgr get-details` working with nothing plugged in.
2019-09-05 11:22:39 -05:00
Mario Limonciello
26563d750f fu-util-common: strip all trailing whitespace in XML description
Before:
```
└─Thunderbolt controller in Dell dock:
  │   Device ID:           42b9e069d0b5515065cf4a32cec39552861439c9
  │   Description:         Updating the dock improves performance.
  │
  │   Flags:               updatable|require-ac|registered
  │
  └─Thunderbolt controller Update:
        Version:           43.00
        Summary:           Update for the Thunderbolt controller within a Dell dock
        License:           proprietary
        Size:              409.6 kB
        Vendor:            Dell Inc.
        Flags:             trusted-payload
```

After:
```
└─Thunderbolt controller in Dell dock:
  │   Device ID:           42b9e069d0b5515065cf4a32cec39552861439c9
  │   Description:         Updating the dock improves performance.
  │   Flags:               updatable|require-ac|registered
  │
  └─Thunderbolt controller Update:
        Version:           43.00
        Summary:           Update for the Thunderbolt controller within a Dell dock
        License:           proprietary
        Size:              409.6 kB
        Vendor:            Dell Inc.
        Flags:             trusted-payload

```
2019-09-05 00:09:40 -05:00
Mario Limonciello
ef3c766e1f trivial: fu-common: match all whitespace not just ' ' in fu_common_strstrip 2019-09-05 00:09:40 -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
d1681e6de5 libfwupd: Add a new private function fwupd_remote_set_remotes_dir
This allows the daemon to set the base directory to store remotes.

This fixes issues with systemd where the installation prefix was set
to soemthing not writable such as `/usr/local` but systemd
`STATE_DIRECTORY` doesn't match up.

```
$ fwupdmgr refresh
Fetching metadata https://cdn.fwupd.org/downloads/firmware.xml.gz
Downloading…             [***************************************] Less than one minute remaining…
Fetching signature https://cdn.fwupd.org/downloads/firmware.xml.gz.asc

Failed to update metadata for lvfs: Error creating directory /usr/local/var/lib/fwupd/remotes.d: Read-only file system
```

It should also hopefully help with immutable systems.
2019-08-29 11:44:32 -05:00
Richard Hughes
7831c76368 trivial: Fix up the GtkDoc Since lines for API only available in 1.3.x 2019-08-28 17:08:21 +01:00
Richard Hughes
f679e5efa8 Include the kernel release as a runtime version
Although not always useful (due to patches being backported) being able to
depend on a specific kernel version might save our bacon in the future.
2019-08-28 15:52:50 +01:00
Mario Limonciello
dca4d6a5d6 trivial: fu-util: Drop GUID support from get-devices
To the average user this is not a useful feature.  None of the command
line options will take a GUID as an argument.
Really it's an internal representation of device to firwmare upgrade CAB file.

This simplifies this output:
```
├─VMM3320 inside Dell WD15/TB16/TB18 wired Dock:
│     Device ID:           585c346c009da3cc19a400fb59a4ed8d0cbd0151
│     Summary:             Multi-Stream Transport Device
│     Current version:     3.12.002
│     Vendor:              Synaptics
│     Update State:        success
│     Flags:               updatable|registered
│     GUIDs:               c1e81f96-234e-597d-b9cb-6477d0652868
│                          152a9833-41e6-5c21-9dde-0ff8984f3e20
│                          c1e2bea5-4cf2-5f84-b965-533e8e5fea45
│                          0a52c8c7-26d5-59a0-ae44-6b00e276d775
│                          82460515-30d3-5cdf-be4c-571340842a10
│                          51000744-2de6-5a52-8a86-d5f69fd73d34
│                          d6072785-6fc0-5f83-9d49-11376e7f48b1
│                          6bc9fc61-618a-535f-a629-98345e11336e
│                          4e4e06b6-8217-5cf0-8eff-ce5e987d531a
```

To this:
```
├─VMM3320 inside Dell WD15/TB16/TB18 wired Dock:
│     Device ID:           585c346c009da3cc19a400fb59a4ed8d0cbd0151
│     Summary:             Multi-Stream Transport Device
│     Current version:     3.12.002
│     Vendor:              Synaptics
│     Update State:        success
│     Flags:               updatable|registered
```

Those who are developing upgrades to devices can run fwupdmgr --verbose and
will get the verbose output that includes GUIDs:

```
VMM3320 inside Dell WD15/TB16/TB18 wired Dock
  DeviceId:             585c346c009da3cc19a400fb59a4ed8d0cbd0151
  Guid:                 c1e81f96-234e-597d-b9cb-6477d0652868
  Guid:                 152a9833-41e6-5c21-9dde-0ff8984f3e20
  Guid:                 c1e2bea5-4cf2-5f84-b965-533e8e5fea45
  Guid:                 0a52c8c7-26d5-59a0-ae44-6b00e276d775
  Guid:                 82460515-30d3-5cdf-be4c-571340842a10
  Guid:                 51000744-2de6-5a52-8a86-d5f69fd73d34
  Guid:                 d6072785-6fc0-5f83-9d49-11376e7f48b1
  Guid:                 6bc9fc61-618a-535f-a629-98345e11336e
  Guid:                 4e4e06b6-8217-5cf0-8eff-ce5e987d531a
  Summary:              Multi-Stream Transport Device
  Plugin:               synapticsmst
  Flags:                updatable|registered
  Vendor:               Synaptics
  Version:              3.12.002
  VersionFormat:        triplet
  Icon:                 video-display
  Created:              2019-08-28
  Modified:             2019-08-28
  UpdateState:          success
```

If they run this as an administrator they'll also get the strings used to build the GUID:
```
VMM3320 inside Dell WD15/TB16/TB18 wired Dock
  DeviceId:             585c346c009da3cc19a400fb59a4ed8d0cbd0151
  Guid:                 c1e81f96-234e-597d-b9cb-6477d0652868 <- MST-wd15-274
  Guid:                 152a9833-41e6-5c21-9dde-0ff8984f3e20 <- MST-wd15-vmm3320-274
  Guid:                 c1e2bea5-4cf2-5f84-b965-533e8e5fea45 <- MST-tb16-274
  Guid:                 0a52c8c7-26d5-59a0-ae44-6b00e276d775 <- MST-tb16-vmm3320-274
  Guid:                 82460515-30d3-5cdf-be4c-571340842a10 <- MST-tb18-274
  Guid:                 51000744-2de6-5a52-8a86-d5f69fd73d34 <- MST-tb18-vmm3320-274
  Guid:                 d6072785-6fc0-5f83-9d49-11376e7f48b1 <- MST-leaf
  Guid:                 6bc9fc61-618a-535f-a629-98345e11336e <- MST-leaf-vmm3320-274
  Guid:                 4e4e06b6-8217-5cf0-8eff-ce5e987d531a <- MST-leaf-274
  Summary:              Multi-Stream Transport Device
  Plugin:               synapticsmst
  Flags:                updatable|registered
  Vendor:               Synaptics
  Version:              3.12.002
  VersionFormat:        triplet
  Icon:                 video-display
  Created:              2019-08-28
  Modified:             2019-08-28
  UpdateState:          success
```
2019-08-28 09:17:58 -05:00
Mario Limonciello
da55c48b7d Remove replug flag after the device comes back from reboot
This prevents errors like this from happening:

```
failed to get device after update: failed to wait for detach replug: device did not come back
```
2019-08-28 09:24:31 +01:00
Mario Limonciello
0887b675c3 trivial: fu-util-common: more cleanup related to topology
* Set the log domain for verbose messages
* Don't show root node in verbose messages
2019-08-27 10:36:00 -05:00
Mario Limonciello
764fc2a676 trivial: fu-util: cleanup fwupdmgr get-details output
* Show "No Device ID" if no matching devices
* Don't show flags if no flags available

Before:
```
  Device ID:
  Description:          Updating the MST FW improves display performance.

  Flags:
  GUID:                 0a52c8c7-26d5-59a0-ae44-6b00e276d775

```

After:
```
  Device ID:            No Device ID
  Description:          Updating the MST FW improves display performance.

  GUID:                 0a52c8c7-26d5-59a0-ae44-6b00e276d775

```
2019-08-27 10:36:00 -05:00
Mario Limonciello
17e9bf5056 trivial: Don't use topology printing in --verbose mode
The strings won't be properly indented and characters will be lobbed
off.
2019-08-27 15:39:29 +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
6ff8a16390 trivial: Adjust daemon device sorting
This should output devices by priority followed by name instead now.
2019-08-27 15:39:29 +01:00
Richard Hughes
c67b4e726a Make get-topology more useful by showing all information 2019-08-27 15:39:29 +01:00
Richard Hughes
847cae824a trivial: Fix fu_common_string_append_kv() to align properly with idx > 0 2019-08-27 15:39:29 +01:00
Mario Limonciello
277c196369 fu-common: Use environment variables for systemd managed directories
The systemd unit will set these, create these directories and set all
permissions.  If that has happened, use them.
2019-08-27 06:08:06 -05:00