Commit Graph

4425 Commits

Author SHA1 Message Date
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
890dd12d70 trivial: Fix GetDetails with libxmlb 0.2.x 2020-06-25 22:49:44 +01:00
Richard Hughes
3382fb10d7 trivial: Correctly format the FwupdRelease:created attribute 2020-06-25 22:30:15 +01:00
Ryan Lee
609d0c570f ccgx: Add more hybrid dock support
Also add HPI command retry.
2020-06-25 18:30:30 +01:00
Mario Limonciello
c2721c8695 fu-util: Only show UpdateMessage when state is success
This will show it only when an update was sucessful.
Fixes: #2212
2020-06-25 11:17:47 -05:00
Mario Limonciello
28d51c036b trivial: tpm-eventlog: stop showing messages about secure boot
This was an overloaded use of UpdateMessage that didn't make sense.
It doesn't affect the functionality of updating, just the security.

Hints about why the TPM PCR0 reconstruction failed should go
to the wiki page not the device.
2020-06-25 11:17:47 -05:00
Mario Limonciello
b563840753 Move PCR0 reconstruction error into security command
Now that this infrastructure is built, it's a more useful location
to put the security output.
2020-06-25 11:17:47 -05:00
Richard Hughes
2ba1a853a4 Drop the automatic /usr/bin/python3 rpmbuild dependency
We ship 4 *tiny* python scripts that are useful for ODMs and other people
working with low level firmware blobs.

These helper utilities do not warrant dragging Python onto the CoreOS image.
2020-06-25 17:16:57 +01:00
Mario Limonciello
a11eab61e1 trivial: fu-util: show a better error for non-responsive daemon
See #2212 for more context.
2020-06-24 08:19:15 -05:00
Mario Limonciello
4669dd590a trivial: uefi: drop secure boot check at coldplug
We'll instead check this when the user tries to run an update.  This
allows them to sign a bootloader after the daemon starts (or remove
a signed bootloader after starting)

Fixes: #2219
2020-06-24 08:18:48 -05:00
Mario Limonciello
58d6d329e8 trivial: thunderbolt: don't set update error for missing nvmem
Trying to explain why ICL thunderbolt isn't updatable doesn't help
people.  It just causes fwupdmgr and fwupdtool to show the device
front and center with a confusing message.

Instead don't populate the message and by the default device filter
it will be hidden.

See #2212 for background.
2020-06-24 06:31:58 +01:00
Mario Limonciello
bdc589884a modem-manager: add support for compiling libqmi-glib 1.26.0 and later 2020-06-23 15:21:09 -05:00
Mario Limonciello
13f4240881 trivial: snap: move to newer modem manager stuff
Fixes: #2200
2020-06-23 15:21:09 -05:00
Mario Limonciello
bfd57c6ee1 trivial: modem-manager: chomp vendor string
Reading the sysfs file seemed to have also eaten the `\n` as mentioned
on a bug.

```
├DW5821e Snapdragon X20 LTE:
│     Device ID:           fa707b9af86ff44bc17316b6c3e5ea82aab3ce86
│     Summary:             Mobile broadband device
│     Current version:     T77W968.F1.0.0.4.2.GC.010
│     Vendor:              Dell Inc. (USB:0x413c
│     )
│     GUIDs:               64da2d58-8d1b-5e5b-b793-f88ba5a25a8f
│                          761d6124-0002-5185-b767-9adf67bf1a5e
│                          795e079d-093b-5503-aa59-35b832480e95
│     Device Flags:        • Updatable
```
2020-06-23 14:12:08 -05:00
Richard Hughes
35ac0727d3 Use libxmlb bound parameters to speed up te device verification
This means we only parse the complicated xpath query once, rather than for
every GUID the device has.

The code flow is also simplified and split out into two functions.
2020-06-23 17:30:00 +01:00
Richard Hughes
664b8aa9ad Add XB_QUERY_FLAG_FORCE_NODE_CACHE
Newer versions of libxmlb do not auto-cache XbNodes, and we have to opt-into
this beahviour for the _set_data() and _get_data() to work.

Although this is a behaviour change which also increases complexity, it lowers
our RSS usage by 200kB which is about a quarter of the total RSS used...
2020-06-23 16:30:38 +01:00
Richard Hughes
4a4377fab0 Disable the SQLite lookaside cache
This saves ~45Kb of RSS and has no measurable slowdown when reading from the
pending database.
2020-06-23 15:01:50 +01:00
Mario Limonciello
f7d83a2f45 trivial: modem-manager: fix a logic error 2020-06-23 08:44:21 -05:00
Mario Limonciello
752dc715ea Revert "trivial: add Vendor ID into Modem manager devices"
This reverts commit 5521e47511.
2020-06-23 07:57:22 +01:00
Mario Limonciello
50638657cc modem-manager: read the vendor ID directly from sysfs attribute
Fixes: #2209
2020-06-23 07:57:22 +01:00
Mario Limonciello
e2a77fc10b trivial: modem-manager: add a protocol for updating the devices 2020-06-23 07:57:22 +01:00
Mario Limonciello
834b28009d Add support for a delayed activation flow for Thunderbolt
This allows delaying the activation of Thunderbolt firmware until
shutdown/reboot or when the dock is unplugged.

This functionality requires features in the kernel:
https://lore.kernel.org/linux-usb/20200622143035.25327-1-mario.limonciello@dell.com/T/#t

Matrix of cases to support:

* Distro Old Linux kernel (doesn't support authenticate on disconnect)

  - WD19TB: Should have `skips-restart` flag set
    No flush or activate features called in `thunderbolt` plugin.
    `dell_dock` plugin will activate at end of composite update

  - All other devices: Shouldn't have flags set
    Should authenticate in Thunderbolt plugin.
    `1 > nvm_authenticate`

* Distro New Linux kernel (supports authenticate on disconnect)

  - WD19TB: Should have `usable-during-update` flag set but not `skips-restart`
    Should flush image to SPI in `thunderbolt` plugin
    `2 > nvm_authenticate_on_disconnect`
    Should configure TBT device for authenticate on disconnect
    `1 > nvm_authenticate_on_disconnect`
    `dell_dock` plugin will configure dock for authenticate on disconnect

  - All other devices: Shouldn't have flags set
    Should authenticate in `thunderbolt` plugin.
    `1 > nvm_authenticate`

* ChromeOS (supports authenticate on disconnect)

  - `thunerbolt.conf` will have `DelayedActivation=true`.

  - WD19TB: Should have `usable-during-update` flag set but not `skips-restart`
    Should flush image to SPI in `thunderbolt` plugin
    `2 > nvm_authenticate_on_disconnect`
    Should configure device for authenticate on disconnect
    `1 > nvm_authenticate_on_disconnect`
    `dell_dock` plugin will configure dock for authenticate on disconnect

  - All other devices: Should have both `usable-during-update` and `skips-restart` set
    Should flush image to SPI in `thunderbolt` plugin
    `2 > nvm_authenticate`
    Will activate upon logout/shutdown/reboot
    `1 > nvm_authenticate`
2020-06-22 16:09:10 -05:00
Mario Limonciello
412e170b26 trivial: libfwupdplugin: add a new method to write strings to sysfs files 2020-06-22 16:09:10 -05:00
Mario Limonciello
5521e47511 trivial: add Vendor ID into Modem manager devices
Fixes: #2200
2020-06-22 15:57:10 -05:00
Richard Hughes
aae22e4df5 trivial: Always clear the mutex before clearing the thing it protects 2020-06-22 21:55:50 +01:00
Richard Hughes
11c5941f23 libfwupdplugin: Make FuPlugin::rules lazy loaded 2020-06-22 21:55:50 +01:00
Richard Hughes
ea327fc13f libfwupdplugin: Make FuPlugin::udev_subsystems lazy loaded
In most cases except tests the engine uses fu_plugin_set_udev_subsystems()...
2020-06-22 21:55:50 +01:00
Richard Hughes
371f6b2bfa libfwupdplugin: Make FuPlugin::devices lazy loaded
Most plugins don't actually use the per-plugin cache...
2020-06-22 21:55:50 +01:00
Richard Hughes
1d900f7d60 libfwupdplugin: Make FuPlugin::report_metadata lazy loaded 2020-06-22 21:55:50 +01:00
Richard Hughes
3444cf629b Lazy load FuEngine::approved_firmware
The common case is no approved list, and an empty hash table.
2020-06-22 21:55:50 +01:00
Richard Hughes
4d7edc65b0 libfwupdplugin: Lazy load FuDevice::metadata 2020-06-22 21:55:50 +01:00
Richard Hughes
5bb537c214 libfwupdplugin: Fix trivial memory leak when using fu_udev_device_incorporate()
This also adds two missing property notify events.
2020-06-22 15:55:02 +01:00
Richard Hughes
b1ae0dcbbc logind: Fix trivial memory leak at startup
The g_dbus_proxy_get_name_owner() function is (return full).
2020-06-22 15:55:02 +01:00
Richard Hughes
b0426f8a24 tpm-eventlog: Fix memory leak when reading file
The file contents were literally just read four lines above.
2020-06-22 15:55:02 +01:00
Ryan Lee
4c177ad540 ccgx: add new protocol for dmc dock 2020-06-22 12:57:43 +01:00
Mario Limonciello
91e27e145a Add a new plugin for legacy BIOS
This plugin is only enabled when coreboot isn't detected.
It intentionally does not check for EFI to be disabled at startup
since it can also notify the user that UEFI capsule updates are
disabled on the system even if running in UEFI mode.
2020-06-22 11:22:18 +01:00
Richard Hughes
5a831fa7ab vli: Set the i2c instance IDs in probe()
They do not need to query the device, so ->setup() is not required.
2020-06-22 10:42:05 +01:00
Richard Hughes
d63cedc444 Check all AppStream components when verifying
Additionally, ignore the 'not found' error codes so we drop down to the release
missing error.

Fixes https://github.com/fwupd/fwupd/issues/2196
2020-06-21 15:14:28 +01:00
Benson Leung
53fad4cd6c trivial: cros-ec: Use fu-memcpy-safe 2020-06-20 07:24:32 +01:00
Benson Leung
3a02ad5129 cros-ec: Add cros-ec-firmware
cros-ec firmware are in fmap layout, and have two sections
that this plugin will look for, the EC_RO, and EC_RW sections.

Tested using a servo_micro firmware:
$ fwupdtool firmware-parse servo_micro_v2.4.17-df61092c3.bin
<select fmap option>
FuCrosEcFirmware:
Version:                 2.4.17
  FuFirmwareImage:
  ID:                    EC_RO
  Index:                 0x1
  Version:               servo_micro_v2.4.17-df61092c3
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    FR_MAIN
  Index:                 0x2
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    RO_FRID
  Index:                 0x3
  Address:               0xc4
  Data:                  0x20
  FuFirmwareImage:
  ID:                    FMAP
  Index:                 0x4
  Address:               0x9a40
  Version:               1.0
  Data:                  0x15e
  FuFirmwareImage:
  ID:                    WP_RO
  Index:                 0x5
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    EC_RW
  Index:                 0x6
  Address:               0x10000
  Version:               servo_micro_v2.4.17-df61092c3
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    RW_FWID
  Index:                 0x7
  Address:               0x100c4
  Data:                  0x20
2020-06-20 07:24:32 +01:00
Benson Leung
23ca19acf8 fmap-firmware: Parse flashmap format into images
Implements a search for the fmap, and follow the map to break the firmware
into the constituent images.

Tested using a servo_micro firmware:
$ fwupdtool firmware-parse servo_micro_v2.4.17-df61092c3.bin
<select fmap option>
FuFmapFirmware:
  FuFirmwareImage:
  ID:                    EC_RO
  Index:                 0x1
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    FR_MAIN
  Index:                 0x2
  Data:                  0xf000
  FuFirmwareImage:
  ID:                    RO_FRID
  Index:                 0x3
  Address:               0xc4
  Data:                  0x20
  FuFirmwareImage:
  ID:                    FMAP
  Index:                 0x4
  Address:               0x9a40
  Version:               1.0
  Data:                  0x15e
  FuFirmwareImage:
  ID:                    WP_RO
  Index:                 0x5
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    EC_RW
  Index:                 0x6
  Address:               0x10000
  Data:                  0x10000
  FuFirmwareImage:
  ID:                    RW_FWID
  Index:                 0x7
  Address:               0x100c4
  Data:                  0x20
2020-06-20 07:24:32 +01:00
Benson Leung
acba98bd50 fmap-firmware: Add initial skeleton for fmap
fmap is a Google flash layout format that is used in several of Google's
firmware projects, including Chrome OS Embedded Controller and the Chrome OS
coreboot firmwares. Introduce it as a firmware format in libfwupdplugin.
2020-06-20 07:24:32 +01:00
Richard Hughes
0164141f9b trivial: Fix incorrect comment text 2020-06-19 10:59:16 +01:00
Richard Hughes
e5a4d52ea1 trivial: Spelling fixes from codespell 2020-06-18 20:49:12 +01:00
Mario Limonciello
5164e713f6 trivial: fix issue with agent on but man off
Fixes: #2192
2020-06-18 13:37:12 -05:00
Mario Limonciello
7d5f6b0232 dell-dock: Add more module types to the enum
Unfortunately module type has more than I previously realized.
The meanings that previously were applied fortunately worked for
the most important case (130-180W TBT) but didn't for single C, dual
C or small power (45W) cases.

Since composite_prepare was trying to read and interpret these, it
causes failures when these other ones are encountered.

I reproduced this on a 130W adapter plugged into a single C (type 0x4).
This meant the update wouldn't install since NULL was returned for the
type.

In case a new module ID is added later, also return an "unknown" for
the metadata.
2020-06-17 17:10:05 -05:00
Mario Limonciello
1b8047be1d trivial: fu-util: correct an assertion when no remotes configured
```
(fwupdmgr:185983): FuMain-CRITICAL **: 15:20:57.044: fu_util_time_to_str: assertion 'tmp != 0' failed
```
2020-06-17 15:49:39 -05:00
Mario Limonciello
f412227415 trivial: don't show reconstruction errors if uefi device is missing
The system must support UEFI capsule updates in order to measure
this. (Fixes: #2181)
2020-06-17 15:01:34 -05:00
Mario Limonciello
28bcecc028 trivial: fwupdtpmevlog: make clearer which algorithm is used 2020-06-17 15:01:34 -05:00
Mario Limonciello
9122999bfb tpm-eventlog: verify all algorithms, not just one of them
This will help to suss out any problems that are specific to sha1
or sha256 eventlog calculation.
2020-06-17 15:01:34 -05:00