Commit Graph

4304 Commits

Author SHA1 Message Date
Filipe Laíns
e3f380afda unifying: fix incomplete hex file parsing
The new firmware for receivers with the nordic chips is using the 0x04
record type. This was previously not handled when parsing the file,
causing wrong behavior when trying to update the device. This patch
tries to properly deal with the record types, being them 0x04 or other.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-08-29 20:01:58 +01: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
0f490525f0 trivial: UEFI skip self tests if library fails to initialize
This means no simulator or TPM actually available
2019-08-29 12:52:27 -05: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
Mario Limonciello
37a3ecf0ef trivial: add libtss2-dev into debian/control (Closes: #1324) 2019-08-29 10:27:41 -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
0f431da26f trivial: Post branch version bump
We've added enough new code to justify a minor bump.
2019-08-28 17:08:21 +01:00
Mario Limonciello
6865dd3bac thunderbolt: Add support for kernel safety checks (Fixes: #1312)
There are commits to the Thunderbolt kernel driver that make sure
that the upgrade process goes smoothly.  If these commits aren't
present then it will look like a fwupd problem, when it's actually
a kernel problem.

When this issue was reported it appeared that commit
e4be8c9b6a
was missing from the locally tested kernel, but it's impossible
to determine that from userspace.

Prevent running the thunderbolt plugin on older kernels than that
set in `$sysconfdir/fwupd/thunderbolt.conf`.

By default that is set to 4.13.0, but if a distribution vendor has
backported all the necessary support it can be decreased to a lower
version for distro packages.
2019-08-28 11:06:18 -05: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
Richard Hughes
d350b2ecd7 synapticsmst: Partially rewrite the plugin (Fixes #1105)
This removes the 'two-layer' FuDevice and FuSyanpticsmstDevice model, where
a complicated plugin cache was used to add and remove devices to the daemon.

By making FuSynapticsmstDevice derive from FuDevice rather than GObject we can
also use a lot of the helper functionality like the other plugins, for instance
->prepare_firmware().

The `drm_dp_aux_dev` devices do not emit uevents on unplug/re-plug and so all
devices of `drm` class are watched and the actual DP AUX devices rescanned after
a small delay. When the AUX devices emit changes from the kernel this workaround
can be removed.

Also drop force power support for MST controllers in the Dell plugin. Overall
this has just led to more problems than it's helped.

 * Monitor flickers when turned on
 * Crashing graphics drivers from time to time
 * Fragile logic that doesn't always represent the device state
2019-08-28 08:50:15 -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
Richard Hughes
758f3b5abd trivial: Fix running the tests on devices with the TPM in v1.2 mode 2019-08-27 20:03:53 +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
e13f7a142e trivial: dell-dock: correct an error preventing write_size from being set
This fixes 7afd7cba0d which led to write_size
being set to 0 and an endless loop.
2019-08-27 09:28:30 -05:00
Richard Hughes
2b2605fb58 trivial: Do not warn about deprecated declarations
We need to silence the warning about GTimeVal, as the type is part of the ABI
of libgcab for better or worse.
2019-08-27 15:00:36 +01:00
Richard Hughes
7fac3788bf trivial: Update BRs for the example Fedora package 2019-08-27 12:52:46 +01:00
Jonas Witschel
5a7575d947 uefi: add test for TPM 2.0 PCR read function
The test is run if a physical TPM is available or if the environment
variable "TPM_SERVER_RUNNING" is set. In the latter case, the user is
expected to start a TPM simulator on their own, like we do in the Arch
Linux CI script here.
2019-08-27 06:23:42 -05:00
Jonas Witschel
1b5f1da202 uefi: use tpm2-tss library to read PCR values
Using the library instead of the command line tools provides a more
stable interface. This implementation only fetches PCR 0 for all
available hash algorithms since this is the only PCR that is actually
used in fwupd.
2019-08-27 06:23:42 -05: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
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
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
Richard Hughes
d8aaa21cde Allow turning off the timestamp prefix for debugging
This makes it easier to 'diff' the fwupd and fwupdtool output between runs.
2019-08-26 13:55:55 +01:00
Richard Hughes
5e952ce35f Add a ->udev_device_changed plugin vfunc
This allows plugins to rescan hardware based on uevents of any device class
registered with fu_plugin_add_udev_subsystem().

Additionally, the events are rate limited to avoid causing lots of extra plugin
processing when replugging hardware.
2019-08-26 13:55:55 +01:00
Richard Hughes
751e125634 Add fu_device_rescan() and a FuDevice->rescan() vfunc
This allows the plugin to cause a superclassed ->rescan() to be called in
response to some vague hardware change.
2019-08-26 13:55:55 +01:00
Gary Lin
68f4747182 Remove the duplicate files in meson.build
Some source files were duplicated when splitting up the source files.

Signed-off-by: Gary Lin <glin@suse.com>
2019-08-26 08:55:12 +01:00
Richard Hughes
5611fd0581 Hash the source files when generating the daemon hash
The unstripped static library changes between builds with profiling metadata
when compiling with LTO.

Fixes https://github.com/fwupd/fwupd/issues/1298
2019-08-25 20:18:40 +01:00
Richard Hughes
22d482c244 Split up source files in the build script 2019-08-25 20:18:40 +01:00
Jonas Witschel
db82620413 uefi: add support for tpm2-tools 4.X
tpm2_pcrlist has been renamed to tpm2_pcrread in
aedb0291d2
and the output format has changed slightly to include a leading "0x" in
9374bd70f4
Also add an example of the new output format to the self test.
2019-08-25 09:56:16 +01:00
Mario Limonciello
b56571eceb trivial: plugins: clarify stance on afuefi.efi 2019-08-23 10:54:58 -05:00
Mario Limonciello
36d2fea858 trivial: plugins/: Update README
Reference fwupd.github.io
2019-08-23 10:54:58 -05:00
Mario Limonciello
805f7990f3 trivial: disable gtkdoc by default
Since https://fwupd.github.io is now a thing, people can be directed there
rather than relying upon locally built documentation by default.

Also this will mean one less dependency to install for people who build
from source.

Lastly this finally means that I can do this set of actions without failure:
```
meson build
ninja -C build
ninja -C build install (PK prompts for password)
rm -rf build
```

Previously gtkdoc stuff was built as root due to the PK prompt and removing
it would lead to stuff like this:
```
rm: cannot remove 'build/docs/libfwupd/html/libfwupd-FwupdClient.html': Permission denied
```
2019-08-23 10:54:54 -05:00
Mario Limonciello
71d2f62dc2 trivial: update references of hughsie/fwupd to fwupd/fwupd 2019-08-22 09:47:52 -05:00
Mario Limonciello
d3122a53ff Publish docs to fwupd.github.io using CircelCI
For now this is happening on every master build, but in the future
after it's working reliably it should be restricted to only tagged
builds.

To accomplish this, swap a build from circlei and travisci that
will save docs to publish.
2019-08-22 09:15:29 -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
263cab99e9 fu-engine/fu-config: Reload metadata store when configuration changes
Emit a signal from FuConfig object that is caught by FuEngine to
reload the store.

This should fix problems with Fedora CI failing.
2019-08-21 22:05:24 +01: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
Mario Limonciello
8de8e3523a trivial: uefi: set vendor name for system firwmare from DMI data 2019-08-21 12:37:06 -05:00
Filipe Laíns
246ab42951 unifying: update Solaar url
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-08-21 07:08:06 -05:00
Mario Limonciello
4fa965a9f7 thunderbolt: Fix logic to work properly with ICL thunderbolt controller
This controller isn't flashable in fwupd, but fwupd can display information
about it.
* Use a generic device ID (similar to safemode)
* Build device name attribute from DMI data
2019-08-19 13:16:10 -05:00
Richard Hughes
6e73f50edc Add fu_udev_device_get_device_file() helper
This allows us to set the subsystem and device file during construction, which
means we can create FuUdevDevice objects not backed by physical devices.
2019-08-15 17:38:12 +01:00
Richard Hughes
2a8a5e0609 trivial: Fix regression when using fu_device_incorporate()
This broke in c521ab94be
2019-08-15 16:50:44 +01:00