Commit Graph

1843 Commits

Author SHA1 Message Date
Richard Hughes
4fec0302d2 dfu: Remove private headers that do not need to exist
These are a throwback to when we exported the DFU headers.
2019-10-14 15:24:08 -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
36e9292973 trivial: test: add checksums for "stock" 1.2.2
This has been failing the test suite silently:
```
b585990a-003e-5270-89d5-3705a17f9a43	FAILED: failed to verify using test: no checksum for 1.2.2
```
2019-10-14 12:41:09 -05:00
Mario Limonciello
069449e427 trivial: uefi: don't add PCRs with all 0's
I was seeing on a CML laptop with a Nuvoton TPM the following which
is definitely wrong:
```
  Checksum:             SHA1(791183aa2c4993dfaf75e95c91bdad067ac2cce1)
  Checksum:             SHA256(8a0656fe0024cc3300cc4dc8af4fc336112a51013aeb74b21c138ed116bb8691)
  Checksum:             SHA1(000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
```
2019-10-14 08:58:14 -05:00
Richard Hughes
8feba21210 synaptics-cxaudio: Support the ThinkPad USB-C Dock Gen2 2019-10-14 11:28:04 +01:00
Mario Limonciello
f37af548da 8bitdo: use will-disappear flag for sf30/sn30 controllers (Fixes: #783)
These controllers reboot back into Nintendo Switch mode typically
and fwupd will not be able to probe them.
2019-10-12 14:07:34 -05:00
Mario Limonciello
b73d255b13 trivial: ebitdo: don't dump out firmware header unless plugin verbose 2019-10-12 14:07:34 -05:00
Mario Limonciello
cee97bc674 trivial: ebitdo: don't use local errors when writing firmware
Just prefix them instead.
2019-10-12 14:07:34 -05:00
Richard Hughes
efa2803eb4 wacom-emr: Fix a regression for EMR devices
Actually trying to instantiate the object leads to:

    Specified class size for type 'FuWacomEmrDevice' is smaller than the
    parent type's 'FuWacomDevice' class size.

Fixes https://github.com/fwupd/fwupd/issues/1456
2019-10-12 19:25:44 +01:00
Richard Hughes
c0695320c8 Add a generic DFU firmware object for plugins to use 2019-10-11 13:19:46 +01:00
Richard Hughes
13f1c2a4da dfu: Use FwupdInstallFlags rather than a DFU-specific version 2019-10-11 13:19:46 +01:00
Richard Hughes
0ae53d3782 dfu: Remove functionality for modifying DfuSe files
Better tools already exist.
2019-10-10 16:53:44 +01:00
Richard Hughes
58bed5200e dfu: Remove functionality you can do now with fwupdtool 2019-10-10 16:53:44 +01:00
Richard Hughes
5a5a824a8d dfu: Remove the merge command as it's unused and broken 2019-10-10 16:53:44 +01:00
Richard Hughes
341ab10808 trivial: Remove the fuzzing details for DfuPatch 2019-10-10 16:18:26 +01:00
Richard Hughes
940df2eade dfu: Remove DfuPatch as no vendor actually uses this
This was a new file format to help out an OEM, but they didn't actually use it.
If we do need it in the future, it would some back as a src/ helper, not in
plugins/dfu.
2019-10-10 16:07:38 +01:00
Richard Hughes
85c34215c7 dfu: Don't wrap provided VID-PID functions 2019-10-10 13:53:27 +01:00
Richard Hughes
23c89edeaa dfu: Use the standard FuDevice custom flags functionality 2019-10-10 13:53:27 +01:00
Richard Hughes
8583184489 dfu: Use klass_device->write_firmware() directly 2019-10-10 13:53:27 +01:00
Richard Hughes
13ffa3e13f dfu: Use the generic fu_plugin_usb_device_added() function 2019-10-10 13:53:27 +01:00
Richard Hughes
b6fbf80f95 dfu: Use daemon flags to ignore devices rather than a special flag 2019-10-10 13:53:27 +01:00
Richard Hughes
79e033907b dfu: Set the device state directly to avoid proxying signals 2019-10-10 13:53:27 +01:00
Richard Hughes
f9fb2a6366 dfu: Use the built-in detach() and attach() vfuncs 2019-10-10 13:53:27 +01:00
Richard Hughes
f0eb091173 Read firmware back from the device as a FuFirmware
Returning a GBytes is not good enough when the device may be returning multiple
partitions which have to be stored as FuFirmwareImage objects.
2019-10-10 11:57:48 +01:00
Richard Hughes
48dbaadd03 dfu: Remove a pointless function 2019-10-09 20:56:38 +01:00
Richard Hughes
7301d06f23 dfu: Remove support for the Metadata Store Proposal
This was never adopted, and firmware now indicates the license in the metainfo
file rather than the DFU file itself.
2019-10-09 20:56:38 +01:00
Richard Hughes
5d064d92e0 dfu: Remove XTEA support
We don't support any hardware that actually uses this proposed standard, and
nowadays there is much better public-key encryption people can easily use.
2019-10-09 20:56:38 +01:00
Richard Hughes
52ccaa305e dfu: Remove the SREC and IHEX parsing out of the DFU plugin
libdfu used to be a grab-bag of useful firmware functions, but now with the
addition of FuFirmware we have proper shared objects for plugins to use.
2019-10-09 20:56:38 +01:00
Richard Hughes
2378ff314f ebitdo: Use klass_device->write_firmware like other plugins 2019-10-09 20:02:16 +01:00
Richard Hughes
8653e70480 trivial: Remove G_BEGIN_DECLS from all private headers 2019-10-09 20:02:16 +01:00
Richard Hughes
731875af86 Remove FU_PLUGIN_RULE_REQUIRES_QUIRK as all the plugins now use it 2019-10-09 20:02:16 +01:00
Richard Hughes
d8a8d5e776 Set all FuUdevDevice plugins to use FU_QUIRKS_PLUGIN
This speeds up startup as we're only calling fu_plugin_udev_device_added() on
plugins that can actually handle the device.
2019-10-09 20:02:16 +01:00
Mario Limonciello
83f8108def thunderbolt: recognize new 'generation' sysfs attribute
Use this attribute to determine whether or not to try to read 'native'
from the Thunderbolt NVM image at probe time.

This attribute is new to kernel 5.5.
2019-10-09 10:25:37 -04:00
Richard Hughes
c15c7835be Rename and modernize the udev plugin
The new plugin is called `optionrom` as this is the only type of image that it
parses for verification only. FuUdevDevice is also the generic parent already.
2019-10-09 14:59:54 +01:00
Richard Hughes
8523ebebf2 synaptics-rmi: Also add the product ID as a GUID without the minor version
Firmware may be suitable for all products that match the 'major ID' and so we
should provide an extra GUID to use in this case.
2019-10-09 14:18:10 +01:00
Richard Hughes
83fe59629d synaptics-rmi: Correctly set the payload length rather than hardcoding it 2019-10-08 12:32:09 +01:00
Richard Hughes
9a5f076b6b synaptics-rmi: Write the core config correctly 2019-10-08 12:32:09 +01:00
Richard Hughes
d0fbc34704 synaptics-rmi: Decode BL7 status failures as actual errors 2019-10-08 12:32:09 +01:00
Richard Hughes
5b03566465 synaptics-rmi: Add some trivial debugging to help debug a write problem 2019-10-08 12:32:09 +01:00
Mario Limonciello
e42b42bf9b trivial: uefi: Make efivarvs errors clearer (Fixes: 1330) 2019-10-07 07:23:54 -05:00
Mario Limonciello
01c2f651da trivial: uefi: don't prefix efivar errors
Although they can be useful for debugging the codepath leading to
a problem, they are also confusing when it comes to the end user
messages:

```
{error #0} linux.c:406 device_get(): readlink of /sys/block/nvme0n1/device/driver failed: No such file or directory
{error #1} linux.c:406 device_get(): readlink of /sys/block/nvme0n1/device/driver failed: No such file or directory
{error #2} linux.c:406 device_get(): readlink of /sys/block/nvme0n1/device/driver failed: No such file or directory
{error #3} linux.c:406 device_get(): readlink of /sys/block/nvme0n1/device/driver failed: No such file or directory:
Error writing to file descriptor: No space left on device
```

Whereas if they weren't shown, that last message would have been plenty.
2019-10-07 07:23:54 -05:00
Richard Hughes
5c68f8c81f altos: Modernize the plugin to simplify it 2019-10-07 12:37:21 +01:00
Richard Hughes
989acf12e7 Create the custom plugin GType in common code
This reduces the amount of boilerplate in plugins.
2019-10-07 12:37:21 +01:00
Richard Hughes
7f67721432 Reduce more boilerplate in plugins 2019-10-07 12:37:21 +01:00
Richard Hughes
d6fc172ec9 synaptics-rmi: Check the correct register when querying bootloader mode 2019-10-07 11:50:49 +01:00
Richard Hughes
9cb3c84712 modem-manager: Fix a tiny memory leak when starting the daemon 2019-10-05 13:03:02 +01:00
Richard Hughes
2524c3fd79 synaptics-rmi: Copy the behavior of rmi4utils for BL7 detach 2019-10-05 09:07:22 +01:00
Richard Hughes
1c53c0eb86 synaptics-rmi: Simplify fu_synaptics_rmi_device_read()
We don't need a double loop here as we only ever require one READ_ADDR request.
2019-10-05 09:07:22 +01:00
Richard Hughes
08ddb2b7c4 synaptics-rmi: Set the version after ->setup has run
The build_id might be overwritten in the BL-specific setup.
2019-10-05 09:07:22 +01:00
Richard Hughes
339f823ee2 synaptics-rmi: Use the correct mask when getting the bootloader mode on BL7 2019-10-05 09:07:22 +01:00
Richard Hughes
3b8a2ea47f syanptics-rmi: The build_id is 3 bytes long, not 2 2019-10-04 17:08:21 +01:00
Richard Hughes
007140bd78 synaptics-rmi: Read the config partition the same as rmi4utils 2019-10-04 15:47:16 +01:00
Richard Hughes
4b30380e78 Provide a default implementation of common FuDevice actions
This reduces the amount of boilerplate in each plugin.

    32 files changed, 156 insertions(+), 584 deletions(-)
2019-10-04 14:57:32 +01:00
Christian Kellner
7e5c7b269a thunderbolt-power: avoid checking for bolt support
Avoid checking if bolt supports force-power in coldplug (early on)
because that will dbus-activate boltd, even on systems where there
is no actual thunderbolt hardware and thus also no force-power
support. Since boltd does use the very same kernel mechanism that
fwupd would use when boltd is not around this can not lead to any
regressions.
2019-10-04 08:16:28 -05:00
Richard Hughes
0e17281997 synaptics-rmi: Add some debugging for BL7 devices 2019-10-04 10:59:08 +01:00
Yehezkel Bernat
bddfde9615 Fix usage of incorrect type for return value
This seems like a bug, as `FALSE` == `0` == `VALIDATION_PASSED`
2019-10-03 10:41:48 -05:00
Richard Hughes
c6cda8bc71 synaptics-rmi: Do as little as possible in device setup
This reduces the setup time by another 70ms and also makes the plugin simpler.
2019-10-03 15:14:10 +01:00
Richard Hughes
b8e97e56c3 synaptics-rmi: Speed up reading the PDT from 900ms to 30ms
Don't continue to scan pages after the last function.
2019-10-03 15:14:10 +01:00
Richard Hughes
eeb6c22c1e synaptics-rmi: Ignore the ATTN reports from the hardware when reading DATA
Fixes https://github.com/fwupd/fwupd/issues/1427
2019-10-03 13:10:58 +01:00
Richard Hughes
9f7a3364ae synaptics-rmi: Move the fuzzing instructions to the toplevel README 2019-10-02 16:28:28 +01:00
Richard Hughes
47ae4f89d7 Fuzz the SREC and IHEX file parsers once more 2019-10-02 16:28:28 +01:00
Richard Hughes
e87abd81a2 synaptics-rmi: Fix the packing of the partition table
The data was part of the union, not the struct. It's also binary format and
thus needs to be packed.
2019-10-02 12:28:06 +01:00
Richard Hughes
63aa6759f0 Add a plugin to update Synaptics RMI4 devices 2019-10-02 10:45:13 +01:00
Mario Limonciello
5bd649ef31 uefi: detect unmounted ESP partitions (Fixes: #1405)
Mount these while writing out updates.
Leave them mounted when done (you gotta reboot anyway).
2019-09-26 10:39:45 -05:00
Mario Limonciello
dc227c6037 uefi: stop recording efibootmgr output after flash
We've not had to reference this in a long time for bugs, all the major
IBVs and OEMs have good fwupd support now.
2019-09-26 10:39:45 -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
Mario Limonciello
a1f9d5850b trivial: uefi, dell: skip self tests with TPM if non-root (Fixes: #1396)
There are some packaging problems in some distributions that lead
to TSS stack emitting warnings that will fail self tests.

These don't occur as root, and furthermore those distributions run
CI as root already.

And in the dell plugin make it non-fatal to have TPM register read failures
in case the system has TPM1.2 not TPM2.0
2019-09-25 08:38:04 -05:00
Mario Limonciello
4e343bc1b9 trivial: dell: quiet the TSS output
This is the same as commit 5206592347
2019-09-25 08:38:04 -05:00
Mario Limonciello
42ee62ef34 trivial: uefi: allow forcing to TPM2 via environment variable
Use this environment variable to ensure that TPM2 is used in self
tests even if the system has TPM1.2.
2019-09-25 08:38:04 -05:00
Richard Hughes
bb59837ae0 Add a new plugin to update Conexant audio devices 2019-09-24 12:26:47 +01:00
Mario Limonciello
15cd821094 trivial: dell-dock: correct another write_size error
This was more fallout from 7afd7cba0d
which led to write_size being set to 0 and an endless loop.
2019-09-23 09:57:38 -05:00
Richard Hughes
17c02b8b1f trivial: Fix some NULL/FALSE confusion 2019-09-23 09:59:30 +01:00
Richard Hughes
d1afec8e27 synaptics-prometheus: Fix tiny memory leak when using FuSynapromConfig 2019-09-23 09:59:26 +01:00
Richard Hughes
63c1712194 unifying: Use the instance ID to check for supported devices
If we're using an instance ID with FU_DEVICE_INSTANCE_FLAG_ONLY_QUIRKS (e.g.
for the vendor match in the previous commit) then the GUID is not available.
2019-09-20 18:56:31 +01:00
Richard Hughes
d9f52c7573 unifying: Ensure HID++ v2.0 peripheral devices get scanned by the plugin
Since adding fu_plugin_add_rule(FU_PLUGIN_RULE_REQUIRES_QUIRK) all peripheral
devices were being ignored.
2019-09-20 18:56:31 +01:00
Mario Limonciello
f32c3fdbc0 trivial: wacom: Add support for second vendor ID
Wacom indicates that some systems will use this alternative VID.
2019-09-19 17:35:11 +01:00
Mario Limonciello
01a7958cd1 uefi, dell-esrt: Show firmware version when capsule updates unavailable
When the system doesn't support UEFI capsule updates no firmware version
is displayed for the BIOS.  Fix this by creating a dummy device:
```
├─System Firmware:
│     Device ID:           123fd4143619569d8ddb6ea47d1d3911eb5ef07a
│     Current version:     1.7.0
│     Vendor:              Dell Inc.
│     Update Error:        UEFI Capsule updates not available or enabled
│     Flags:               internal|require-ac|registered|needs-reboot
```

If the dell-esrt plugin determines that capsule updates can be enabled
however, make the device it creates replace the dummy device:
```
├─Dell UEFI updates:
│     Device ID:           123fd4143619569d8ddb6ea47d1d3911eb5ef07a
│     Summary:             Enable UEFI Update Functionality
│     Current version:     0
│     Update Error:        Firmware updates disabled; run 'fwupdmgr unlock' to enable
│     Flags:               locked|supported|registered|needs-reboot
```

Fixes: #1366
2019-09-19 15:48:39 +01:00
Mario Limonciello
78987fb394 uefi: make the TPM optional for runtime again (Fixes: #1362)
It's intentional to use a different error message for library failure
so that we can tell if there is a regression in CI related to TPM usage.
2019-09-17 23:41:41 +01:00
Mario Limonciello
5206592347 trivial: uefi: Make the TCTI output less verbose 2019-09-17 23:41:41 +01:00
Richard Hughes
fa0c41fb36 modem-manager: Fix two build warnings on Fedora 30 2019-09-12 18:05:20 +01:00
Richard Hughes
1c257b7779 synapticsmst: Add another name quirk for the ThinkPad USB-C Dock 2019-09-12 09:44:38 +01:00
Richard Hughes
04cb360847 uefi-recovery: Add a plugin to add a fake ESRT entry for device recovery
The factory-shipped MinnowBoardMAX board has firmware that does not include
the ESRT table. Create a 'fake' UEFI device with the lowest possible version
so that it can be updated to any version firmware.

All the HwId GUIDs are used for the fake UEFI device, and so should be used in
the firmware metadata for releases that should recover the system.
2019-09-11 12:47:31 +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
Filipe Laíns
718905f7f0 unifying: fix timeout metadata
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-09-07 15:25:29 -05:00
Filipe Laíns
a39951b289 unifying: fix timeout
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-09-06 13:44:10 +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
2275379196 dell: Use TSS to query and build TPM vendor strings for GUIDs
These are a more scalable way to apply firmware across a variety of
platforms.

An example:
```
XPS 13 7390 TPM 2.0
  DeviceId:             c56e9f77cfee65151bdef90310776f9d62827f5a
  Guid:                 a4352c96-f8d7-526c-8485-7f84085f348e <- 0962-2.0
  Guid:                 7d65b10b-bb24-552d-ade5-590b3b278188 <- DELL-TPM-2.0-NTC-NPCT
  Guid:                 6f5ddd3a-8339-5b2a-b9a6-cf3b92f6c86d <- DELL-TPM-2.0-NTC-NPCT75x
  Guid:                 fe462d4a-e48f-5069-9172-47330fc5e838 <- DELL-TPM-2.0-NTC-NPCT75xrls
  Summary:              Platform TPM device
  Plugin:               uefi
  Flags:                internal|require-ac|registered
  Vendor:               Dell Inc.
  Version:              7.2.1.0
  VersionFormat:        quad
  Icon:                 computer
  Created:              2019-09-04
```

When this system is queried using tpm2-tools:
```
$ sudo tpm2_getcap -c properties-fixed
TPM_PT_FAMILY_INDICATOR:
  as UINT32:                0x08322e3000
  as string:                "2.0"
TPM_PT_LEVEL:               0
TPM_PT_REVISION:            1.38
TPM_PT_DAY_OF_YEAR:         0x00000008
TPM_PT_YEAR:                0x000007e2
TPM_PT_MANUFACTURER:        0x4e544300
TPM_PT_VENDOR_STRING_1:
  as UINT32:                0x4e504354
  as string:                "NPCT"
TPM_PT_VENDOR_STRING_2:
  as UINT32:                0x37357800
  as string:                "75x"
TPM_PT_VENDOR_STRING_3:
  as UINT32:                0x02010024
  as string:                ""
TPM_PT_VENDOR_STRING_4:
  as UINT32:                0x726c7300
  as string:                "rls"
```
2019-09-05 00:23:23 -05:00
Mario Limonciello
43742bcd3b trivial: dell: show reasons for lack of updates in UpdateError
```
└─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 owernship
      Flags:               internal|require-ac|registered
```
2019-09-05 00:23:23 -05:00
Filipe Laíns
21b591f996 unifying: use fu_firmware_strparse_uint16 to read be 16bit values
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-08-29 20:01:58 +01:00
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
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
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
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
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
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
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
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
71d2f62dc2 trivial: update references of hughsie/fwupd to fwupd/fwupd 2019-08-22 09:47:52 -05: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
5074b97d78 synapticsmst: Make FuSynapticsmstConnection an actual GObject
This allows us to use FuDeviceLocker in the future without a wrapper device.
2019-08-15 14:44:56 +01:00
Richard Hughes
9cfe6b6a21 synapticsmst: Use the same style as other plugins
Also split up the Tesla and Leaf hardware families.

No logic changes.
2019-08-15 14:11:48 +01:00
Richard Hughes
37c6a7ba46 trivial: Add some helper functions for GByteArray 2019-08-15 09:50:37 +01:00
Richard Hughes
6e3e62bee8 Use fu_common_string_append_kv() in subclassed device
Also define the indent level in the the ->to_string vfunc so we can correctly
print client devices in all cases.
2019-08-14 16:48:37 +01:00
Richard Hughes
b962bc206b synapticsmst: Use G_DECLARE_FINAL_TYPE to simplify the object
No logic changes.
2019-08-14 16:48:37 +01:00
Richard Hughes
21ef40f19b synapticsmst: Add a SynapticsMSTBoardID for another Lenovo dock 2019-08-14 16:48:37 +01:00
Mario Limonciello
63eb12a241 trivial: remove unnecessary CUSTOMERID_DELL define
This was previously used when the plugin was only run on Dell devices.
The plugin was already adjusted to run on other vendor's firmware
but this definition was not removed.
2019-08-14 10:36:25 -05:00
Richard Hughes
c6db17fd6a synapticsmst: Add a SynapticsMSTBoardID for a Lenovo dock 2019-08-13 17:39:33 +01:00
Richard Hughes
c85a89eff2 synapticsmst: Display the board ID in non-hex form in the error message
The SynapticsMSTBoardID quirk option is generated with the non-hex version,
so output the same format to avoid head-scratching when adding new models.
2019-08-13 17:39:29 +01:00
Richard Hughes
ba3d913804 synapticsmst: Use a more suitable icon for the device 2019-08-13 17:39:24 +01:00
Richard Hughes
d0e952bd93 trivial: Remove unused variable 2019-08-13 17:39:19 +01:00
Richard Hughes
5308ea4fae Never use memcpy() in a possibly unsafe way
There are several subtle bugs in various places in fwupd caused by not treating
user-provided offsets into buffers as unsafe. As fwupd runs as root we have to
assume that all user firmware is evil, and also that devices cannot be trusted.

Make a helper to put all the logic into one place and convert all users.
2019-08-12 09:22:09 -05:00
Richard Hughes
7afd7cba0d Use FuFirmware as a container for firmware images
In many plugins we've wanted to use ->prepare_firmware() to parse the firmware
ahead of ->detach() and ->write_firmware() but this has the limitation that it
can only return a single blob of data.

For many devices, multiple binary blobs are required from one parsed image,
for instance providing signatures, config and data blobs that have to be pushed
to the device in different way.

This also means we parse the firmware *before* we ask the user to detach.

Break the internal FuDevice API to support these firmware types as they become
more popular.

This also allows us to move the Intel HEX and SREC parsing out of the dfu plugin
as they are used by a few plugins now, and resolving symbols between plugins
isn't exactly awesome.
2019-08-08 13:10:57 +01:00
Aleksander Morgado
3eb27564ef modem-manager: add counterpart GUID for the DW5821e
The DW5821e in modem mode uses the 0x81D7 PID, but when it boots in
fastboot mode it uses the 0x81D6 PID. The upgrade procedure was able
to automatically match these two devices because they both shared the
very generic per-VID (0x413C) GUID, but this is no longer operational
since commit 8ef139faba, as the very generic GUIDs have been removed
for matching purposes.

So, define a quirk for the DW5821e, in order to add a counterpart
GUID to make device matching work properly again.

Fixes https://github.com/hughsie/fwupd/issues/1271
2019-08-05 16:15:09 +01:00
Richard Hughes
c6dba62cf0 solokey: Release the interface and rebind the kernel driver on close 2019-08-05 09:25:04 +01:00
Richard Hughes
a7715bc74a uefi: Actually write the new device path if different than before
If we add or remove a quirk from a machine using the uefi plugin then the new
setting is not used until the BootXXXX EFI key is manually removed. Rather than
just writing the contents of the found key back to the key (doh) just write the
new DP buffer contents if it is different from the previous buffer.
2019-08-02 14:34:12 +01:00
Richard Hughes
fad78a758e Allow setting custom flags when using fwupdate
This allows the ODM to specify command line arguments such as:

    --flags=use-shim-unique,use-legacy-bootmgr-desc,no-ux-capsule

..which is useful for testing broken firmware.
2019-08-02 14:34:12 +01:00
Richard Hughes
c5eb83cb87 trivial: Do not show a critical warning if no firmware is specified 2019-08-02 14:34:12 +01:00
Richard Hughes
90da72ad76 trivial: Fix overzealous search-replace action in user string 2019-08-02 14:34:12 +01:00
Richard Hughes
dfaca2de2e Fix a crash when stopping the fwupd service
This difficult to debug bug only showed up when the fwupd service was stopped,
which the user never noticed, but services like abrt were still keen to report.
The root issue was that the call to fu_plugin_get_smbios_data() in
fu-plugin-uefi.c:fu_plugin_startup() was freeing the returned const GBytes,
which rippled down all the way to a double-free deep in libxmlb.

It's somewhat unusual to have a const GBytes, so just change the plugin helper
to returned a ref'd copy, on the logic a potential 16 byte memory leak is better
than a double-free when the next plugin gets the logic the wrong way around.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1734746
2019-08-01 13:00:51 +01:00
Mario Limonciello
ffe7fe24bc trivial: Update icons for Thunderbolt and MST devices 2019-07-30 13:15:20 -07:00
Richard Hughes
d8f78d0b93 Add support for the SoloKey Secure 2019-07-30 16:16:14 +01:00
Mario Limonciello
a1a4a3378a trivial: thunderbolt: catch failure setting up device
Fixes: b3aa793539 ("thunderbolt: Convert the instance IDs as we never open the device")
2019-07-15 08:12:26 -07:00
Mario Limonciello
ac627cd8ca dell-esrt: Improve the experience for the plugin (Closes: #1245)
* Set UpdateError to indicate how the device needs to be updated
* Set the device as needing reboot
* If admin password is set show the message to frontend via `UpdateError`
2019-07-15 04:37:37 -07:00
Jeff
a4826d3eb1 remove those PIDs with Bluetooth interface, Wacom updater doesn't support updating from Bluetooth interface
Signed-off-by: Jeff <jeff.gu@wacom.com>
2019-07-15 09:09:29 +01:00
Richard Hughes
e8c5f783bb flashrom: Only show DEBUG and DEBUG2 output if using --plugin-verbose=flashrom 2019-07-12 09:22:38 -07:00
Richard Hughes
53263a3a99 flashrom: Only call flashrom_programmer_init() on whitelisted boards
I'm not 100% sure calling flashrom_programmer_init('internal') unconditionally
on every platform is a very good idea. Only probe the hardware if there is a
whitelisted supported device.

Fixes https://github.com/hughsie/fwupd/issues/1239
2019-07-12 09:22:38 -07:00
Artur Raglis
1e47690fd9 flashrom: Fix no version format set
Signed-off-by: Artur Raglis <artur.raglis@3mdeb.com>
2019-07-11 19:16:14 +01:00
Mario Limonciello
e219a994dd trivial: uefi: use UEFI-dummy for device ID instead of just uefi 2019-07-11 09:33:23 -07:00
Mario Limonciello
badef4daf3 trivial: fix error handling for non UEFI case (#1220) 2019-07-11 09:33:23 -07:00
Richard Hughes
4266ac4765 Add a specific error code for the low battery case
Users are getting confused when they're being told that AC power is required
when they are already on AC power... but the battery is too low to perform the
update.
2019-07-11 09:31:34 -07:00
Mario Limonciello
65a4894bba uefi: Determine whether running in legacy mode or not (Fixes: #1220)
* In startup, check BIOS characteristics for UEFI supported instead of for /sys/firmware/uefi
* In coldplug check for /sys/firmware/uefi
* If /sys/firwmare/uefi missing, create a dummy device telling the user it is in legacy mode
2019-07-10 10:20:49 -07:00
Yehezkel Bernat
6b5f5d13c7 trivial: Fix typos in error messages 2019-07-05 12:48:17 +01:00
Artur Raglis
13fd21d806 flashrom: Use libflashrom
This also means we now include a flashrom subproject as no distro currently has
a flashrom new enough to build the plugin.

Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: Artur Raglis <artur.raglis@3mdeb.com>
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2019-06-28 08:28:51 +01:00
sigurdb
9608e50a84 Add support for 8bitdo USB Retro Receiver 2019-06-13 20:49:07 +01:00
Richard Hughes
ea995da5f2 Revert "Allow SuperIO updates to be done live"
This reverts commit 87a392954a7427d68b61d0e53987a46d5984a9fd.
2019-06-11 08:04:09 +00:00
Richard Hughes
59e375707a uefi: Try to find a duplicate using the loadopt name
This means if the loadoptdata changes for any reason (e.g. we start using a
different quirk) we don't get duplicate entries in efibootmgr.
2019-06-05 11:12:07 +01:00
Richard Hughes
49c99038eb uefi: Provide a quirk to disable the use of the UX capsule 2019-06-05 11:12:07 +01:00
Mario Limonciello
53f0c585ed trivial: uefi: use the path for efibootmgr that was detected
A failure report on LVFS shows that NixOS wasn't able to launch
efibootmgr.
2019-05-31 10:07:59 -05:00
Richard Hughes
67435426f4 synaptics-prometheus: Fix installing CONFIG firmware updates
Open the parent device to perform requests using the proxy virtual device.
2019-05-28 17:24:50 +01:00
Richard Hughes
39a270e1b3 synaptics-prometheus: Set the install duration from a quirk
Yes, it is quick. It's really the time to process one HUGE bulk request...
2019-05-28 17:24:50 +01:00
Richard Hughes
8a5df4dd32 synaptics-prometheus: Don't emit critial warning when updating config firmware 2019-05-28 17:24:50 +01:00
Richard Hughes
5575083677 synaptics-prometheus: Fix missing field in the IOTA reply struct 2019-05-28 17:24:50 +01:00
Richard Hughes
10f8d15af1 redfish: Never set NULL device name 2019-05-24 12:57:56 +01:00
Richard Hughes
ebe1d43122 modem-manager: Never set NULL device name 2019-05-24 12:57:56 +01:00
Richard Hughes
501a84d08f ata: Never set NULL device name
Probably fixes https://github.com/hughsie/fwupd/issues/1206
2019-05-24 12:57:56 +01:00
Mario Limonciello
6f352cb7e5 synapticsmst: fix GUID generation (Closes: #1207)
When converting to instances we forgot to add the GUIDs to the device
as well.
2019-05-23 09:52:18 -05:00
Sean-StarLabs
7239c6ab45 Lite Mk II flag for use-shim-unique
Added AMI fix for the "duplicate entry" issue to firmware version 1.0.4 - quirk is needed to install new version
2019-05-23 14:57:17 +01:00
Richard Hughes
13800b719e Allow SuperIO updates to be done live
Apparently Star Labs have been using this for some time. It's still important
to reboot after the update has been performed.
2019-05-22 12:54:38 +01:00
Mario Limonciello
d83f5fe05e trivial: uefi: clarify error message
Help people to debug when their ESP isn't found.
2019-05-20 10:59:54 -07:00
Richard Hughes
c7bdded2c6 Add a plugin to update Synaptics Prometheus fingerprint readers 2019-05-14 17:18:55 +01:00
Richard Hughes
dfa9e11bb2 Allow handling FORCE for devices that subclass FuDevice
Pass FwupdInstallFlags down to the vfunc to allow us to check the flags when
parsing the firmware and updating the device.
2019-05-05 15:29:00 -05:00
Richard Hughes
26d3da4074 uefi: Fix a libasan failure when reading a UEFI variable
It seems some older versions of libefi var incorrectly build the 'length' value
in the DP returned from efi_generate_file_device_path(). This means we copy past
the end of the allocated buffer when parsing the efi_update_info_t structure.

This bug seems fixed in efivar git master, and this fix is only going to help
people with older efivar versions. It's probably a good thing to be a bit more
paranoid about EFI variable data anyway.

    DEBUG: UpdateInfo:
           ? 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
    ????????????????????????????????????????????????????????????????????????????????????????????????????????
    0x0000 ? 07 00 00 00 20 d9 7b 69 cf 12 a9 4d 83 85 99 69 09 bc 65 59 00 00 05 00 00 00 00 00 00 00 00 00
    0x0020 ? 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 04 01 2a 00 01 00 00 00 00 08 00 00
    0x0040 ? 00 00 00 00 00 40 06 00 00 00 00 00 5a aa 97 5a 10 d5 7e 49 99 0b ca 8d 35 4d c8 6d 02 02 04 04
    0x0060 ? 86 00 5c 00 45 00 46 00 49 00 5c 00 66 00 65 00 64 00 6f 00 72 00 61 00 5c 00 66 00 77 00 5c 00
    0x0080 ? 66 00 77 00 75 00 70 00 64 00 2d 00 36 00 39 00 37 00 62 00 64 00 39 00 32 00 30 00 2d 00 31 00
    0x00a0 ? 32 00 63 00 66 00 2d 00 34 00 64 00 61 00 39 00 2d 00 38 00 33 00 38 00 35 00 2d 00 39 00 39 00
    0x00c0 ? 36 00 39 00 30 00 39 00 62 00 63 00 36 00 35 00 35 00 39 00 2e 00 63 00 61 00 70 00 00 00 7f ff
    0x00e0 ? 04 00
    DEBUG: DP type:0x04 subtype:0x01 size:0x002a
    DEBUG: DP type:0x04 subtype:0x04 size:0x0086
    DEBUG: found END_ENTIRE at 0x00aa
    DEBUG: DP length invalid! Truncating from 0x0086 to 0x0080
    DEBUG: DP type:0x7f subtype:0xff size:0x0004
2019-05-02 17:25:34 +01:00
Richard Hughes
bb5199b428 trivial: Fix an libasan failure in the dell plugin
Use a buffer of an explicit size to avoid reading junk off the stack.
2019-05-02 10:46:06 +01:00
Richard Hughes
f5a0d24a95 trivial: Fix a missing config.h include in a new source file 2019-05-02 09:59:47 +01:00
Mario Limonciello
8be5756edd ata: Set version format to plain for devices obtained from udev
This matches behavior of those obtained by ID command.
2019-04-30 09:31:55 +01:00
Richard Hughes
5079f26f0e Never guess the version format from the version string
This leads to madness, as some formats are supersets of the detected types,
e.g. 'intel-me' is detected as 'quad' and 'bcd' is detected as 'pair'.

Where the version format is defined in a specification or hardcoded in the
source use a hardcoded enum value, otherwise use a quirk override.

Additionally, warn if the version does not match the defined version format
2019-04-30 09:25:41 +01:00
Richard Hughes
c84b36c541 Export the version-format to clients
This allows a vendor to verify the VersionFormat of a device without running
the daemon in verbose mode.
2019-04-30 09:25:41 +01:00
Richard Hughes
5d7f5a2a87 dfu: Add some trivial, but useful, debugging for AVR DFU devices 2019-04-29 08:27:51 -05:00
Richard Hughes
3c7f58170d dfu: Correctly identify DFU firmware that starts at offset zero
Use 0xffffffff as the 'never set' base address.
2019-04-29 08:27:51 -05:00
Richard Hughes
2cebf6c555 dfu: Don't keep showing trivial debug output 2019-04-29 08:27:51 -05:00
Richard Hughes
e4e96742e7 dfu: Reset the forced version during attach and detach
If the runtime DFU version is a vanilla DFU runtime rather than the AVR32 DFU
variant then we no longer need to use the override.
2019-04-29 08:27:51 -05:00
Mario Limonciello
8b222bd557 ata/nvme: For devices running Dell firmware, set VersionFormat (Fixes: #1169)
Dell firmware is known to use `VersionFormat` `plain`.
2019-04-25 10:26:02 -05:00
Richard Hughes
cdd390a785 trivial: Fix fwupdate --apply 2019-04-25 12:52:59 +01:00
Mario Limonciello
398afe545f trivial: dell-dock: set minimum board to 6
Drop all TODO and quirks for older pre-production boards.
2019-04-23 13:36:30 -05:00
Richard Hughes
7886c086a1 Don't upload reports when the user has configured their system in a broken way
I'm getting a bit fed up with failed reports from arch users where they just
have a broken system. I don't think it's useful to upload to the LVFS or notify
the vendor about failures like this.
2019-04-18 22:06:01 +08:00
Richard Hughes
3c8777f0f6 Do not fall back integers to a plain version format
We can't possibly know what version format to use.
2019-04-17 12:11:45 -04:00
Richard Hughes
1fb8202b06 nvme: Fix the correct handling of a plain version number 2019-04-17 15:46:58 +01:00
Mario Limonciello
c73c02fa70 trivial: uefi: clarify errors related to secure boot 2019-04-17 16:39:29 +08:00
Mario Limonciello
a50b02faf2 uefi: Don't leak the application build path into the binary
This can be set at runtime if needed using environment variables.
2019-04-17 16:39:29 +08:00
Richard Hughes
8fada51919 Correctly parse DFU interfaces with extra vendor-specific data
Fixes: https://github.com/hughsie/fwupd/issues/1152
2019-04-17 15:12:43 +08:00
Richard Hughes
cce6a1cb5a Do not report transient failures
We don't need to report failures to do with AC or battery level to the LVFS.
2019-04-17 08:20:44 +08:00
Kelly Anderson
31b2ce83e1 Updated: Add support for 8BitDo M30. 2019-04-09 12:38:24 -04:00
Aleksander Morgado
8a1dce9472 modem-manager: increase the timeout to wait for modem after uninhibited
The timeout to wait for the modem after being uninhibited was until
now exclusively to cover the port probing time, because the device
would be already available and ready to be used as soon as the
inhibition was removed.

With the change to include carrier config selection as part of the
fwupd upgrade process, the time to wait for the modem after being
uninhibited should now cover a full reboot of the module, and so the
original timeout of 45s could be a bit tight under some circumstances
(e.g the MM device probing logic is quite slow when there is no SIM
card detected by the module).

We increase this timeout to a much safer value of 120s, which is
extremely long for most cases, but should also be enough to cover even
the worst case scenario.
2019-04-09 07:54:46 -04:00
Aleksander Morgado
ffb8fd5edc modem-manager: implement qmi pdc active config selection as attach()
When we install the MCFG carrier config files with QMI PDC, we were
not explicitly selecting one, and that would end up reporting the
"DF" (default) config is in use. Instead, we should explicitly select
the carrier configuration that we were using before the firmware
upgrade operation.

For example, if the device originally was running with the Vodafone
specific carrier configuration (e.g. T77W968.F1.0.0.3.7.VF.009) and we
trigger the upgrade to the next available firmware associated to
the Vodafone carrier (e.g. T77W968.F1.0.0.3.8.VF.009), we would want
the device to boot with the Vodafone carrier config selected, instead
of booting without any config selected (T77W968.F1.0.0.3.8.DF.009).

This also fixes several upgrade problems detected by fwupd, because it
may end up complaining that the target firmware that was selected to
be installed (e.g. VF variant) is not the one actually reported by the
device after the upgrade (e.g. DF variant).

The selection of which is the config to activate is based on mapping
the mcfg file name with the firmware version reported by the module
before the upgrade. E.g. if the VF variant is reported by the module
(T77W968.F1.0.0.3.7.VF.009), fwupd will look for a MCFG file named
with the "mcfg.VF." prefix.
2019-04-09 07:54:46 -04:00
Mario Limonciello
cc3d560571 thunderbolt: Set require-ac for Thunderbolt devices (Fixes: #1142) 2019-04-09 03:15:30 -04:00
Richard Hughes
dce91204c9 Fix some typos spotted using codespell 2019-04-08 12:47:53 +01:00
Mario Limonciello
2df922c23d Move the core built-in 'fwupd' remote over to the dell-esrt plugin
This metadata is useless to other systems, so if compiling a custom
fwupd without -Dplugin_dell=true it shouldn't be included.
2019-04-02 07:18:29 -05:00
Mario Limonciello
33527a8d5c ata: Flush cache before standby and activate
I had thought this should be implicit from standby immediate command
but it isn't.
2019-03-31 16:26:53 -05:00
Mario Limonciello
57816a7907 synapticsmst: blacklist plugin when using amdgpu (Fixes: #1121)
An undiagnosed kernel issue is leading to a kernel crash involving
DP aux reads with amdgpu involved.

It's been reproduced in kernel 4.15 with a DKMS version of amdgpu as
well as kernel 4.19 with amdgpu within the kernel.

```
[16862.519947] [drm:generic_reg_wait [amdgpu]] *ERROR* REG_WAIT timeout 10us * 160 tries - submit_channel_request line:246
[16862.519983] WARNING: CPU: 5 PID: 3015 at drivers/gpu/drm/amd/amdgpu/../display/dc/dc_helper.c:254 generic_reg_wait+0xe2/0x160 [amdgpu]
[16862.519984] Modules linked in: rfcomm snd_hda_codec_realtek snd_hda_codec_generic cmac bnep arc4 nls_iso8859_1 amdkfd amd_iommu_v2 amdgpu i915 dell_rbtn iwlmvm snd_soc_skl wmi_bmof dell_wmi intel_rapl x86_pkg_temp_thermal dell_laptop intel_powerclamp snd_soc_skl_ipc dell_smbios coretemp snd_soc_sst_ipc dell_wmi_descriptor kvm_intel dcdbas snd_soc_sst_dsp snd_hda_ext_core kvmgt dell_smm_hwmon snd_soc_acpi_intel_match mac80211 vfio_mdev crct10dif_pclmul mdev vfio_iommu_type1 crc32_pclmul snd_soc_acpi vfio ghash_clmulni_intel snd_soc_core kvm pcbc snd_compress ac97_bus aesni_intel snd_hda_codec_hdmi snd_pcm_dmaengine chash gpu_sched aes_x86_64 snd_hda_intel crypto_simd snd_hda_codec cryptd ttm glue_helper pcmcia irqbypass snd_hda_core drm_kms_helper intel_cstate intel_rapl_perf snd_hwdep uvcvideo snd_pcm
[16862.520008]  drm cdc_ether iwlwifi cdc_mbim videobuf2_vmalloc snd_seq_midi videobuf2_memops cdc_ncm snd_seq_midi_event videobuf2_v4l2 snd_rawmidi videobuf2_common videodev input_leds serio_raw btusb qmi_wwan btrtl r8152 snd_seq btbcm media cdc_wdm btintel usbnet option mii usb_wwan bluetooth usbserial cdc_acm hid_multitouch joydev snd_seq_device snd_timer cfg80211 snd yenta_socket pcmcia_rsrc idma64 pcmcia_core soundcore virt_dma i2c_algo_bit fb_sys_fops syscopyarea mei_me sysfillrect ecdh_generic sysimgblt mei ucsi_acpi intel_lpss_pci processor_thermal_device typec_ucsi intel_lpss intel_soc_dts_iosf intel_pch_thermal typec wmi soc_button_array mac_hid intel_hid int3400_thermal video int3403_thermal dell_smo8800 sparse_keymap acpi_thermal_rel int340x_thermal_zone acpi_pad sch_fq_codel parport_pc
[16862.520033]  ppdev lp parport ip_tables x_tables autofs4 hid_generic usbhid uas usb_storage e1000e ahci libahci i2c_hid hid
[16862.520040] CPU: 5 PID: 3015 Comm: fwupd Not tainted 4.19.0 #1
[16862.520040] Hardware name: Dell Inc. Latitude 7424 Rugged Extreme/, BIOS 1.0.0 09/12/2018
[16862.520062] RIP: 0010:generic_reg_wait+0xe2/0x160 [amdgpu]
[16862.520063] Code: ab 44 8b 45 20 48 8b 4d 18 44 89 e6 8b 55 10 48 c7 c7 f0 bf 12 c1 44 89 4d d4 e8 79 1d 65 ff 41 83 7d 18 01 44 8b 4d d4 74 02 <0f> 0b 48 83 c4 18 44 89 c8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 41 0f
[16862.520064] RSP: 0018:ffffbdff831ffbe0 EFLAGS: 00010297
[16862.520065] RAX: 0000000000000000 RBX: 00000000000000a1 RCX: 0000000000000000
[16862.520065] RDX: 0000000000000000 RSI: ffff965fee356428 RDI: ffff965fee356428
[16862.520066] RBP: ffffbdff831ffc20 R08: 00000000000004d5 R09: 00000000ffffffff
[16862.520066] R10: fffff464915dbd00 R11: ffffffff981923ed R12: 000000000000000a
[16862.520067] R13: ffff965fdea5d480 R14: 0000000000000001 R15: 0000000000000000
[16862.520068] FS:  00007f17444485c0(0000) GS:ffff965fee340000(0000) knlGS:0000000000000000
[16862.520068] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[16862.520069] CR2: 00007f1732987150 CR3: 000000045f4fe006 CR4: 00000000003606e0
[16862.520070] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[16862.520070] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[16862.520070] Call Trace:
[16862.520097]  submit_channel_request+0x394/0x480 [amdgpu]
[16862.520118]  dc_link_aux_transfer+0xca/0x160 [amdgpu]
[16862.520142]  dm_dp_aux_transfer+0x59/0x120 [amdgpu]
[16862.520146]  drm_dp_dpcd_access+0x75/0x110 [drm_kms_helper]
[16862.520148]  drm_dp_dpcd_read+0x33/0xc0 [drm_kms_helper]
[16862.520152]  auxdev_read_iter+0x10f/0x1d0 [drm_kms_helper]
[16862.520154]  __vfs_read+0x106/0x180
[16862.520155]  vfs_read+0x8e/0x130
[16862.520156]  ksys_read+0x55/0xc0
[16862.520157]  __x64_sys_read+0x1a/0x20
[16862.520159]  do_syscall_64+0x5a/0x120
[16862.520161]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[16862.520162] RIP: 0033:0x7f1741b3a384
[16862.520163] Code: 84 00 00 00 00 00 41 54 55 49 89 d4 53 48 89 f5 89 fb 48 83 ec 10 e8 8b fc ff ff 4c 89 e2 41 89 c0 48 89 ee 89 df 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 38 44 89 c7 48 89 44 24 08 e8 c7 fc ff ff 48
[16862.520163] RSP: 002b:00007fffadd980f0 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
[16862.520164] RAX: ffffffffffffffda RBX: 0000000000000013 RCX: 00007f1741b3a384
[16862.520165] RDX: 0000000000000001 RSI: 00007fffadd98154 RDI: 0000000000000013
[16862.520165] RBP: 00007fffadd98154 R08: 0000000000000000 R09: 000055fd7e9c7010
[16862.520166] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
[16862.520166] R13: 00007fffadd981c0 R14: 00007fffadd98154 R15: 000055fd7eae35b0
[16862.520167] ---[ end trace 8e8b280a234718a5 ]---
[16862.520176] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[16862.520177] PGD 0 P4D 0
[16862.520179] Oops: 0000 [#1] SMP PTI
[16862.520180] CPU: 5 PID: 3015 Comm: fwupd Tainted: G        W         4.19.0 #1
[16862.520181] Hardware name: Dell Inc. Latitude 7424 Rugged Extreme/, BIOS 1.0.0 09/12/2018
[16862.520205] RIP: 0010:dal_ddc_close+0xd/0x30 [amdgpu]
[16862.520207] Code: f1 00 e8 06 f5 ff ff 48 8b 55 f8 65 48 33 14 25 28 00 00 00 75 02 c9 c3 e8 70 09 65 d5 0f 1f 44 00 00 55 48 89 e5 53 48 89 fb <48> 8b 7f 08 e8 da f5 ff ff 48 8b 3b e8 d2 f5 ff ff 5b 5d c3 66 2e
[16862.520208] RSP: 0018:ffffbdff831ffc58 EFLAGS: 00010246
[16862.520209] RAX: ffffffffc103f410 RBX: 0000000000000000 RCX: 0000000000000000
[16862.520210] RDX: ffffffffc10de660 RSI: 0000000000005c58 RDI: 0000000000000000
[16862.520211] RBP: ffffbdff831ffc60 R08: 0000000000000001 R09: 00000000ffffffff
[16862.520211] R10: fffff464915dbd00 R11: 0000000000000001 R12: 0000000000000000
[16862.520212] R13: ffffbdff831ffdd0 R14: ffffbdff831ffd3d R15: 0000000000000000
[16862.520213] FS:  00007f17444485c0(0000) GS:ffff965fee340000(0000) knlGS:0000000000000000
[16862.520214] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[16862.520215] CR2: 0000000000000008 CR3: 000000045f4fe006 CR4: 00000000003606e0
[16862.520216] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[16862.520217] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[16862.520218] Call Trace:
[16862.520242]  release_engine+0x16/0x70 [amdgpu]
[16862.520263]  dc_link_aux_transfer+0xfd/0x160 [amdgpu]
[16862.520287]  dm_dp_aux_transfer+0x59/0x120 [amdgpu]
[16862.520290]  drm_dp_dpcd_access+0x75/0x110 [drm_kms_helper]
[16862.520293]  drm_dp_dpcd_read+0x33/0xc0 [drm_kms_helper]
[16862.520296]  auxdev_read_iter+0x10f/0x1d0 [drm_kms_helper]
[16862.520298]  __vfs_read+0x106/0x180
[16862.520300]  vfs_read+0x8e/0x130
[16862.520301]  ksys_read+0x55/0xc0
[16862.520302]  __x64_sys_read+0x1a/0x20
[16862.520304]  do_syscall_64+0x5a/0x120
[16862.520306]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[16862.520307] RIP: 0033:0x7f1741b3a384
[16862.520308] Code: 84 00 00 00 00 00 41 54 55 49 89 d4 53 48 89 f5 89 fb 48 83 ec 10 e8 8b fc ff ff 4c 89 e2 41 89 c0 48 89 ee 89 df 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 38 44 89 c7 48 89 44 24 08 e8 c7 fc ff ff 48
[16862.520309] RSP: 002b:00007fffadd980f0 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
[16862.520310] RAX: ffffffffffffffda RBX: 0000000000000013 RCX: 00007f1741b3a384
[16862.520311] RDX: 0000000000000001 RSI: 00007fffadd98154 RDI: 0000000000000013
[16862.520312] RBP: 00007fffadd98154 R08: 0000000000000000 R09: 000055fd7e9c7010
[16862.520312] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
[16862.520313] R13: 00007fffadd981c0 R14: 00007fffadd98154 R15: 000055fd7eae35b0
[16862.520314] Modules linked in: rfcomm snd_hda_codec_realtek snd_hda_codec_generic cmac bnep arc4 nls_iso8859_1 amdkfd amd_iommu_v2 amdgpu i915 dell_rbtn iwlmvm snd_soc_skl wmi_bmof dell_wmi intel_rapl x86_pkg_temp_thermal dell_laptop intel_powerclamp snd_soc_skl_ipc dell_smbios coretemp snd_soc_sst_ipc dell_wmi_descriptor kvm_intel dcdbas snd_soc_sst_dsp snd_hda_ext_core kvmgt dell_smm_hwmon snd_soc_acpi_intel_match mac80211 vfio_mdev crct10dif_pclmul mdev vfio_iommu_type1 crc32_pclmul snd_soc_acpi vfio ghash_clmulni_intel snd_soc_core kvm pcbc snd_compress ac97_bus aesni_intel snd_hda_codec_hdmi snd_pcm_dmaengine chash gpu_sched aes_x86_64 snd_hda_intel crypto_simd snd_hda_codec cryptd ttm glue_helper pcmcia irqbypass snd_hda_core drm_kms_helper intel_cstate intel_rapl_perf snd_hwdep uvcvideo snd_pcm
[16862.520332]  drm cdc_ether iwlwifi cdc_mbim videobuf2_vmalloc snd_seq_midi videobuf2_memops cdc_ncm snd_seq_midi_event videobuf2_v4l2 snd_rawmidi videobuf2_common videodev input_leds serio_raw btusb qmi_wwan btrtl r8152 snd_seq btbcm media cdc_wdm btintel usbnet option mii usb_wwan bluetooth usbserial cdc_acm hid_multitouch joydev snd_seq_device snd_timer cfg80211 snd yenta_socket pcmcia_rsrc idma64 pcmcia_core soundcore virt_dma i2c_algo_bit fb_sys_fops syscopyarea mei_me sysfillrect ecdh_generic sysimgblt mei ucsi_acpi intel_lpss_pci processor_thermal_device typec_ucsi intel_lpss intel_soc_dts_iosf intel_pch_thermal typec wmi soc_button_array mac_hid intel_hid int3400_thermal video int3403_thermal dell_smo8800 sparse_keymap acpi_thermal_rel int340x_thermal_zone acpi_pad sch_fq_codel parport_pc
[16862.520351]  ppdev lp parport ip_tables x_tables autofs4 hid_generic usbhid uas usb_storage e1000e ahci libahci i2c_hid hid
[16862.520356] CR2: 0000000000000008
[16862.520357] ---[ end trace 8e8b280a234718a6 ]---
[16862.520380] RIP: 0010:dal_ddc_close+0xd/0x30 [amdgpu]
[16862.520382] Code: f1 00 e8 06 f5 ff ff 48 8b 55 f8 65 48 33 14 25 28 00 00 00 75 02 c9 c3 e8 70 09 65 d5 0f 1f 44 00 00 55 48 89 e5 53 48 89 fb <48> 8b 7f 08 e8 da f5 ff ff 48 8b 3b e8 d2 f5 ff ff 5b 5d c3 66 2e
[16862.520382] RSP: 0018:ffffbdff831ffc58 EFLAGS: 00010246
[16862.520384] RAX: ffffffffc103f410 RBX: 0000000000000000 RCX: 0000000000000000
[16862.520384] RDX: ffffffffc10de660 RSI: 0000000000005c58 RDI: 0000000000000000
[16862.520385] RBP: ffffbdff831ffc60 R08: 0000000000000001 R09: 00000000ffffffff
[16862.520386] R10: fffff464915dbd00 R11: 0000000000000001 R12: 0000000000000000
[16862.520387] R13: ffffbdff831ffdd0 R14: ffffbdff831ffd3d R15: 0000000000000000
[16862.520388] FS:  00007f17444485c0(0000) GS:ffff965fee340000(0000) knlGS:0000000000000000
[16862.520389] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[16862.520390] CR2: 0000000000000008 CR3: 000000045f4fe006 CR4: 00000000003606e0
[16862.520391] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[16862.520392] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
```
2019-03-29 08:13:16 -05:00
Gary Lin
5d9984e5ad uefi: add a new option to specify the os name
fu_uefi_get_esp_path_for_os() generates the path to the OS directory
based on "ID" in /etc/os-release, and it may not work for some distros.

Take openSUSE as an example, the "ID" for openSUSE Leap is
"opensuse-leap" and that for openSUSE Tumbleweed is "opensuse-tumbleweed".
However, both of them use the same OS directory in the ESP, i.e.
"/EFI/opensuse".

This commit adds a new build option, efi_os_dir, to allow the packager to
specify the name of OS directory at build time instead of the runtime
detection.

Signed-off-by: Gary Lin <glin@suse.com>
2019-03-29 04:29:42 -04:00
Mario Limonciello
b7f494364b trivial: ata: fix a transposed character in the | for setting activation device
This doesn't appear to impact the actual setting of the device, but
maybe some other disks will be more finicky in the future.
2019-03-27 17:08:45 -05:00
Richard Hughes
0a57b90d75 uefi: More carefully check the output from tpm2_pcrlist
Otherwise we can get a PCR0 of 'getcapability:getpcrallocationstatuserror'...
2019-03-27 14:18:19 -04:00
Richard Hughes
77d97406f2 uefi: Don't overwrite CustomFlags if set from a quirk 2019-03-27 14:21:00 +00:00
Mario Limonciello
3cdd558fe4 ata: Correct activation functionality
No data is actually exchanged in the activation flow.

The commands need to be sent in the direction `SG_DXFER_NONE` to
avoid ATA errors.
2019-03-27 09:51:59 +00:00
Mario Limonciello
791b596d00 ata: send ATA standby immediate when activating firmware
This should flush all remaining writes and make the drive safe to
update.
2019-03-26 06:30:23 -04:00
Richard Hughes
07c1b2d0f4 superio: Add InstallDuration default value 2019-03-23 16:13:52 +00:00
Richard Hughes
38b357b131 superio: Add support for writing new e-flash contents 2019-03-23 12:04:18 +00:00
Richard Hughes
6c2cc7868f superio: Fix reading the attestation checksum
The 14th signature byte is 'hijacked' as the SPI to e-flash offset in the hw.
2019-03-23 12:04:18 +00:00
Richard Hughes
0573febb0b superio: Add support for reading the device checksum 2019-03-23 12:04:18 +00:00
Richard Hughes
4702dfe0a7 superio: Use the chipset ID in the device name 2019-03-23 12:04:18 +00:00
Richard Hughes
763483411d superio: Move the device flush before getting the register map 2019-03-23 12:04:18 +00:00
Richard Hughes
c5ef28ad5e superio: Move all the IT89xx code to a subclassed device object 2019-03-23 12:04:18 +00:00
Richard Hughes
ebedf62b15 superio: Move all the IT85xx code to a subclassed device object 2019-03-23 12:04:18 +00:00
Richard Hughes
ebd55e5d14 superio: Split and export fu_superio_device_ec_writeX() 2019-03-23 12:04:18 +00:00
Richard Hughes
08609f3920 superio: Remove the port from fu_superio_device_ec_read()
It's always going to be PM1_IOBAD0.
2019-03-23 12:04:18 +00:00
Richard Hughes
1fccae68ad superio: Move the register read/write into the FuSuperioDevice object
This will allow us to use them from subclassed objects.
2019-03-23 12:04:18 +00:00
Richard Hughes
140ce926ae superio: Check the IOBAD0 is usable during setup 2019-03-23 12:04:18 +00:00
Richard Hughes
4c9d00c1d5 superio: Use fu_device_set_firmware_size() 2019-03-23 12:04:18 +00:00
Richard Hughes
bb73e6594d superio: Move some constants out to the common header 2019-03-23 12:04:18 +00:00
Richard Hughes
f83639fb77 superio: Use GObject properties in FuSuperioDevice 2019-03-23 12:04:18 +00:00
Richard Hughes
b12d0bfec5 superio: Convert FuSuperioDevice to be derivable
We'll need this for future refactoring.
2019-03-23 12:04:18 +00:00
Richard Hughes
2da42d3cd4 trivial: Add fu_device_set_firmware_size()
This allows us to set the value where the blob has to be a specific size.
2019-03-21 10:31:35 +00:00
Richard Hughes
2aad104473 trivial: Add fu_common_bytes_compare() 2019-03-21 10:28:20 +00:00
Richard Hughes
36999464c7 trivial: Move a useful function out of libdfu 2019-03-19 21:17:48 +00:00
Richard Hughes
b7537782cb trivial: Fix the debug print when dumping SuperIO registers
Found using Coverity.
2019-03-18 16:35:01 +00:00
Richard Hughes
37b6c70aa0 superio: Add list of SPI commands for future usage 2019-03-18 15:59:33 +00:00
Richard Hughes
5c18617e8f uefi: Actually upload the UPDATE_INFO entry for the UX capsule 2019-03-15 14:22:01 +00:00
Richard Hughes
079b7b6f9d superio: Get the chip size from the EC rather than hardcoding
I'm not sure why we can't just use SIO_LDNxx_IDX_CHIPID1, but lets do the same
as the vendor tool in case there is a good reason that I don't know about.
2019-03-15 13:47:57 +00:00
Richard Hughes
72e7a82c88 uefi: Check the error code of QueryCapsuleCapabilities() correctly
We can't print max or reset as they are undefined in the event of failure.
2019-03-15 09:27:55 +00:00
Peter Jones
fda89fd15e Update the UEFI UX Capsule Header checksum when needed.
Signed-off-by: Peter Jones <pjones@redhat.com>
2019-03-14 14:06:06 -05:00
Richard Hughes
35b6e13d96 uefi: Copy the shimx64.efi binary for known broken firmware
Some system firmware helpfully 'deduplicate' the boot loader entries based on
the filepath, without taking into account either the label or optional data.

This means we have to use a custom copy of shim for firmware updates.
2019-03-14 17:00:53 +00:00
Richard Hughes
0ca78aa2e1 modem-manager: Fix a trivial build warning
Fixes https://github.com/hughsie/fwupd/issues/1082
2019-03-08 18:34:36 +00:00
Richard Hughes
a0f9d2e110 superio: Fix a trivial build warning
Fixes https://github.com/hughsie/fwupd/issues/1081
2019-03-08 18:33:06 +00:00
Mario Limonciello
640faed956 trivial: synapticsmst: remove unneeded fixme
The opening flow for enumerate is as expected right now.
2019-03-05 09:39:29 +00:00
Mario Limonciello
f4c43592fc trivial: uefi: correct an order of operations looking for UX capsule
This was caught by LGTM.

This pointer might have type struct <unnamed> (size 28), but the
pointer arithmetic here is done with type UX_CAPSULE_HEADER * (size 16).
2019-03-05 09:39:29 +00:00
Mario Limonciello
65415e6c8d trivial: uefi: Remove an unnecessary warning caught by LGTM
This clause is indeed impossible to hit due to earlier checks
for the size of `is`.
2019-03-05 09:39:29 +00:00
Mario Limonciello
3143bad0f5 fu-tool: Save device state to @LOCALSTATEDIR@/lib/fwupd/state.json on actions
This feature is turned on with the new fwupdtool option `--enable-json-state`

The intended use case is for ChromeOS to be able to save information about
devices on the system when `fwupdtool update` was run to display in the UX at
a later time.
2019-02-28 10:32:45 -06:00
Aleksander Morgado
fc8093626c modem-manager: implement support for qmi-pdc
If a device reports that qmi-pdc is supported (e.g. DW5821e that
supports both fastboot and qmi-pdc), we'll end up first running the
fastboot installation before doing the qmi-pdc installation procedure.

These changes also make sure that the MM device inhibition is kept for
as long as the whole process is ongoing. Only after the last method is
run, the inhibition will be removed.

In order to handle devices being exposed in the system while the MM
inhibition is in place, e.g. to be able to run qmi-pdc after fastboot,
a simple udev based watcher is included, which will take care of
creating the FuMmDevice that is not associated to any modem currently
exposed by MM, but that shares all the details of the original device.

This new logic assumes that the devices don't change their USB layout
during a firmware upgrade, which is not a very good assumption, but it
works for the case at hand. If this is not the case, we may need to
end up doing some custom AT port probing instead of relying on the
original one reported by MM being still valid (note that we don't rely
on the device name, as that may change if some other device is plugged
in the system while we're doing the update, we rely on the USB
interface number).
2019-02-27 16:09:13 +00:00
Richard Hughes
ffa3b84706 Add a plugin to support ModemManager hardware 2019-02-27 16:09:13 +00:00
Richard Hughes
8a3ab68fcb ata: Support delayed activation
This will allow us to switch to the new firmware version during shutdown when
the filesystems have been remounted readonly.

Activating manually means we don't have to get the user to shutdown and then
do a fresh power-on, rather than the more usual restart.
2019-02-27 09:04:54 +00:00
Mario Limonciello
75784c5644 dell-dock: Use activation when calling fwupdtool activate
This will finish passive flow without unplugging the cable.
This feature requires EC27 or later.
2019-02-27 09:04:54 +00:00
Mario Limonciello
96a0dd5606 Add a support for delayed activation
This is intended for devices that it is not safe to immediately activate
the firmware.  It may be called at a more convenient time instead.

Both fwupdmgr and fwupdtool support the feature.

- if called at runtime with fwupdmgr it uses the daemon
- during shutdown fwupdtool uses the pending.db to perform this feature.
2019-02-27 09:04:54 +00:00
Richard Hughes
f45c651dd1 uefi: Fix the self tests when running on Fedora SilverBlue 2019-02-26 19:13:35 +00:00
Richard Hughes
b768e4d924 Do not fail to start the daemon if tpm2_pcrlist hangs
In some situations SELinux prevents fwupd from executing tpm2_pcrlist, but the
failure mode is that the process just hangs and never completes. This causes
systemd to time out the fwupd daemon startup and then errors to be shown in
GNOME Software.

To prevent this happening, add an optional timeout argument to
fu_common_spawn_sync() and cancel the subprocess if it takes longer than this
to complete.

See https://bugzilla.redhat.com/show_bug.cgi?id=1665701 for details.
2019-02-26 14:27:13 +00:00
Mario Limonciello
e59bee1f45 trivial: dell-dock: make passive dependency include Hub2 1.42
An extra race condition bug exists due to the MCU firmware on Hub2.
Require to already be on 1.42 or later to use passive flow.
2019-02-18 08:03:49 -06:00
Mrmaxmeier
49448a99d4 uefi: fix segfault in fwup_set_update_statuses
If the near-zero memory region is populated, this caused UEFI
updates to get stuck trying to deref random pointers.
2019-02-15 21:26:56 +00:00
Richard Hughes
19a9fc4e6d superio: Implement detach() and attach()
This gets us closer to actually being able to flash the hardware.
2019-02-14 09:12:26 -06:00
Richard Hughes
5acfc64a78 superio: Correct the names of some constants and improve debugging support 2019-02-14 09:12:26 -06:00
Mario Limonciello
8226f84233 trivial: libfwupd: correct a segfault when building a GUID
The order of events when casting causes an access to unintended memory.

```
0x00007ffff7bc19df in fwupd_guid_to_string (guid=0x8000000090d0, flags=FWUPD_GUID_FLAG_MIXED_ENDIAN) at ../libfwupd/fwupd-common.c:550
550		memcpy (&gnat, guid, sizeof(gnat));
(gdb) bt
 #0  0x00007ffff7bc19df in fwupd_guid_to_string (guid=0x8000000090d0, flags=FWUPD_GUID_FLAG_MIXED_ENDIAN) at ../libfwupd/fwupd-common.c:550
 #1  0x00007fffdbddd195 in fu_nvme_device_get_guid_safe (buf=0x7fffffffce70 "\\\034\\\034FI83Q060610103M66   BC501 NVMe SK hynix 128GB", ' ' <repeats 15 times>, "80001C0T\004", <incomplete sequence \344\254>, addr_start=3110) at ../plugins/nvme/fu-nvme-device.c:83
 #2  0x00007fffdbddd60c in fu_nvme_device_parse_cns_maybe_dell (self=0x5555558cc8a0, buf=0x7fffffffce70 "\\\034\\\034FI83Q060610103M66   BC501 NVMe SK hynix 128GB", ' ' <repeats 15 times>, "80001C0T\004", <incomplete sequence \344\254>) at ../plugins/nvme/fu-nvme-device.c:201
 #3  0x00007fffdbddda64 in fu_nvme_device_parse_cns (self=0x5555558cc8a0, buf=0x7fffffffce70 "\\\034\\\034FI83Q060610103M66   BC501 NVMe SK hynix 128GB", ' ' <repeats 15 times>, "80001C0T\004", <incomplete sequence \344\254>, sz=4096, error=0x7fffffffe008) at ../plugins/nvme/fu-nvme-device.c:295
 #4  0x00007fffdbddde68 in fu_nvme_device_setup (device=0x5555558cc8a0, error=0x7fffffffe008) at ../plugins/nvme/fu-nvme-device.c:376
 #5  0x0000555555587850 in fu_device_setup (self=0x5555558cc8a0, error=0x7fffffffe008) at ../src/fu-device.c:2076
 #6  0x0000555555587412 in fu_device_open (self=0x5555558cc8a0, error=0x7fffffffe008) at ../src/fu-device.c:1920
 #7  0x000055555558aa88 in fu_device_locker_new_full (device=0x5555558cc8a0, open_func=0x5555555872cb <fu_device_open>, close_func=0x555555587424 <fu_device_close>, error=0x7fffffffe008)
    at ../src/fu-device-locker.c:154
 #8  0x000055555558a925 in fu_device_locker_new (device=0x5555558cc8a0, error=0x7fffffffe008) at ../src/fu-device-locker.c:104
 #9  0x00007fffdbddc4cd in fu_plugin_udev_device_added (plugin=0x5555558a6420, device=0x5555558c6300, error=0x7fffffffe008) at ../plugins/nvme/fu-plugin-nvme.c:24
 #10 0x0000555555592cbf in fu_plugin_runner_udev_device_added (self=0x5555558a6420, device=0x5555558c6300, error=0x7fffffffe070) at ../src/fu-plugin.c:1281
 #11 0x000055555557f0a8 in fu_engine_udev_device_add (self=0x5555557f9840, udev_device=0x5555558e5900) at ../src/fu-engine.c:3491
 #12 0x000055555557f480 in fu_engine_enumerate_udev (self=0x5555557f9840) at ../src/fu-engine.c:3555
 #13 0x0000555555580fc6 in fu_engine_load (self=0x5555557f9840, error=0x7fffffffe2c8) at ../src/fu-engine.c:4117
 #14 0x0000555555566567 in fu_util_start_engine (priv=0x5555557eeb20, error=0x7fffffffe2c8) at ../src/fu-tool.c:138
 #15 0x00005555555674e2 in fu_util_get_devices (priv=0x5555557eeb20, values=0x7fffffffe5d8, error=0x7fffffffe2c8) at ../src/fu-tool.c:490
 #16 0x0000555555566aff in fu_util_run (priv=0x5555557eeb20, command=0x7fffffffe81a "get-devices", values=0x7fffffffe5d8, error=0x7fffffffe2c8) at ../src/fu-tool.c:242
 #17 0x000055555556a514 in main (argc=2, argv=0x7fffffffe5c8) at ../src/fu-tool.c:1445

```
2019-02-13 16:40:07 +00:00
Mario Limonciello
9a83af0262 dell-dock: Filter the last supported payloads of certain board 4 SKUs
EC23 is the last version that will be supported on board 4 SKUs with
base PD firmware versions 18+.

* If on EC23 already, don't mark the device as updatable anymore.

* Flashing EC24 or later when currently on EC 22 or less will potentially
  cause bricked docks that can't enumerate, so prevent this scenario
  during update path.
2019-02-13 06:44:25 +00:00
Richard Hughes
bc7475f1a1 wacom-usb: Use the correct buffer format for the touch module
The specifications are wrong...
2019-02-12 10:16:42 -06:00
Richard Hughes
392e5aa817 wacom-usb: Set the install duration for each device type 2019-02-12 10:16:42 -06:00
Richard Hughes
1ec05cb11f wacom-usb: Return with an error if there were too many retries 2019-02-12 10:16:42 -06:00
Richard Hughes
2c292fba4f wacom-usb: Make updating less verbose 2019-02-12 10:16:42 -06:00
Richard Hughes
20f14c29cb uefi: Allow devices to create more complete fake UEFI devices
Also, gets rid of two 'TODO' warnings with LGTM.
2019-02-12 06:28:51 -06:00
Richard Hughes
8cfbb25c31 trivial: Fix a few 'Sign check of bitwise op' LGTM warnings
Not really a bug, as @crc and @data are both unsigned.
2019-02-12 06:28:51 -06:00
Richard Hughes
10b2fef1bd trivial: Fix a 'Comparison is always true' LGTM warning
Not a bug, but somewhat muddled logic I guess.
2019-02-12 06:28:51 -06:00
Richard Hughes
c909ab3f3c unifying: Fix regression when recovering from failed flash
The unifying version numbers are of the form 'RQR24.00_B0000' which means we
have to force the plugin to 'plain' version format to avoid stripping out the
non-semver chars.

Fixes https://github.com/hughsie/fwupd/issues/1018
2019-02-12 10:00:02 +00:00
Richard Hughes
bfd946e463 Use '#pragma once' to avoid a lot of boilerplate 2019-02-09 08:42:30 -06:00
Mario Limonciello
eb8b38f158 trivial: storage: Update minimum Dell component ID length to 6
Dell storage team confirmed that nothing shorter than 6 will ever
be used and so this heuristic can be stronger.
2019-02-08 16:06:14 +00:00
Mario Limonciello
2e9a4242c5 trivial: dell-dock: bump passive requirement to EC25+
Turns out we can't have nice things that work properly just yet.
2019-02-08 06:31:21 +00:00
Richard Hughes
b3aa793539 thunderbolt: Convert the instance IDs as we never open the device 2019-02-07 18:56:15 +00:00
Richard Hughes
90112823df udev: Manally call fu_device_setup() to convert the instance IDs
The udev plugin is somewhat special as it uses a non-subclassed FuDevice that
never gets 'opened'.

This means that we never automatically call fu_device_setup() and thus the
instance IDs are not converted into GUIDs before the device is added.
2019-02-07 11:26:50 -06:00
Richard Hughes
5df0e7de30 trivial: Fix the spelling of 'module' in wac-usb 2019-02-06 14:48:48 +00:00
Richard Hughes
2b005b2869 wacom-usb: Record the block number when failing 2019-02-06 14:48:48 +00:00
Richard Hughes
90d3075a5d wacom-usb: The touch address is big endian
The example in the specifications should have told us that...
2019-02-06 14:48:48 +00:00
Richard Hughes
6fe54f23e0 wacom-usb: Accept a non-binary IHEX file for the touch update 2019-02-06 14:48:48 +00:00
Richard Hughes
409ccd6142 trivial: Use fu_common_dump_raw() in wacom-usb 2019-02-06 14:48:48 +00:00
Richard Hughes
c91ec869be wacom-usb: Only poll when the device status is 'busy' 2019-02-06 14:48:48 +00:00
Richard Hughes
7c6009038e wacom-usb: Only reboot the device when all composite devices have been updated 2019-02-06 14:48:48 +00:00
Richard Hughes
4530c44f2d wacom-usb: Fix flashing failure with latest Intuos Pro tablet
The checksum is now stored as the very last flash descriptor, so we need to pad
the SREC data to include the 'missing' data range. As we're doing that, we
should optimize like the Wacom updater does and skip writing descriptors that
are unused.
2019-02-06 14:48:48 +00:00
Richard Hughes
040ac626b5 dfu: Fill holes when reading SREC files
It is perfectly valid to have non-continuous ranges, so fill in any holes like
we do for Intel HEX files.
2019-02-06 14:48:48 +00:00
Richard Hughes
6b78d64987 Add fwupd_guid_from_string() to drop dep on uuid
This also allows us to write mixed-endian structures and adds tests. As part of
this commit we've also changed the API of something that's not yet been in any
tarball release, so no pitchforks please.
2019-02-06 14:48:04 +00:00
Richard Hughes
0b0fab8fed wacom-raw: Check the InstanceID rather than GUID
Since the _NO_AUTO_INSTANCE_IDS change we need to actually check the ID, rather
than the GUID.
2019-02-06 08:02:16 +00:00
Richard Hughes
1bc432316a Defer the InstanceID->GUID hashing until after setup
This allows hardware from OEMs to *not* match generic firmware supplied by the
device manufacturer. The idea being, that the OEM will supply firmware that
will actually work on the device.

Based on a patch from Mario Limonciello, many thanks.
2019-02-06 08:02:16 +00:00
Mario Limonciello
2472e45ac6 ata: Check for USB enclosures as well
I noticed that a SATA drive connected to an USB2.x to ATA bridge was
recognized as internal otherwise.
2019-02-05 20:29:26 +00:00
Richard Hughes
b8c30b8732 Do not use efivar just to print a mixed endian GUID 2019-02-04 15:19:57 +00:00
Richard Hughes
65c81921b6 Add fu_device_add_instance_id() and prefer explicit conversion 2019-02-04 15:19:57 +00:00
Richard Hughes
592baedfff Export some of the GUID functionality 2019-02-04 15:19:57 +00:00
Richard Hughes
5297678d3c Allow a plugin to set _ANOTHER_WRITE_REQUIRED to run more than one plugin
For this to work with different plugins the device IDs must match.
2019-02-04 14:54:54 +00:00
Richard Hughes
c6c312f267 trivial: Move fu_plugin_runner_schedule_update() into the engine 2019-02-04 14:54:54 +00:00
Mario Limonciello
8efc5a3633 nvme: Add an extra check for Dell plugins to avoid false positives
Component IDs should always be ASCII characters.
None have been reported yet, but this should still help to prevent them.
2019-02-04 10:39:20 +00:00
Mario Limonciello
b503aa8650 ata: Add support for detecting Dell GUIDs
Similar to NVME, ATA drives distributed by Dell have special values
that should be used to designate fwupd GUIDs and only run correct
firmware.

When detecting Dell GUIDs remove the standard fwupd GUIDs.  "Generic"
firmware targeted to those GUIDs will fail to install.
2019-02-04 10:39:20 +00:00
Mario Limonciello
b05a918431 trivial: Move GUID testing into fu-common-guid
This allows other plugins to use this part of the routine.
2019-02-04 10:39:20 +00:00
Richard Hughes
96e6783982 trivial: Fix potential compile failures for high -j values 2019-02-01 16:52:16 +00:00
Richard Hughes
1e07ec95b6 uefi: Disable -Wno-address-of-packed-member
Unaligned reads don't really matter on all the architectures the EFI binary is
being built for.
2019-02-01 16:38:14 +00:00
Richard Hughes
c6b94791ec uefi: Don't unconditionally enable Werror for the EFI binary 2019-02-01 16:38:14 +00:00
Richard Hughes
0a26551bf3 ata: Default to the non-activation 0xE subcommand
During download and activation we have to reset the drive to apply the new
firmware. If the kernel gets an unexpected ATA reset then it might panic.
Default to activating the command on the next drive power-up to be safe.

Many thanks to the Dell storage team for the advice.
2019-02-01 06:13:38 -06:00
Aleksander Morgado
0f0da353c2 fastboot: Use a much longer timeout as the removal delay
A device that has gone through a fastboot update may need more than
the previous default of 10s to come back up. Just use a much longer
value to make sure it's detected properly.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2019-02-01 10:26:43 +00:00
Mario Limonciello
303c4f0f90 trivial: upower: correct a logic error from ed021ab
When unable to read battery value this should return FALSE to indicate
AC power.
2019-01-31 14:56:08 -06:00
Mario Limonciello
1d26689b2f trivial: dell-dock: mirror update status from passive flow
If fwupd is restarted multiple times before dock is unplugged, don't
let any devices update if we can avoid it.
2019-01-31 10:53:54 -06:00
Mario Limonciello
ead0deaa25 trivial: dell-dock: enable passive flow on all EC23+
The feature did land in EC23 and testing looks positive.
2019-01-31 10:53:54 -06:00
Richard Hughes
206b70120d dfu: Simplify the SREC parser to avoid a crash with an invalid file
Splitting the file into lines does increase memory usage, but allows us to use
a much simpler parser design. This is just like we fixed IHEX a few weeks ago.
2019-01-31 16:05:34 +00:00
Richard Hughes
ccc79c9fbc trivial: Split out strnsplit for future use 2019-01-31 16:05:34 +00:00
Richard Hughes
c1fad937d8 wacom-raw: Use the correct error codes when the panel is not supported
Otherwise, we get a nasty red console warning when plugging in a *USB* panel.
2019-01-31 11:55:48 +00:00
Richard Hughes
a3b13046c2 wacom-usb: Add some more information to the README 2019-01-31 11:55:12 +00:00
Mario Limonciello
769f990cf6 trivial: dell: filter another dock SKU from this plugin
Prevents showing errors in the logs
2019-01-30 11:00:45 -06:00
Mario Limonciello
423dde520c dell: Check that the flash interface command is available
This prevents the kernel showing errors when running on systems
without this command.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=202259
2019-01-30 11:00:45 -06:00
Richard Hughes
52b9800744 wacom-usb: Fix the plugin name to allow devices to be updated 2019-01-30 13:09:54 +00:00
Richard Hughes
b9b6834f54 trivial: Add FuFastbootDeviceReadFlags to fu_fastboot_device_cmd() 2019-01-30 12:14:17 +00:00
Aleksander Morgado
046c84b5b3 fastboot: flash the partition after downloading the file 2019-01-30 12:14:17 +00:00
Richard Hughes
44ce5aeae4 uefi: Add a quirk to use the legacy bootmgr description
Some hardware from Lenovo deduplicates UEFI Boot entries, and uses the old
string 'Linux-Firmware-Updater' to avoid removing the firmware update entry.
Although this is forbidden in the UEFI specification we shouldn't break
firmware updates from old firmware versions.

Provide a quirk for this, and automatically whitelist anything with the LENOVO
SMBIOS Manufacturer.
2019-01-30 12:13:39 +00:00
Richard Hughes
dd0264d0ef ata: Mark all devices as needing a reboot
Although not strictly required, I would feel a lot more warm and fuzzy knowing
the drives are running the new firmware ASAP.
2019-01-30 06:10:36 -06:00
Richard Hughes
0bf8ee810b ata: Add a new plugin to upgrade firmware on ATA/ATAPI hardware
Some of the ATA12 fixup code is by Mark Lord, taken from the hdparm project.

Fixes: https://github.com/hughsie/fwupd/issues/946
2019-01-29 22:28:09 +00:00
Richard Hughes
4fef28d0ac trivial: Add the missing protocol IDs to the plugin READMEs 2019-01-29 22:28:09 +00:00
Richard Hughes
f6838c738a trivial: Add fu_udev_device_get_slot_depth()
We'll need this for another plugin soon.
2019-01-29 22:28:09 +00:00
Mario Limonciello
5502cd5689 dell-dock: Add support for a passive flow
This behavior will prevent the dock from performing most resets until
it has been unplugged from a host system.

This significantly speeds up the perceived update duaration and prevents
data loss during update.

It's not confirmed whether EC23 or later EC will enable it.
* So only enable by a custom flag until this is confirmed.
* Custom flag will be dropped when included into stable EC release.

This functionality also relies upon the CAB file providing a message warning
user that the dock might not be usable after unplugging for up to 1 minute.
2019-01-29 15:51:12 -06:00
Richard Hughes
0a212fd1d6 uefi: Add a trivial debugging statement to debug a UX capsule failure 2019-01-25 11:04:35 +00:00
Richard Hughes
9ba9d8a98b uefi: Use fwup_new0() to allocate the updates table array
Although malloc probably works due to the page size, it's not the thing to use.
2019-01-25 11:04:30 +00:00
Szczepan Zalega
f80bb89238 nitrokey: Correct Nitrokey Storage invalid firmware version read
Currently used structures were based on early libnitrokey definitions
(which were broken for some time). Corrected their sizes and elements,
and added tests.

Fixes #960

Signed-off-by: Richard Hughes <richard@hughsie.com>
2019-01-25 09:53:05 +00:00
Mario Limonciello
654b583031 trivial: dell-dock: Correct a left shift error in BIT_CLEAR macro 2019-01-24 10:35:53 -06:00
Mario Limonciello
d6e453b0ba dell-dock: Add support for flashing Thunderbolt over I2C
This uses an API in the Realtek USB 3.1G2 controller to perform
the flash procedure.
2019-01-24 16:23:00 +00:00
Richard Hughes
367f4590d6 wacom-raw: Add a plugin to update Wacom embedded EMR and AES panels 2019-01-24 10:18:40 +00:00
Richard Hughes
42c514764a dfu: Ignore the SUB ASCII value
This is probably written by a non-free post-processing tool and can be ignored.
2019-01-22 14:43:13 +00:00
Richard Hughes
720b5deb00 dfu: Fix the parser to support extended segment addresses
Split the data into lines, which is less efficient but also much easier to
understand and debug.
2019-01-22 14:43:13 +00:00
Richard Hughes
f6a6fe8ec5 dfu: Support ihex files with leading comments
Also look for the EOF in the file.
2019-01-22 14:43:13 +00:00
Mario Limonciello
b13f784462 trivial: dell: When plugging in a dock supported by dell-dock don't show an error
Some aspects of the method for querying dock firmware do work in 'dell' plugin
but that is not useful for fwupd because it's incomplete.

Due to this the following error shows up in fwupd journal if run on a Dell system
when the new Dell dock is plugged in:
failed to add USB device 0bda:8153: failed to add device using on dell: invalid dock component request Query 3 0 2 4 0

Detect this scenario, and prevent showing errors in logs.
2019-01-22 09:11:50 +00:00
Mario Limonciello
68fb11f453 uefi: Correct a boot order creation bug (Fixes: #956)
Unfortunately the previous fix (6131f5d) introduced this bug.

The code previously was actually looking for the non-zero case
which was correct, but non-obvious since `efi_guid_cmp` works like
`g_strcmp0` where a match returns zero.

So rather than revert 6131f5d make this completly explicit.
2019-01-22 07:28:32 +00:00
Richard Hughes
088c258894 trivial: Make one uefi function static 2019-01-20 22:29:44 +00:00
Richard Hughes
c7327385f4 uefi: Remove all variable length arrays 2019-01-20 22:29:44 +00:00
Richard Hughes
31c10b7293 uefi: Fix a logic bug in fwup_search_file()
If n_handles==0 then we'd return with EFI_SUCCESS, rather than failure.
2019-01-20 22:29:44 +00:00
Richard Hughes
59407ca42d uefi: Use _cleanup_free in one more place 2019-01-20 22:29:44 +00:00
Richard Hughes
00b87884c4 uefi: Do not pass required attrs to fwup_delete_variable()
This lets us refactor some code and remove some complexity.
2019-01-20 22:29:44 +00:00
Richard Hughes
aa6498866c uefi: Delete the old Linux-Firmware-Updater boot entry 2019-01-20 22:29:44 +00:00
Richard Hughes
525433e4de uefi: Use the GNU-EFI BOOL type 2019-01-20 22:29:44 +00:00
Richard Hughes
818071d178 uefi: Refactor and simplify the EFI loader 2019-01-19 18:36:46 +00:00
Richard Hughes
f425d29a28 Show a console warning if loading an out-of-tree plugin
Fixes https://github.com/hughsie/fwupd/issues/950
2019-01-19 07:26:20 +00:00
Richard Hughes
4e30d25668 UEFI: Do the UX checksum calculation in fwupd
This makes the EFI binary much simpler.
2019-01-18 19:27:21 +00:00
Richard Hughes
09bf3b5246 trivial: Don't manually zero-fill efi_ux_capsule_header_t 2019-01-18 19:27:21 +00:00
Richard Hughes
4bdb513937 trivial: Make the capsule_image_size calculation more obvious 2019-01-18 19:27:21 +00:00
Richard Hughes
e554c1b501 trivial: Clarify our position on proprietary plugins 2019-01-18 12:21:46 -06:00
Richard Hughes
5dc757f6c1 wacom-usb: Add two more Intuos tablets
These do not need the runtime-version quirk like the others.
2019-01-18 16:11:53 +00:00
Richard Hughes
4a68fd60dc nvme: Add the needs-shutdown quirk to Phison NVMe drives
Affected drives should have a prominent statement in the update description,
possibly even the first line so it shows up by default in the updates panel.
2019-01-17 16:35:34 +00:00
Richard Hughes
b91efa6c38 trivial: Cast to FuDevice from FuUdevDevice 2019-01-17 16:35:34 +00:00
Richard Hughes
72c18fd4e4 Use GCC __cleanup__ features in the EFI loader
This simplifies memory management.
2019-01-16 12:06:09 -06:00
Richard Hughes
fc90f3954e nvme: Add flag to support manually aligning the firmware to the FWUG value
This is required for drives from Phison.
2019-01-16 13:14:50 +00:00
Richard Hughes
d5f0da15ab nvme: Support FGUID to get the SKU GUID 2019-01-16 13:14:50 +00:00
Richard Hughes
a9d81cfb10 nvme: Support FWUG to get the write block size 2019-01-16 13:14:50 +00:00
Richard Hughes
1eaf71c91b nvme: Add trivial comment to clarify address bitshifting 2019-01-16 13:14:50 +00:00
Richard Hughes
b6e9dacc9a uefi: Do not check the BGRT status before uploading a UX capsule
Microsoft description about the Status is:

    The Status field of the BGRT describes whether the image is currently
    displayed on the screen. This is not applicable to the firmware update
    display capsule.

Many thanks to Steven Chang for identifying this issue.

Fixes: https://github.com/hughsie/fwupd/issues/935
2019-01-16 13:08:48 +00:00
Richard Hughes
e58fa31887 dfu: Fix flashing various Jabra devices
Do not unset the quirks when closing the device, the _NO_DFU_RUNTIME quirk is
needed when re-opening the device during detach.

Fixes https://github.com/hughsie/fwupd/issues/927
2019-01-16 11:22:05 +00:00
Mario Limonciello
ed021ab448 upower: Add support for checking battery percentage
On any devices that normally would require checking for AC also
check that at least one battery on the system has at least 30% to
perform an update.

Fixes: #925
2019-01-15 10:43:18 -06:00
Mario Limonciello
78efa4d2a6 trivial: thunderbolt: If unable to find inactive nvmem, don't mark updatable
This situation may happen in the future in systems where the TBT NVM is embedded
in a different location and only upgradable through system firmware.
2019-01-15 10:33:52 -06:00
Richard Hughes
fa8b7aab0a nvme: Check the return code of the admin passthru ioctl
This meant we reported firmware update success when the image format or offset
was incorrect.
2019-01-15 16:26:30 +00:00
Mario Limonciello
18f3ab4e4d trivial: dell-dock: Prohibit downgrades on board 4 or later below EC19
Some SKUs of board 4 and later have silicon that will not work with anything
but EC19 or later.  So once flashed up to EC19 prohibit downgrades below that
to keep from bricking devices.
2019-01-15 08:52:12 +00:00
Mario Limonciello
84e948a5b0 trivial: dell-dock: correct an assertion related to setting EC version
This is probably fall out from a previous code re-shuffling.
The EC version is already set elsewhere, and in many cases `self->ec_version`
is `NULL` at this time.
2019-01-10 13:44:48 -06:00
Mario Limonciello
8963d6b4b2 dell-dock: Set minimum board to board 4
This allows dropping all the quirks related to older boards.
2019-01-08 12:36:36 -06:00
Mario Limonciello
993fc1636c dell-dock: Workaround a manufacturing bug for board level 4
Board 4 was manufactured with package version 89.16.01.00 and this
will prevent properly upgrading between releases.  Reset this version
to 00.00.00.00 if detected on this board.
2019-01-08 12:36:36 -06:00
Mario Limonciello
b4e3698cfb dell-dock: Wait longer for re-enumeration on TBT SKU
Emperically this seems to take 7-10 seconds longer on this SKU.
2019-01-08 12:36:36 -06:00
Richard Hughes
831eb7ef7e superio: Support IT89xx devices
We can switch to LDN 0x11 and read the IO base address for the PM1 legacy port
rather than hardcoding data and command ports.
2019-01-08 12:53:57 +00:00
Richard Hughes
305f1f2ab1 trivial: Add some debugging data to wacom-usb 2019-01-02 09:50:39 +00:00
Richard Hughes
0e17e6d030 Fix building with -Wl,-z,defs
This allows us to find undefined references at compile time, not runtime.
2018-12-25 16:10:54 -06:00
Richard Hughes
363127e518 ebitdo: Fix the reported version number if the daemon locale is not C.UTF-8
Always use a dot as the delimiter of a semver rather than treating it as a
floating point number.

Related to https://github.com/hughsie/lvfs-website/issues/216
2018-12-25 16:09:45 -06:00
Miklós Márton
7f59a6f844 Add Dell TB18DC to the known devices list 2018-12-25 16:08:10 -06:00
Richard Hughes
420ccd46fa Allow replacing the last byte in the image when using 'dfu-tool replace-data'
Fixes https://github.com/hughsie/fwupd/issues/903
2018-12-18 08:35:24 +00:00
Richard Hughes
8d02612893 trivial: Fix an error code if a search string is unfound 2018-12-18 08:34:27 +00:00
Richard Hughes
9d6dc95f41 trivial: Fix a memory leak if dfu-tool returns with an error 2018-12-18 08:34:06 +00:00
Richard Hughes
b56015ed3f uefi: Add the PCR0 value as the device checksum for system firmware
We can't actually access the UEFI ROM from userspace, but the PCR0 is a hash
built from the ROM itself. We could use this value to ensure the firmware has
been written correctly, and that the PCR0 matches the expected value specified
in the metadata.
2018-12-14 19:23:04 +00:00
Richard Hughes
9729584ee4 Allow plugins to define support for a 'well-known' protocol
Future metadata from the LVFS will set the protocol the firmware is expected to
use. As vendors love to re-use common terms like DFU for incompatible protocols,
namespace them with the controlling company ID with an approximate reverse DNS
namespace.

This also allows more than one plugin to define support for the same protocol,
for instance rts54hid+rts54hub and synapticsmst+dell-dock.
2018-12-14 18:15:01 +00:00
Mario Limonciello
8612318158 uefi: When adding headers set the header size to 4k
This solves issues with implementations that require 4k alignment
of pages in BIOS which is seen on certain architectures.

The UEFI spec prescribes that the "minimum" size is the size of
the EFI header but that this may be increased up to larger sizes
due to extended header entries.
2018-12-11 12:51:57 -06:00
Mario Limonciello
2ac3aca2a7 uefi: Append the header on capsules without headers from Linux
This allows using better heuristics and potentially phasing this out
in the future.
2018-12-11 12:51:57 -06:00
Mario Limonciello
6131f5df8f trivial: uefi: correct a logic error in setting variable
efi_guid_cmp uses memcmp and hence should return 0 when a match
is found.
2018-12-11 12:51:57 -06:00
Mario Limonciello
c9d775c321 trivial: dell-dock: Correct variable for turning off HDCP 2.2 2018-12-07 14:17:41 -06:00
Richard Hughes
8dc599a23e flashrom: Ensure the quirks database is set on the new object 2018-12-07 16:30:55 +00:00
Richard Hughes
a0da340b60 uefi: Do not add devices with invalid GUIDs
Note: We deliberately don't add the device without 'UPDATABLE' as there's
nothing the user can actually do to repair this themselves.
2018-12-07 09:05:30 -06:00
Richard Hughes
bccaaf5194 Add shared functionality for reading and writing with O_NONBLOCK
Two plugins have very similar code already, and we're about to get another.
2018-12-06 14:07:02 +00:00
Richard Hughes
e59cb9af01 trivial: Add fu_common_dump_raw() 2018-12-05 15:09:56 +00:00
Richard Hughes
8949f3d066 wacom-usb: Remove the DTH generation hardware as it will not work with fwupd
Fixes https://github.com/hughsie/fwupd/issues/882
2018-12-05 11:41:59 +00:00
Mario Limonciello
8ec36ae826 trivial: dell-dock: reverse MST update order for I2C
This mirrors the update process over DP aux to run the ESM update
first.

The thought process is as follows:
The "version" displayed doesn't show ESM version, only standard
bank version.
So if the update fails for the ESM then because the update of the
standard happening first it would never be flashed.
2018-12-04 06:16:29 -06:00
Mario Limonciello
d73fbe08ce thunderbolt: Remove a superfluous boundary condition when verifying update
`g_ascii_strtoull` returns 0 and sets `errno` to `-EINVAL` only when
the base is invalid.  It's hardcoded to `16` so this is impossible.
Reading `-EINVAL` from `errno` is incorrect in these circumstances.

Fixes: https://github.com/hughsie/fwupd/issues/879
2018-12-03 14:28:48 -06:00
Richard Hughes
b4fd12a4c6 Add a plugin to update hardware that supports fastboot 2018-12-03 15:50:38 +00:00
Richard Hughes
1c4e06925c trivial: Speed up daemon startup
Require a quirk match for Unifying hardware to avoid probing a lot of USB
devices at startup.
2018-12-03 15:23:27 +00:00
Richard Hughes
0585172c17 trivial: Document the expected plugin firmware formats 2018-12-03 08:48:13 -06:00
Richard Hughes
b27a2520cc dfu: Require a specific USB class and subclass for DFU mode
This makes startup quicker as we no longer have to probe every USB device, and
is now possible with the new GUIDs we added. Devices not using the
specification-provided values can (and already are) worked around with quirks.
2018-12-03 13:57:52 +00:00
Richard Hughes
6dc8680e15 amt: Fix a crash if AMT returns an empty response
Mixing integer return values and GError is never a good idea.

Fixes https://bugzilla.redhat.com/attachment.cgi?id=1510083
2018-11-30 15:22:17 +00:00
Richard Hughes
57908bebc1 wacomhid: Rename to wacom-usb
We're adding another Wacom plugin soon, this one also using hidraw -- but the
new protocol uses a different 'raw' protocol and does not use USB.
2018-11-29 13:26:29 +00:00
Mario Limonciello
817a15a1bf trivial: dell-dock: Set EC version to daemon before EC reset
If the process fails (or was skipped due to 'skip-restart') this will
prevent the daemon from trying again until the dock has been power
cycled.
2018-11-27 11:05:26 +00:00
Mario Limonciello
1210332e05 trivial: dell-dock: fail when EC indicates flashing an invalid/unsigned image
Otherwise this would cause fwupd to sit in an endless loop when providing a bad
image.

This additional enum is only available in EC16, but since it doesn't break existing
API on older EC images, don't bump minimum requirement to EC16 yet.
2018-11-27 11:05:26 +00:00
Richard Hughes
328b00eec3 Remove DaemonVersionFormat=quad
This metadata key is now unnecessary, as firmwares are expected to set the
version format in the metadata.

If the metadata is missing, the LVFS allows a per-vendor default for non-semver
release versions which is now unconditionally set in metadata.
2018-11-21 19:06:51 +00:00
Richard Hughes
75b965d01d Shut down the daemon after 2h of inactivity
Plugins are allowed to 'opt-out' of this behaviour using _RULE_INHIBITS_IDLE.
This should be used where waking up the hardware to coldplug is expensive,
either from a power consumption point of view, or if other artifacts are going
to be seem -- for instance if the screen flickers when probing display devices.

This functionality is also inhibited when the actual upgrade is happening,
for obvious reasons.

Admins can turn off this auto-sleep behaviour by editing the daemon.conf file.

Fixes https://github.com/hughsie/fwupd/issues/417
2018-11-21 18:54:44 +00:00
Richard Hughes
9cf352db2f trivial: Add InstallDuration values for 8bitdo devices 2018-11-15 15:43:43 +00:00
Richard Hughes
0443a4170a trivial: Add InstallDuration values for Unifying devices 2018-11-15 15:43:43 +00:00
Richard Hughes
5ed4d968ac trivial: Add InstallDuration values for ColorHug devices 2018-11-15 15:43:43 +00:00
Richard Hughes
86b79fb039 Speed up fwupd startup by loading less thunderbolt firmware
We load the Thunderbolt controller firmware to see if the controller is in
native mode, as this changes the GUID. If the controller is asleep the firmware
is not cached by the kernel and it can take more than 4 seconds to read out
504kB of firmware.

We only need the first two 64-byte chunks, so only read what is required.
This speeds up fwupd starting substantially, and also means we don't have to
allocate a giant chunk of heap memory just to inspect one byte.

Fixes: https://github.com/hughsie/fwupd/issues/848
2018-11-14 16:21:52 +00:00
Richard Hughes
840184929b trivial: Fix some function prefixes for Thunderbolt 2018-11-14 16:21:52 +00:00
Richard Hughes
ac458d3436 Guess the version format when it is not provided
The most important change here is that versions without dots (not a 'semver')
are treated as 'PLAIN' rather than 'UNKNOWN'.
2018-11-14 11:52:46 +00:00
Mario Limonciello
c7fe0a7453 trivial: Add quirk documentation
Fixes https://github.com/hughsie/lvfs-website/issues/192
2018-11-13 09:53:19 +00:00
Richard Hughes
ba2f0ae1d4 trivial: Document the GUID generation scheme
Fixes https://github.com/hughsie/fwupd/issues/837
2018-11-08 20:39:46 +00:00
Nicolas Saenz Julienne
9e21daaef4 ebitdo: remove SF30/SN30 pro device ids
The ids clash with the Xbox controller ids. This makes the Xbox controller unusable since fwupd unloads the device just after connecting it and fails to update it not being a 8bitdo device.

As seen here: https://github.com/paroj/xpad/issues/114
2018-11-07 10:52:54 +00:00
Mario Limonciello
777fabf033 dell-dock: Drop delayed MST callback routine
Since dell_dock is the priority plugin for MST flashing the VMM5331
no need to do delayed callbacks anymore.

When the dell_dock plugin bumps to EC 15 being the minimum requirement
more code can also be dropped.
2018-11-05 13:44:12 -06:00
Mario Limonciello
5e36c9e792 synapticsmst: Adjust EVB board handling
1. Since board ID in synapticsmst.quirk is different based upon how
the board ID is read, don't whitelist it in `write_firmware`

2. Allow using `--force` with `fwupdmgr` or `fwupdtool` to override
board ID check.

3. Allow using custom flag `ignore-board-id` to ignore board IDs.
This will be the default for EVB boards and can be used in the event
of a factory mistake as well.

4. Move the EVB board IDs into their own synapticsmst_evb.quirk.
This file will not be installed by default (So EVB boards are only
functional when manually installed).
2018-11-05 09:31:55 -06:00
RyanChang
da4049499e synapticsmst: Remove the content checking of firmware
Keep the length checking and remove content checking because don't want to reveal detail format.
2018-11-05 09:31:55 -06:00
RyanChang
732d641bdc synapticsmst: Access Board ID through memory instead
In firmware images HDCP 2.2 will be enabled by default,so access to flash region will fail.
2018-11-05 09:31:55 -06:00
Mario Limonciello
53b49458b6 dell-dock: Prefer to flash VMM5331 via I2C instead of DP aux
Although this is (currently) slower to flash with, bad behavior
and corner case scenarios such as these don't occur:

* Flickering during enumeration
* Monitor plugged in during enumeration but not during flash
* Heavy DP traffic slowing down update significantly
* Sandboxes without access to `/dev/drm_dp_auxY` unable to flash
* Exercising existing graphics driver bugs leading to system freezes.

Additionally this removes a lot of code in dell_dock that was put
in place specifically to be able to support waking up the MST hub
to try to use DP aux for flashing.

Now DP aux will only be used to flash when fwupd is compiled
without `dell_dock`.
2018-11-01 06:29:10 -05:00
Mario Limonciello
60c4a59dab trivial: dell-dock: Lower MST communication speed to 400 KHz
It was identified that at least one other device on this shared
I2C bus can't operate at the speed.  This means that it may
inadvertently respond to commands intended for another device.
2018-10-22 14:02:44 -05:00
Richard Hughes
0cc1ff5cd7 amt: Set the full device version including the BuildNum 2018-10-18 14:49:25 -05:00
Richard Hughes
74fe343213 Add version format quirks for several Lenovo machines 2018-10-18 19:31:04 +01:00
Richard Hughes
ce712426f8 uefi: Set the quirks on created devices
Ensure the quirk object is set, and then add the GUIDs first so that the
version format can be set from a quirk file.

Additionally, only overwrite the fallback name if the name has not already been
set manually from a quirk.
2018-10-18 19:31:04 +01:00
Mario Limonciello
ce4a1a8ba6 dell_dock: Use correct offset for finding version of MST (Fixes: #804)
The offset that was previously used was dependent upon compiler behavior.
This address is fixed and won't change between versions.
2018-10-18 06:06:07 +01:00
Mario Limonciello
2ef4e09e88 dell-dock: Add missing unlock call for MST via dell_dock plugin
When automatic relock was put in place this caused a problem that
some situations the device won't be in the right state when
calling update.
2018-10-18 06:06:07 +01:00
Richard Hughes
481aa2a923 Port from libappstream-glib to libxmlb
The libxmlb library is much faster to query, and does not require the daemon
to parse the XML metadata at startup. It's a zero-copy mmap design that is more
modern and less clunky.

RSS has reduced from 3Mb (peak 3.61Mb) to 1Mb (peak 1.07Mb) and the startup
time has gone from 280ms to 250ms.
2018-10-17 14:41:13 +01:00
Mario Limonciello
860e99357b dell-dock: If marketing name is invalid don't fail initialization
These are certainly bugs with one of the components, but if the situation
happens in the field the plugin needs to finish initialization to allow
upgrading to a fixed component.

We'll just fall back to the name in the quirk (Dell dock) in this case.
2018-10-14 17:23:38 -05:00
Mario Limonciello
4bd12b376a dell-dock: Correct a situation that error wasn't propagating
This code was from an earlier instance that had special fallbacks
and error_local wasn't removed.
2018-10-14 06:33:04 +01:00
Richard Hughes
c012c81540 dell-dock: Use different debug strings for each device type 2018-10-12 10:34:09 +01:00
Richard Hughes
6abc2b9e0e trivial: Remove some pretty intense debugging that crept in 2018-10-12 09:36:12 +01:00
Richard Hughes
5e84da6bfe dell-dock: Don't use the VLA feature in the new dock
This is a massive co-incidence.
2018-10-12 08:08:33 +01:00
Mario Limonciello
558055c9b7 Add a plugin for an upcoming Dell USB-C dock
This plugin requires infrastructure introduced in fwupd 1.1.3
and can not be backported to earlier versions of fwupd.

It works together with the Synaptics and Thunderbolt plugins to
coordinate the proper flashing procedure for devices in this dock.
2018-10-12 07:58:29 +01:00
Richard Hughes
a3d5712b9f Allow setting the version format from a quirk entry 2018-10-11 07:54:01 +01:00
Richard Hughes
05cbb7245c Don't use AppStream-glib for version helpers
Refactor the imported version format code now we now longer need to stick to
the API mistakes of libappstream-glib.
2018-10-11 07:54:01 +01:00
Richard Hughes
d3d2c2c39f Don't use AppStream-glib for the GUID helpers
Long term we want to wean ourselves away from libappstream-glib.
2018-10-11 07:54:01 +01:00
Mario Limonciello
2dd731b2f0 Update all sub-devices for a composite update
This allows a frontend to call update on an individual device ID which will
cause a CAB file to be downloaded, but then also re-use the same CAB file to
try to process devices with a relationship as part of a transaction.
2018-10-10 11:24:27 -05:00
Mario Limonciello
dc48bec157 uefi: Move the TPM unlocking functionality from the Dell to UEFI plugin
This allows devices that have been registered to be correctly unlocked.
2018-10-10 14:30:49 +01:00
Mario Limonciello
4ba77a4fb9 Run the Dell plugin initialization after the UEFI plugin
This corrects the data->esp_path not being initialized due to UEFI
plugin's coldplug routine not having run yet.
2018-10-10 14:30:49 +01:00
Mario Limonciello
56a4d82203 trivial: Add ESP path into fu_uefi_device_to_string() 2018-10-10 14:30:49 +01:00
Richard Hughes
affc4ffde4 thunderbolt-power: Fix possible linker problem
The linker does not know which public symbol to call if a plugin calls it's own
symbol. Without this change one plugin could call into another plugin with the
wrong GsPluginData set -- which will probably explode in a ball of flames.
2018-10-10 14:29:20 +01:00
Mario Limonciello
55ab100334 trivial: nvme: Allow quirking the NVME write block size 2018-10-02 14:30:02 -05:00
Mario Limonciello
bae478f555 trivial: synapticsmst: clarify some error flows
As seen in the previous commit if ESM update failed some error prefixes
are not useful, clarify them.
2018-09-28 08:39:44 -05:00
Mario Limonciello
7cb2c1092c synapticsmst: Adjust panamera ESM update routine for some reported issues
Reported failure:
"failed to flash firmware: ESM update failed: ESM update failed:
 failed to write data: failed to write"

1) Add a sleep after erasing (matches other SPI write calls)
2) Erase & sleep between retries
2018-09-28 08:39:44 -05:00
Mario Limonciello
680d9dc228 trivial: synapticsmst: downgrade remote control retry statement to debug
This happens often enough and it does recover each time.
2018-09-28 08:39:44 -05:00
Mario Limonciello
845896c954 thunderbolt: Use replugging from the daemon (Closes: #730) 2018-09-26 07:56:12 -05:00
Marek Cernocky
c759834a05 Marked some CL options for translation 2018-09-24 16:18:48 +01:00
Mario Limonciello
6ed307c5fb trivial: uefi: Only set EFI variables on real systems
Avoids copying from a NULL pointer.
Caught via clang static analysis
2018-09-21 07:35:08 +01:00
Mario Limonciello
981ee65554 trivial: wacom: correct some errors caught by static analysis 2018-09-21 07:35:08 +01:00
Mario Limonciello
e58ad0bd77 trivial: dell: Assert true in self tests 2018-09-21 07:35:08 +01:00
Mario Limonciello
6f0a3b4d27 trivial: amt: correct a situation that might overwrite error 2018-09-21 07:35:08 +01:00
Mario Limonciello
2d9107d4dc trivial: amt: correct a potential lack of error 2018-09-21 07:35:08 +01:00
Richard Hughes
19ba35c844 nvme: Initialize the buffer before reading the contents
Fixes a complaint from valgrind.
2018-09-19 18:17:38 +01:00
Mario Limonciello
e6c324229a trivial: thunderbolt: don't reuse GError error_local in update function
It should only be used for the one (optionally) non-critical failure
in valiation failing.
2018-09-18 15:49:59 -05:00
Richard Hughes
e671c05771 trivial: Do not use AsProfile
The profiling data is of limited use, and better data can be obtained using
kcachegrind and massif. Additionally, the profile samples were the cause of the
small RSS growth over time, when in reality the data would only be shown when
the verbose switch is used at daemon startup.
2018-09-18 06:23:25 -05:00
Mario Limonciello
befe196777 trivial: nvme: Remove quirk for Hynix SSD
I've seen a firmware image that the version was "80001C0T" for this
disk and as such this is not a "quad" version number.
2018-09-18 10:40:48 +01:00
Richard Hughes
35a0a456e2 rts54hid: Add support for Realtek USB devices using vendor HID commands 2018-09-14 12:40:20 +01:00
Richard Hughes
161eee23ca rts54hub: Add support for Realtek USB devices using vendor HUB commands 2018-09-12 14:18:55 +01:00
Richard Hughes
ccd3b2a61f uefi: Check the amount of free space on the ESP
Fixes https://github.com/hughsie/fwupd/issues/670
2018-09-12 13:56:02 +01:00
Mario Limonciello
20447a00ae dell: Stop showing errors when no dock plugged in
Since it matches the Realtek dongle, shouldn't show this error:

failed to add USB device 0bda:8153: no dock detected

All the time when that dongle is plugged in
2018-09-11 18:59:05 +01:00
Richard Hughes
b08e7bc7aa trivial: Set a log domain for each file
This allows us to do something like:

G_MESSAGES_DEBUG=FuEngine ./src/fwupd
2018-09-11 18:59:05 +01:00
Richard Hughes
57bf9d9eed superio: Set the physical and logical IDs 2018-09-11 16:02:03 +01:00
Richard Hughes
543e47a5a9 trivial: Use a fixed GUID for superio
It seems the 'Notebook' vendor is padded with spaces in the DMI data, and so
the GUID changes now we're following the same stripping scheme of Windows 10.
2018-09-11 15:21:31 +01:00
Richard Hughes
1e6047e821 unifying: Remove some logically dead code
Found using Coverity, many thanks.
2018-09-10 16:56:44 +01:00
Richard Hughes
c41a89b50c unifying: Add a delay for the Texas chipset
It seems this chip needs a few ms to initialize before you can query the meminfo.
2018-09-10 16:28:49 +01:00
Richard Hughes
7772dcfc91 trivial: Ensure the daemon sends IDLE when firmware is updated 2018-09-10 16:12:12 +01:00
Richard Hughes
7c1eb83a2d unifying: Don't be too verbose when a unifying peripheral is unreachable 2018-09-10 12:20:42 +01:00
Richard Hughes
c249d109d4 trivial: Reduce some debugging verbosity 2018-09-10 12:19:02 +01:00
Richard Hughes
ebae396d0a udev: Do not add devices after a small delay
Now devices can have multiple GUIDs and do not share platform IDs there is
really no point waiting to add the device.

This allows us to remove a whole lot of code for this now-unused functionality.
2018-09-09 16:24:30 +01:00
Richard Hughes
a76f12dbfa trivial: Use fu_udev_device_set_physical_id() in udev plugin 2018-09-09 16:24:30 +01:00
Richard Hughes
1513585d21 trivial: Move the poll setup into common code
This is used by two device types in the unifying plugin, and soon to be one
other new plugin.
2018-09-09 13:43:18 +01:00
Mario Limonciello
4e0bb5d5c9 trivial: uefi: fix a signed vs unsigned issue
This started popping up in Arch CI:
../fwupd/plugins/uefi/fu-uefi-vars.c: In function ‘fu_uefi_vars_get_data’:
../fwupd/plugins/uefi/fu-uefi-vars.c:233:9: error: pointer targets in assignment from ‘gchar *’ {aka ‘char *’} to ‘guint8 *’ {aka ‘unsigned char *’} differ in signedness [-Werror=pointer-sign]
   *data = g_steal_pointer (&data_tmp);
         ^
2018-09-07 23:32:03 -05:00
Richard Hughes
9d3f791727 unifying: Use the new daemon-provided functionality
Until now, the unifying plugin was a 'special snowflake' and did things in very
different ways to the other plugins. Refactor each object to derive from either
FuUsbDevice or FuUdevDevice, and then remove LuDevice and the LuContext layers.
2018-09-07 16:22:38 +01:00
Richard Hughes
c125ec02ed Clarify what the platform ID actually is by renaming it
It wasn't hugely clear what the platform ID was actually meant to represent. In
some cases it was being used like a physical ID, in others it was a logical ID,
and in others it was both. In some cases it was even used as a sysfs path.

Clear up all the confusion by splitting the platform ID into two parts, an
optional *physical* ID to represent the electrical connection, and an optional
*logical* ID to disambiguate composite devices with the same physical ID.

Also create an explicit sysfs_path getter for FuUdevDevice to make this clear.

This allows WAIT_FOR_REPLUG to always work, rather than depending on the order
that the GUIDs were added, and that the kernel would always return the same
sysfs path (which it doesn't have to do, especially for hidraw devices).
2018-09-06 16:22:46 +01:00
Mario Limonciello
b900fe6b4e trivial: move all Dell dock related quirks into dell.quirk
These quirks aren't really needed if compiled without the Dell plugin
since they just set the parentage.
2018-09-05 08:10:52 -05:00
Mario Limonciello
5b9bf049a3 thunderbolt: Allow failing validation checks if device flag set
As an example use case earlier development versions of a Thunderbolt module
may contain DROM corresponding to one model ID and transition to another
model ID. Even if lying about the GUIDs supported by the device via a
quirk the Thunderbolt validation will fail because the device isn't
intended for that system.

This should only be used during development.
2018-09-05 08:03:28 -05:00
Richard Hughes
85f53a418c uefi: Add the Windows 10 device ID for compatibility 2018-09-05 05:59:43 -05:00
Richard Hughes
e39801f00d trivial: Fix some NULL/FALSE confusion 2018-09-04 20:37:17 +01:00
Richard Hughes
4cfe6b7002 nvme: Convert known version formats to semvers 2018-09-04 20:37:17 +01:00
Mario Limonciello
00fbfd7084 nvme: Drop need of --force flag to update
It's been test to flash succesfully on at least one device now.
2018-09-04 18:02:09 +01:00
Richard Hughes
cfc1768bf0 nvme: Always require a reboot after applying firmware
Although we can apply the firmware at runtime, the new firmware isn't going to
be running until the PCIe device has been re-enumerated.
2018-09-04 18:02:09 +01:00
Richard Hughes
2aa3360d46 trivial: Include appstream-glib.h in the main plugin header 2018-09-04 08:22:39 -05:00
Richard Hughes
4adf3bb52c trivial: Remove duplicate header includes 2018-09-04 08:22:39 -05:00
Richard Hughes
ff704414f6 Use superclassed versions of FuDevice when calling udev_added() and usb_added()
The daemon creates a baseclass of either FuUsbDevice or FuUdevDevice when the
devices are added or coldplugged to match the quirk database and to find out
what plugin to run.

This is proxied to plugins, but they are given the GUsbDevice or GUdevDevice and
the FuDevice is just thrown away. Most plugins either use a FuUsbDevice or
superclassed version like FuNvmeDevice and so we re-create the FuDevice, re-probe
the hardware, re-query the quirk database and then return this to the daemon.

In some cases, plugins actually probe the hardware three times (!) by creating
a FuUsbDevice to get the quirks, so that the plugin knows what kind of
superclass to create, which then itself probes the hardware again.

Passing the temporary FuDevice to the plugins means that the simplest ones can
just fu_plugin_device_add() the passed in object, or create a superclass and
incorporate the actual GUsbDevice and all the GUIDs.

This breaks internal plugin API but speeds up startup substantially and deletes
a lot of code.
2018-09-04 08:22:39 -05:00
Mario Limonciello
6cfd3f21f5 synapticsmst: Use fu_plugin_device_removed signal
If another plugin causes a Synaptics MST device to be removed, it
also needs to be removed from the cache to prevent problems when
the device is re-probed.
2018-09-04 10:00:52 +01:00
Mario Limonciello
0235b70463 trivial: synapticsmst: Correct the GUID for the WD15
The WD15 has a slightly different chip than the TB16/TB18 and this was
not transcribed properly.
2018-09-04 10:00:52 +01:00
Mario Limonciello
cc722dbb2c dell: Adjust for changes in daemon around USB removal
1) Switch to daemon provided vfuncs for USB
2) Set quirks so that the plugin only runs when Realtek NIC shows up
3) Rely on the daemon to process all removals by parent tree
2018-09-04 10:00:52 +01:00
Richard Hughes
1263446b23 trivial: Add a 'setup' vfunc that is used after open()
The setup() is the counterpart to probe(), the difference being the former needs
the device open and the latter does not.

This allows objects that derive from FuDevice, and use FuDeviceLocker to use
open() and close() without worrying about the performance implications of
probing the hardware, i.e. open() now simply opens a file or device.
2018-09-03 19:56:26 -05:00
Mario Limonciello
9ef5f741bc plugins: Set platform IDs for non-USB/non-UDEV plugins 2018-09-02 14:45:39 -05:00
Richard Hughes
3a8d532855 Allow the device list to take care of waiting for the device replug
This means that individual plugins do not have to manage thier own GUsbDevice
lifecycle and no longer have to call g_usb_context_wait_for_replug().
2018-08-31 16:41:40 +01:00
Richard Hughes
b1e49e8bdf unifying: Specify the runtime counterpart GUID
This shouldn't have an effect now, but is required when the device list starts
handling the replug, and it seems logically correct.
2018-08-31 09:58:40 +01:00
Richard Hughes
f27f8781cd unifying: Specify the plugin when in unifying mode
A small optimization, which avoids us querying all the USB plugins to find a
match each time.
2018-08-31 09:58:40 +01:00
Richard Hughes
838d91e4ed Add support for counterpart GUIDs
These are GUIDs that are related to the main device, but should not be used for
quirk matching. For instance, we might want to list the GUIDs for a bootloader
mode, but we don't want to import all the quirks for the bootloader when in the
runtime mode.
2018-08-30 16:55:41 +01:00
Richard Hughes
22367e7948 trivial: Refactor out functionality from a mega-method 2018-08-30 16:53:19 +01:00
Richard Hughes
97a3c9651b dfu: Set the quirk keys using the new vfunc 2018-08-29 14:27:57 +01:00
Richard Hughes
83d79e2e12 trivial: Move the DfuDevice class init to the bottom of the file 2018-08-29 14:27:57 +01:00
Mario Limonciello
812ac02bac synapticsmst: Allow using a custom flag 'skip-restart'
This flag is intended for devices that the restart procedure will
be performed as part of a transactional update by an external
controller.

None of the currently supported devices need this flag.
2018-08-29 07:55:27 +01:00
Mario Limonciello
102074eeea synapticsmst: Move GUID generation into quirks
This should allow trivially adding support for new
Tesla/Leaf/Panamera devices by a quirk.
2018-08-28 15:30:21 -05:00
Mario Limonciello
7555738827 synapticsmst: Set parentage for Dell WD15/TB16/TB18 docks through quirks 2018-08-28 18:30:00 +01:00
Mario Limonciello
926da40a88 thunderbolt: Move setting parentage of TB16 into quirks 2018-08-28 18:30:00 +01:00
Richard Hughes
39a5228331 trivial: Optimize adding DFU devices we know about
Explicitly mark known-supported devices in the quirk file so that we don't have
to call fu_plugin_usb_device_added() on all USB plugins.
2018-08-28 18:30:00 +01:00
Richard Hughes
a417d6c82a trivial: Allow setting the firmware min and max sizes from quirk files 2018-08-28 18:30:00 +01:00
Richard Hughes
a62618303f trivial: Set the quirks instance on the unifying context object
This allows us to match quirks on added GUIDs.
2018-08-28 18:30:00 +01:00
Richard Hughes
6dec401a67 Store the DeviceInstanceId as a GUID in the quirk database
This allows us to match non-DeviceID GUIDs, and also GUIDs we don't know how to
generate.

To make this fully useful, search for device quirks when GUIDs are added.
2018-08-28 18:30:00 +01:00
Mario Limonciello
c07ce5b488 thunderbolt-power: Use bolt force power API if available
This is new support for bolt supported by
https://gitlab.freedesktop.org/bolt/bolt/merge_requests/101
2018-08-28 09:47:56 -05:00
Richard Hughes
201d0cce54 trivial: Further simplify the fake DFU runtime logic 2018-08-28 15:33:43 +01:00
Richard Hughes
245b595f45 flashrom: Do not use no-longer-exported symbols
This was compiling and passing CI as the un-implemented legacy functionality
was still exported in the header.

Remove the prototypes for the missing symbols and fix up the plugin.
2018-08-28 15:26:34 +01:00
Richard Hughes
a0d7977968 dfu: Check the device state before assuming a fake runtime
If the device is not in APP_IDLE this doesn't make any sense.
2018-08-28 12:16:30 +01:00
Richard Hughes
04e321274a dfu: Never add a fake DFU runtime when targets already exist 2018-08-28 12:16:26 +01:00
Richard Hughes
73bf2337c1 trivial: Add fu_common_strtoull() as a shared function 2018-08-28 09:41:10 +01:00
Richard Hughes
c16554252b flashrom: Add a plugin for updating using the flashrom command line tool 2018-08-28 09:25:36 +01:00
Richard Hughes
e274f6654b superio: Add support for the W740SU
From Thomas Krug, many thanks.
2018-08-27 09:32:49 +01:00
Richard Hughes
6bf9879189 trivial: Use the BaseboardProduct DMI match for superio
This will match more EC hardware that uses a customized BIOS.
2018-08-27 09:32:05 +01:00
Richard Hughes
cdb01590e0 nvme: Add a new plugin to update NVMe hardware 2018-08-26 19:42:28 +01:00
Richard Hughes
dd5b43f63b udev: Use the new FuUdevDevice abstraction 2018-08-26 19:42:28 +01:00
Richard Hughes
95227a919d trivial: Move gudev to the core plugin deps 2018-08-26 19:38:58 +01:00
Richard Hughes
07ed2f00fa trivial: Use the new subclassed device methods
This just reduces our API surface a little, no behaviour change.
2018-08-24 21:48:59 +01:00
Richard Hughes
16e85aa8cf superio: Add a new plugin to enumerate EC firmware 2018-08-24 20:37:27 +01:00
Richard Hughes
6d794e2de6 trivial: Fix linking when using Ubuntu 18.04
Apparently the linker complains when dlopen'ing a plugin that's linked against
the libfwupdprivate library the daemon is using. This only seems to happen when
using distro packages...
2018-08-23 17:29:31 +01:00
Richard Hughes
29129ed4f4 uefi: Allow upgrades using a self-signed fwupd.efi binary
This doesn't require shim, so for this uncommon case add a configure option.

Fixes https://github.com/hughsie/fwupd/issues/669
2018-08-23 14:30:04 +01:00
Richard Hughes
9d72954cc1 trivial: Fix linking problems with the recent FuChunk move 2018-08-23 09:11:15 +01:00
Mario Limonciello
df60f69814 uefi: Add special handling for /efi (Closes #680)
This is a similar problem to #627 (which was fixed by 9bdbbc5ca).
Add special handling to allow writing to /efi/EFI
2018-08-22 16:43:20 -05:00
Thomas Hindoe Paaboel Andersen
a09f2212ec wacomhid: fix allow trunc flag check
The size check would always short circuit as
FU_WAC_DEVICE_FEATURE_FLAG_ALLOW_TRUNC == 0
is never true. The error message was thus never
written even if a difference was found.

With this patch we check if ALLOW_TRUNC is set in flags
instead, and only write the error if it is not.
2018-08-22 19:53:28 +01:00
Thomas Hindoe Paaboel Andersen
24c6eb758f unifying: remove duplicate && line 2018-08-22 19:53:28 +01:00
Richard Hughes
f22bd6e424 trivial: Move out the byte-array chunking to libfwupdprivate
Five plugins (soon to be 7) are linking to the DFU plugin just for this simple
segment-aware chunking functionality. Move this into common code to make
building simpler.
2018-08-22 15:14:12 +01:00
Richard Hughes
54879c6b9a altos: Use the new FuDevice:probe vfunc 2018-08-22 13:32:29 +01:00
Mario Limonciello
e3f581297f upower: Allow forcing installation even if no AC power is applied 2018-08-21 13:49:38 -05:00
Mario Limonciello
e3b1a3f558 Plumb through support to set FwupdInstallFlags for update_prepare/update_cleanup
This will be used by other future commits.
2018-08-21 13:49:38 -05:00
Richard Hughes
0971192575 trivial: Remove duplicate dependency() for json-glib 2018-08-21 09:43:08 +01:00
Mario Limonciello
25b49b6a6f uefi: Add 'autofs' to supported filesystems (Closes: #660)
systemd-automount will unmount the ESP when not in use for some
people.  This causes automatic ESP detection to fail.

In this case the ESP will need to be added to the conf file and
then this commit will let it keep working.
2018-08-20 07:44:17 -05:00
Mario Limonciello
f19222414c trivial: synapticsmst: Let device finalize close remaining fd 2018-08-13 11:11:27 -05:00
Mario Limonciello
9818692336 synapticsmst: Use FuDeviceLocker for all instances of remote control
This will make sure that remote control requests are always paired with
a close.
2018-08-13 11:11:27 -05:00
Mario Limonciello
8bba1ed2ef synapticsmst: Plumb error handling everywhere return codes are used
This makes the code more consistent, easier to debug and to reuse
in other plugins.
2018-08-13 11:11:27 -05:00
Mario Limonciello
32ac99c6dd trivial: synapticsmst: remove unnecessary includes 2018-08-13 11:11:27 -05:00
Richard Hughes
4721112601 uefi: Don't assert when run as non-root 2018-08-13 11:29:37 +01:00
Richard Hughes
b720df7471 unifying: Do not hold hidraw devices open forever
Just close the file descriptor if open when the device is removed.

Fixes https://github.com/hughsie/fwupd/issues/429
2018-08-13 09:53:22 +01:00
Richard Hughes
f3fc646148 unifying: Allow flashing devices in recovery mode
In version comparison, RQR24.xx_Bxxxx > RQR24.05_B0029 which is not what we
wanted at all.

See https://github.com/hughsie/fwupd/issues/655 for more details.
2018-08-13 08:57:57 +01:00
Mario Limonciello
2c1ed27c6c unifying: Hide raw communication behind the plugin verbose option 2018-08-12 11:00:49 +01:00
Mika Westerberg
511517ad88 thunderbolt: Use fu_plugin_thunderbolt_parse_version () everywhere
Currently we only parse the nvm_version attribute according fwupd
expectations when the device is initially added. Elsewhere we just use
the raw version as is which might be problematic as the version format
can change in the middle (for example "33.02" vs. "33.2"). Fix this so
that fu_plugin_thunderbolt_udev_get_version () always returns parsed
version string.

Update self tests accordingly to have "parsed" version to which we
compare against.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-12 10:58:16 +01:00
Mika Westerberg
0fd763cad4 thunderbolt: Use both locations for multi controller entry validation
Since the multi controller entry is part of the DROM and its place is
not fixed, it is possible (however unlikely) that the locations between
controller and the image are different. One scenario is that the new
image has typo in device or vendor name string fixed which could cause
the offset to be different.

To handle this case properly we need to read multi controller locations
of both controller and image separately, read their values and then
compare them against each other.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-12 10:58:16 +01:00
Mika Westerberg
314a8c76e5 thunderbolt: Add comment explaining return value of read_drom_entry_location ()
During review it was pointed out that the return value of
read_drom_entry_location () should be documented because it also returns
TRUE when an entry was not found from the DROM. Caller needs to look for
the location->offset in that case. Add a comment explaining this.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-12 10:58:16 +01:00
Mika Westerberg
28ac67f98f thunderbolt: Add flash size validation for Alpine Ridge
Alpine Ridge and Alpine Ridge LP also include flash size field so follow
Titan Ridge and validate those as well.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-12 10:58:16 +01:00
Mika Westerberg
1105683700 Revert "thunderbolt: Add more Titan Ridge IDs"
This reverts commit ed7acc7819.

As pointed out by @YehezkelShB during review the Titan Ridge IDs 0x15E8
and 0x15EB are for the NHI (the host controller). Windows SDK tool uses
them to keep track of different controllers but in Linux we don't need
them and can use the already existing bridge IDs.

There is no harm to have them listed but to avoid possible confusion in
future remove them.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-12 10:58:16 +01:00
Mario Limonciello
d4e443e8e2 synapticsmst: Fix alignment issues (Closes: #207) 2018-08-11 08:34:38 +01:00
Richard Hughes
4303ee976a unifying: Set a display name on the bootloader device 2018-08-10 14:50:43 +01:00
Mario Limonciello
7343ed4f33 synapticsmst: Run the plugin on non-dell systems
It generally won't be interesting on most systems, but if a supported
Dell USB device is connected to a non-dell system it can be updated
then.
2018-08-09 15:04:25 -05:00
Richard Hughes
14a8e40966 synapticsmst: Fix const warnings on Centos7 2018-08-09 16:59:04 +01:00
Richard Hughes
68f12ddb44 trivial: Do not define _GNU_SOURCE
It prevents coverity from running with gcc7.
2018-08-09 16:59:04 +01:00
Mario Limonciello
9bdbbc5ca8 uefi: Handle /boot properly (Closes: #627)
/boot is a special cased directory when using ProtectSystem=full

Due to this, it's marked read only even if it's listed in ReadWritePaths.

Allow folks to use this for their ESP, but they need to create /boot/EFI
in advance of starting fwupd.
2018-08-09 09:28:50 -05:00
Richard Hughes
55c424a7be synapticsmst: Add some missing failure handling code
If synapticsmst_common_rc_set_command() fails, return an error.

Found using Coverity.
2018-08-09 15:27:36 +01:00
Richard Hughes
e5e441908f uefi: Fix reporting errors when getting info about efivars
Found using Coverity.
2018-08-09 15:27:36 +01:00
Richard Hughes
c5a392ac8f synapticsmst: Remove some dead code
0x40000/64 has no remainder, and both numbers are defined constants.

Found using Coverity.
2018-08-09 15:27:36 +01:00
Richard Hughes
84960d9ba2 uefi: Fix up some trivial NULL/FALSE confusion 2018-08-09 14:21:23 +01:00
Richard Hughes
d2808801a6 trivial: Ensure all source files include config.h 2018-08-09 14:21:23 +01:00
Andrei Emeltchenko
3d73b1fad5 thunderbolt: Add validation for Titan Ridge devices
Titan Ridge devices may contain multiple controllers so we need to make
sure the supplied NVM image multi controller number matches the
controller in question. This is pretty much same than we had for Alpine
Ridge (X of N) but the difference is that this multi controller
information is found in DROM instead and the location is not fixed.

For this reason we implement a generic DROM entry parser and use it to
dynamically fill in correct location of multi controller entry based on
the controller active firmware.

In addition to that we add a check for the NVM flash size just like we
do for Titan Ridge host.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-09 14:18:55 +01:00
Mika Westerberg
bacb769c90 thunderbolt: Add native mode check for Titan Ridge host
Titan Ridge has same set of bits than Alpine Ridge telling whether the
Thunderbolt controller is in native or legacy mode. Add validation for
that.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-09 14:18:55 +01:00
Andrei Emeltchenko
e2f2b39514 thunderbolt: Add flash memory size validation check for Titan Ridge host
We need to make sure the Thunderbolt controller and the NVM image agree
with the expected flash memory size.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-09 14:18:55 +01:00
Andrei Emeltchenko
ed7acc7819 thunderbolt: Add more Titan Ridge IDs
Add 0x15E8 and 0x15EB Titan Ridge IDs that were previously missed.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-09 14:18:55 +01:00
Mika Westerberg
be616e4fe1 thunderbolt: Add validation for PD (power delivery) pointer
Thunderbolt devices typically have a discrete PD (power delivery)
controller and firmware for that controller is part of the NVM image. To
make sure the supplied NVM image provides the necessary PD firmware we
implement a check that compares existence of both PD pointers and fails
the validation if they differ.

Since the PD pointer is part of ARC_PARAMS section we need to populate
that section offset also for hosts (following DROM section).

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-09 14:18:55 +01:00
Mika Westerberg
dd7e7d97e8 thunderbolt: Increase retry timeout from 20 to 200 ms
At least with Titan Ridge devices 50 * 20 ms is way too short time
reading nvm_version so most of the time the daemon fails to figure out
the version of the just connected device. To make it work better with
Titan Ridge devices increase the timeout to 50 * 200 ms.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-09 14:18:55 +01:00
Mika Westerberg
b9ac0aa179 thunderbolt: Handle -EAGAIN from nvm_version elsewhere as well
There are other places in the plugin where we read nvm_version and it
can return -EAGAIN as well. To make sure it works consistenly accross
the plugin factor reading nvm_version to a helper function and use instead.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2018-08-09 14:18:55 +01:00
Richard Hughes
02c90d8a03 Remove the unused Emacs indenting headers from all source files
Fixes https://github.com/hughsie/fwupd/issues/636
2018-08-09 12:48:04 +01:00
Mario Limonciello
4ab6116ea0 uefi: Fix encoding the GUID into the capsule EFI variable
Before:

$ /usr/lib/fwupd/fwupdate --info
Information for the update status entry 0:
  Information Version: 7
  Firmware GUID: {00000000-0000-0000-0000-000000000000}
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Capsule Flags: 0x00131072x
  Hardware Instance: 0
  Update Status: attempt-update
  Capsule File Path: /EFI/ubuntu/fw/fwupd-7ceaf7a8-0611-4480-9e30-64d8de420c7c.cap

After:

$ /usr/lib/fwupd/fwupdate --info
Information for the update status entry 0:
  Information Version: 7
  Firmware GUID: {7ceaf7a8-0611-4480-9e30-64d8de420c7c}
  Capsule Flags: 0x00131072x
  Hardware Instance: 0
  Update Status: attempt-update
  Capsule File Path: /EFI/ubuntu/fw/fwupd-7ceaf7a8-0611-4480-9e30-64d8de420c7c.cap
2018-08-09 08:14:04 +01:00
Mario Limonciello
fd99902ba8 uefi: Test for read only efivarfs (Closes: #625) 2018-08-09 08:11:40 +01:00
Richard Hughes
03aead9fe7 uefi: Check the filesystem type when checking the ESP 2018-08-08 20:35:04 +01:00
Richard Hughes
99b0b1be04 uefi: Check the user-supplied ESP path
Additionally, if the user specified something invalid, do not autodetect the
ESP but return with a journal error. It seems wrong to ignore what the user
explicitly set and perhaps do something dangerous.

Alternative to https://github.com/hughsie/fwupd/pull/599
2018-08-08 20:35:04 +01:00
Richard Hughes
34ea74fb2c uefi: Don't override _FORTIFY_SOURCE when building the EFI binary
Fixes https://github.com/hughsie/fwupd/issues/631
2018-08-08 20:16:53 +01:00
Mario Limonciello
faa9aaae0b trivial: synapticsmst: whitespace fixes 2018-08-06 00:34:42 -05:00
Mario Limonciello
dc5566a8db synapticsmst: Add support Synaptics Panamera chip
Panamera is a newer MST chip with a different flash layout and
multiple MCU running and accessing SPI/EEPROM simultaneously.

The firmware update process has to be run separately for each
SPI/EEPROM region.

Signed-off-by: Ryan Chang <ryan.chang@synaptics.com>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
2018-08-06 00:34:42 -05:00
Mario Limonciello
9a77f1c7ad synapticsmst: Rework Tesla/Leaf write process
- Split up `synapticsmst_device_write_firmware` to smaller more manageable
  chunks
- Use `FuDeviceLocker` to ensure that device is in a known state after
  update is complete (both in success or failure scenarios)
- Retry the write process up to 10 times in case of DPCD update failures
- Wait for flash clear to settle before writing to EEPROM/SPI
2018-08-06 00:34:42 -05:00
Mario Limonciello
0677d92b03 synapticsmst: If failing to enable remote control, disable and retry
Any previously failed runs or outside tools may adjust the remote
control register leaving the MST controller in a poor state.

If remote control enablement fails, try to disable and then re-enable
before aborting.
2018-08-06 00:34:42 -05:00
Mario Limonciello
2b4013562d synapticsmst: Add a reboot at end of flash cycle
This makes sure the MST hub jumps to the new active firmware after
completion.
2018-08-06 00:34:42 -05:00
Mario Limonciello
801cca6dc3 synapticsmst: remove support for setting dock type from another plugin
As seen by recent testing this is not working every time.
Since e6cda81f we're now building GUIDs that represent all the possibilities
for shared parts so it's not important to set dock type.
2018-08-06 00:34:42 -05:00
Mario Limonciello
d173901e79 synapticsmst: set parent devices for known docks without metadata 2018-08-06 00:34:42 -05:00
Gary Lin
b54f4706cb redfish: Add an option for CA verification
Since the Redfish service may use a self-signed certificate without
specifying the hostname, we could have the problem to verify such
certificate. A new option, CACheck, is introduced so that the user can
decide whether to ignore the CA verification or not.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
986c0ebe77 redfish: Check validity of the json objects
We might get a NULL json object.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
7f79aa9ea7 redfish: Upload the firmware blob through HttpPushUri
Create a multipart request to upload the firmware blob

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
e5154d3ac3 redfish: Assume the device is updatable by default
The "Updateable" field may not be available.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
2e0e179298 redfish: Read options from redfish.conf
This commit adds redfish.conf to configure the IP and username/password
in case those are not available in SMBIOS and the EFI variables.

Since we can configure the IP in the conf file, the environment
variable, FWUPD_REDFISH_URI, is removed.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
27986ebf3e redfish: Generate IDs for redfish devices
Generate IDs for redfish devices and skip the devices without a
proper GUID.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
213bdf0637 redfish: Fetch the inventory collection
All inventory members are in the inventory collection.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
ce8aa4f84a redfish: Always use Basic Auth
Although SoupAuthManager can create a proper SoupAuth from the
WWW-Authenticate header, some redfish implementations didn't provide
such header, and we would get a 401 response in the end.

In DSP0266, it mentions that "HTTP BASIC authentication as defined by
RFC7235 shall be supported", so it shall be safe to use Basic Auth
by default.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
95ee874b2e redfish: Remove the json object of Links
UpdateService is in the root json object, so we don't need the Links
json object.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
701b46bbb2 redfish: Adjust the first redfish path
Change the redfish path from "/redfish/v1" to "/redfish/v1/" so that we
don't have to handle 308 redirect.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
3456238f0a redfish: Detect the HPE DeviceClass
DeviceClass in Oem/Hpe indicates the type of device in the HPE machine.
In case SoftwareId is absent, we can use DeviceClass instead.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
ad594286b2 redfish: Check "Updateable" and "SoftwareId" before using them
Although "Updateable" is defined in SoftwareInventory schema since
redfish v1.0.0, some machines(*) didn't support the field.

"SoftwareId" is defined in SoftwareInventory schema since v1.1.0, so
it probably isn't supported by every redfish machines.

(*) Try "/redfish/v1/UpdateService/FirmwareInventory/1/" with HPE DL380
    Gen 10 in https://ilorestfulapiexplorer.ext.hpe.com/

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Mario Limonciello
7154f63397 trivial: Adjust syntax of varying copyright holders to unify across project 2018-08-05 08:22:23 -05:00
Mario Limonciello
ef6f1d7698 thunderbolt-power: Reset the timer on every TBT add uevent
This should help issues where the TBT controller takes a longer
time to run at cold boot startup.

Refer to https://bugzilla.kernel.org/show_bug.cgi?id=199631 for
more information.
2018-08-04 06:30:52 +01:00
Mario Limonciello
c4afb99620 trivial: thunderbolt: Don't re-use GErrors
In instances that we keep processing (such as warnings) these should
be dedicated error variables.
2018-08-01 06:36:07 +01:00
Mario Limonciello
25d51d1429 thunderbolt: Handle -EAGAIN from the kernel better when reading NVM (Closes #608)
Sometimes during initialization trying to read nvm_version will fail
with -EAGAIN.  In these instances keep trying to read.
2018-08-01 06:36:07 +01:00
Gary Lin
af71145c67 redfish: Fetch the inventory member correctly
In the Members array of FirmwareInventory or SoftwareInventory, each
element of the array only contains the URI to the member. For example:

  "Members":
  [
    {
      "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/1/"
    },
    {
      "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/2/"
    },
    {
      "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/3/"
    }
  ]

We have to get the real member object through the given URI.
2018-07-23 09:19:18 +01:00
Mario Limonciello
e6cda81f8d synapticsmst: Drop the dependency on Dell plugin to populate devices
If the dock information is available then show that in the device name
and restrict the GUIDs created.

If it's not available, then just create GUIDs for all known docks
2018-07-19 11:09:05 -05:00
Mario Limonciello
9fea78eb04 thunderbolt: show ErrorMessage when in safe mode 2018-07-18 16:32:26 -05:00
Mario Limonciello
0e00ed9b13 dell: Show error messages when capsule updates are disabled 2018-07-18 16:32:26 -05:00
Mario Limonciello
d1775bc026 uefi: Populate UpdateError with reasons that the plugin won't run
Previously if missing secure boot binaries, or invalid ESP was created the
plugin would just not load.

Now instead populate UpdateError and remove the updateble flag, but still show
the device in fwupdmgr and fwupdtool.
2018-07-17 14:30:27 +01:00
Mario Limonciello
6c41292bdb trivial: dell: drop blacklist of old systems
The minimum version of libsmbios is now 2.4, so don't include any
code blacklisting running on known failing systems.
2018-07-13 13:04:42 -05:00
Richard Hughes
70c9ab0288 Do not use /usr/bin/env in the shebang line
According to Fedora policy env must not be used as it could be overridden by
values in the PATH.

For details, https://fedoraproject.org/wiki/Packaging:Guidelines#Shebang_lines
2018-07-12 07:08:53 -05:00
Mario Limonciello
e6e2bf9d97 trivial: Allow EFI application path to come from a different root 2018-07-10 14:10:16 -05:00
Mario Limonciello
fd65ddda8a uefi: Rename all intermediary files and UEFI variables to prefix fwupd
fwupdate prefix is used by fwupdate and this will prevent clashes in case
its used instead.
2018-07-10 10:45:39 -05:00
Mario Limonciello
14fad85164 UEFI: Rename UEFI boot entry
1) Drop the path at the end of the title (\fwupdx64.efi)
2) Linux-Firmware-Updater to Linux Firmware Updater

The behavior that required the hacky name has been fixed since shim 10
which is in all the relevant distros now.
3322257e61
2018-07-10 10:45:39 -05:00
Mario Limonciello
44305bbde4 Rename EFI application from fwup<arch>.efi to fwupd<arch>.efi
This will prevent potentially clashing with fwupdate's EFI application
and allow them to remain co-installable.
2018-07-10 10:45:39 -05:00
Gary Lin
aeaf444835 redfish: Amend the retrieval of version
In the redfish emulator, "/redfish/v1" returns "ServiceVersion".
However, in the HPE API explorer(*), it returns "RedfishVersion".
This commit checks both member and print the one that is available.

(*) https://ilorestfulapiexplorer.ext.hpe.com/
2018-07-06 08:48:58 +01:00
Richard Hughes
ba103483fa redfish: Add a plugin that uses the Redfish API
Redfish is an open industry standard specification and schema that helps enable
simple and secure management of modern scalable platform hardware.

This has only ever been tested using an emulator and not on real hardware.
2018-06-29 20:17:45 +01:00
Mario Limonciello
097b5ac996 trivial: colorhug: fix a typo 2018-06-29 11:20:17 -05:00
Richard Hughes
a4c1530a69 thunderbolt: Fix the self tests when using -Db_sanitize=address 2018-06-28 20:55:37 +01:00
Richard Hughes
d6df0040c3 dfu: Fix a potential buffer overflow when applying a patch 2018-06-28 20:55:37 +01:00
Richard Hughes
572b7dbbd6 wacomhid: Fix the name of the self test executable 2018-06-28 19:26:22 +01:00
Richard Hughes
6bc7861c78 thunderbolt: Fix two memory leaks in the self test wrapper 2018-06-28 19:21:49 +01:00
Richard Hughes
f83adbab56 dell: Fix a tiny memory leak in the self test wrapper 2018-06-28 19:08:39 +01:00
Richard Hughes
d3f2878f19 synapticsmst: Fix several small memory leaks during enumeration 2018-06-28 18:16:24 +01:00
Richard Hughes
7ecf0164de uefi: Show the stored capsule filename in fwupdate 2018-06-28 15:51:11 +01:00
Richard Hughes
57df956d7b uefi: Add a libexec tool to mimic the original fwupdate CLI interface 2018-06-28 15:51:11 +01:00
Richard Hughes
04f8f267c5 trivial: Move the guessing of the ESP to common code 2018-06-28 15:51:11 +01:00
Richard Hughes
1ccf35a9e4 dell: Register devices with the uefi plugin rather than using libfwup directly
The device registration allows us to create a 'virtual' device that can accept
capsule updates that is not found in the ESRT.
2018-06-28 15:51:11 +01:00
Richard Hughes
dd23871698 uefi: Do not link against libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
a80f79cb4d uefi: Upload the firmware capsule without using libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
11d62030a3 uefi: Upload the historical result without using libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
b157d6eff9 uefi: Unlock the ESRT without using libfwup
This will be handled by a Dell-specific plugin instead.
2018-06-28 15:51:11 +01:00
Richard Hughes
cff980cfda uefi: Do not get the custom ESP location from libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
fb0e94857f uefi: Upload the UX bitmap without using libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
f3f4ca0320 uefi: Clear the device status without using libfwup 2018-06-28 15:51:11 +01:00
Richard Hughes
5585b00892 uefi: Access /sys/firmware/efi/efivars directly rather than using efivars
This allows us to redirect the functions for our self tests.
2018-06-28 15:51:11 +01:00
Mario Limonciello
cfc22a8b90 uefi: Detect the EFI system partition location at runtime
Check across a list of common EFI system partition locations for a mounted
location before starting fwupd.

This also will cause the plugin to not initialize if the EFI system partition
is not mounted.
2018-06-28 15:51:11 +01:00
Richard Hughes
ca5b4a7c97 uefi: Do not use libfwupdate to get the list of resources 2018-06-28 15:51:11 +01:00
Richard Hughes
ae47a347e0 uefi: Do not enable the plugin if efivars are not available
If the user is using some super-old kernel or broken system we want to return
early with an error rather than try to catch each way this can fail at runtime.
2018-06-28 15:51:11 +01:00
Richard Hughes
af5ec20004 uefi: Get the framebuffer without calling into libfwupdate 2018-06-28 15:51:11 +01:00
Richard Hughes
d7cdf9fb67 uefi: Use FuUefiBgrt from the plugin code 2018-06-28 15:51:11 +01:00
Richard Hughes
b1e0ab98d1 uefi: Import the fwupd.efi sources from the fwupdate project 2018-06-28 15:51:11 +01:00
Richard Hughes
62ba9a6f2f uefi: Check the flashes left before installing firmware 2018-06-28 15:51:11 +01:00
Richard Hughes
83390f6556 uefi: Add functionality to parse the EFI framebuffer size 2018-06-28 15:51:11 +01:00
Richard Hughes
f758e7b73a uefi: Add functionality to parse the BGRT table supported 2018-06-28 15:51:11 +01:00
Richard Hughes
a593447695 uefi: Add functionality to get a bitmap size 2018-06-28 15:51:11 +01:00
Richard Hughes
6b8235660b trivial: Move getting the secure boot status to the common file 2018-06-28 15:51:11 +01:00
Richard Hughes
2b1fcfd662 trivial: Use FuUefiDeviceStatus in preference to the defines from fwupdate 2018-06-28 15:51:11 +01:00
Richard Hughes
25509c01ce trivial: Use FuUefiDeviceKind in preference to the defines from fwupdate 2018-06-28 15:51:11 +01:00
Richard Hughes
0766857407 uefi: Read the ESRT entries from a directory in sysfs 2018-06-28 15:51:11 +01:00
Richard Hughes
bd80edd6be uefi: Add a device superclass to model each ESRT entry 2018-06-28 15:51:11 +01:00
Richard Hughes
1a1d135b13 trivial: Add UTF8 to UCS2 helpers from the fwupdate project 2018-06-28 15:51:11 +01:00
Richard Hughes
87fb9ff447 Change the quirk file structure to be more efficient
This pivots the data storage so that the group is used as the preconditon
and the key name is used as the parameter to change. This allows a more natural
data flow, where a new device needs one new group and a few few keys, rather
than multiple groups, each with one key.

This also allows us to remove the key globbing when matching the version format
which is often a source of confusion.

Whilst changing all the quirk files, change the key prefixes to be more familiar
to Windows users (e.g. Hwid -> Smbios, and FuUsbDevice -> DeviceInstanceId)
who have to use the same IDs in Windows Update.

This also allows us to pre-match the desired plugin, rather than calling the
probe() function on each plugin.
2018-06-28 13:32:30 +01:00
Richard Hughes
51345edf24 trivial: Rename the wacom quirk file
It's not Intuos specific at all.
2018-06-28 12:21:36 +01:00
Richard Hughes
63b173046d trivial: Rename the 'plugin-hints' functionality to 'custom-flags'
They will be used as actual flags in the future.
2018-06-28 12:07:13 +01:00
Richard Hughes
04d6965a14 ebitdo: Do not use bootloader commands after a successful flash and reboot
We need to remove the flag if the quirk is not present.

Fixes the cosmetic-but-scary-looking 'failed to send to device on ep 0x01: USB
error on device 2dc8:9001 : Input/output error'.

Fixes the other half of https://github.com/hughsie/fwupd/issues/565
2018-06-26 14:12:02 +01:00
Richard Hughes
d99190f626 wacomhid: Use the parent device name for sub-modules 2018-06-25 17:12:44 +01:00
Mario Limonciello
2d9bcf463f trivial: uefi: update the comment for _efi_get_variable_exists
The commit was merged in 0b3d29d2d8
which landed in efivar 35.
2018-06-24 06:53:24 +01:00
Richard Hughes
e48351e260 Set the alternate device ID, not the object itself
If the daemon either de-duplicates or replaces the object passed emitted from
device-added then the object set as the alternate may not be the same instance
as the daemon version. This causes weird things to happen.

To make this less fragile, specify the *ID* of the object that should be the
alternate device, which allows the daemon to do clever things, and then assign
the object from the ID as the last step.

Although fixing no bug, this makes implementing future functionality easier.
2018-06-22 13:28:27 +01:00
Richard Hughes
1107fa4c9a dell: Do not rely of the order the devices are added in the self tests
Get the TPM v2.0 and v1.2 devices explictly rather than assuming the non-alt
device is always added first. This has the side effect of making the tests
easier to read and means we can check the dock components more carefully.
2018-06-22 13:28:27 +01:00
Richard Hughes
8a6fdf8e18 dell: Don't crash when the alternate device has not been set
I don't think this is possible, but it's the right thing to do...
2018-06-22 13:28:27 +01:00
Richard Hughes
80b2c237c2 dell: Don't show '(null)' as the product name in the self tests 2018-06-22 13:28:27 +01:00
Richard Hughes
aa1ed47f06 wacomhid: Set the device status when erasing and writing firmware 2018-06-15 13:42:52 +01:00
Richard Hughes
0a7e590e22 wacomhid: Support more tablets
These are untested, but use the same HID protocol for flashing.
2018-06-11 09:04:39 +01:00
Richard Hughes
da08b5a048 colorhug: Remove the bootloader flag when re-booting in runtime mode
This needs to be fixed properly, and will be addressed in a future PR.
2018-06-07 12:10:22 +01:00
Mario Limonciello
dfb87c51c9 trivial: synapticsmst: drop efivar dep 2018-06-04 20:00:07 -05:00
Richard Hughes
872ec1b68f Add an experimental plugin to update some new Wacom tablets 2018-06-04 11:29:29 +01:00
Richard Hughes
0b522aef96 colorhug: Do not require libcolorhug to build
Requiring colord to be built before fwupd makes it hard to build packages.

The HID-based flashing protocol is stable and documented, so there's no need
to use an external library for this now.
2018-06-02 21:43:20 +01:00
Richard Hughes
7a874176ff trivial: Add a FuDevice flag to show the device is in bootloader mode
This is useful to present to the user using the command line, and means each
FuDevice-deriving object does not have to handle this.
2018-05-31 18:50:19 +01:00
Richard Hughes
4be17d1364 Add support for relocating various runtime paths
This allows a snap package to be easily built.

With much help from Mario Limonciello <mario.limonciello@dell.com>, many thanks.
2018-05-31 16:25:22 +01:00
Mario Limonciello
2fd28a374d trivial: uefi: Don't return NULL matching devices
Fixes: 988e73c414
2018-05-30 19:57:13 +01:00
Richard Hughes
c7c53ff03d trivial: Don't build the thunderbolt plugins based on udev presence
GUdev has to exist as a runtime dep, and this check for udev.pc will do nothing
helpful.
2018-05-30 14:12:12 +01:00
Richard Hughes
d8fdcd63b8 trivial: Move the HID defines to a shared location 2018-05-29 20:15:47 +01:00
Richard Hughes
fe221dc13d trivial: Fix up some NULL/FALSE confusion 2018-05-29 09:33:44 +01:00
Richard Hughes
caf379dc00 trivial: Convert FuAltosDevice to use G_DECLARE_FINAL_TYPE 2018-05-29 09:29:15 +01:00
Richard Hughes
9d5aa59ea6 trivial: Convert FuColorHugDevice to use G_DECLARE_FINAL_TYPE 2018-05-29 09:29:03 +01:00
Richard Hughes
4152990537 trivial: Convert FuEbitdoDevice to use G_DECLARE_FINAL_TYPE 2018-05-29 09:20:21 +01:00
Richard Hughes
699e9aa134 trivial: Convert FuRom to use G_DECLARE_FINAL_TYPE 2018-05-29 09:15:55 +01:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Richard Hughes
15aa91bbd1 dfu: Add dfu_element_get_contents_chunk() 2018-05-25 12:10:28 +01:00
Richard Hughes
c5454860d4 dfu: Add dfu_utils_bytes_pad() trivial helper 2018-05-25 12:10:24 +01:00
Richard Hughes
7013c8c963 dfu: Make the SREC parser abort on a duplicate S0 header 2018-05-25 11:40:33 +01:00
Richard Hughes
38d064a7f3 dfu: Fix the SREC parser to correctly parse 32 bit address values 2018-05-25 11:40:12 +01:00
Richard Hughes
849d841ca9 dfu: Add a helper function for loading a DfuImage from a SREC file
Also, add the ability to start from a known device offset.
2018-05-23 21:06:24 +01:00
Richard Hughes
ba4ec1a25f trivial: Add helper function for chunking a GBytes 2018-05-23 20:47:33 +01:00
Richard Hughes
b04a8778e9 trivial: Add helper function for parsing a uint4 buffer 2018-05-23 20:47:26 +01:00
Richard Hughes
988e73c414 uefi: Search all available GUIDs when matching hardware
Using just the default GUID is fragile and might break if the GUIDs get added
in the 'wrong' order or if the GUID list is sorted.

Fixes https://github.com/hughsie/fwupd/issues/518
2018-05-19 23:07:40 +01:00
Mario Limonciello
dff281311c uefi: Set the alternate GUID for parenting later
Several places in the UEFI plugin operate on the default GUID rather
than iterating a list of GUIDs.  This is normally fine since UEFI
GUIDs are tied to the ESRT and normally one FuDevice shouldn't
have multiple GUIDs.

The alternate GUID was added to set parents accordingly but this
caused no CAB files to be able to install.

Fixes: cc664d7d (amt: Put the AMT device as a child under the system UEFI firmware)
2018-05-18 13:55:42 -05:00
Richard Hughes
e183ce2803 trivial: Remove the Unifying noinst tool 2018-05-18 10:26:51 +01:00
Richard Hughes
8658cd1ed2 trivial: Remove the AltOS noinst tool 2018-05-18 10:25:49 +01:00
Richard Hughes
83528ccded trivial: Remove the 8Bitdo noinst tool 2018-05-18 10:25:28 +01:00
Richard Hughes
17cd8bf9c3 trivial: Remove the CSR noinst tool 2018-05-18 10:25:04 +01:00
Richard Hughes
cf22df177f trivial: Remove the synapticsmst noinst tool 2018-05-18 10:24:38 +01:00
Richard Hughes
3e3ac27216 trivial: Add attach() and detach() vfuncs to FuDevice 2018-05-18 10:08:10 +01:00
Richard Hughes
0b8c1e7e92 ebitdo: Move the bootloader fallback instructions 2018-05-14 17:09:23 +01:00
Richard Hughes
c48d0cfa0c trivial: Add a read_firmware() vfunc to FuDevice 2018-05-14 17:07:20 +01:00
Richard Hughes
0a0483b2ce trivial: Add a write_firmware() vfunc to FuDevice 2018-05-14 17:07:20 +01:00
Mario Limonciello
86b3bcf8c9 ebitdo: Stop matching Nintendo Switch Pro VID/PID
Unfortuantely similar to ead5bf392 this is causing problems with
real Nintendo Switch controllers.
2018-05-07 09:22:12 -05:00
Mario Limonciello
1a60231658 trivial: synapticsmst: Recognize boardid 0x103
This board_id will be used in a new device in the future.
The enum and description will be updated later when more details
are ready.
2018-05-03 14:07:42 -05:00
Richard Hughes
185f4a4791 dfu: Allow parsing SREC files without the optional S5 record 2018-05-03 19:58:31 +01:00
Mario Limonciello
e9046e7207 synapticsmst: Set TB16/WD15 appropriately in topology 2018-05-03 08:07:04 +01:00
Mario Limonciello
542b97d19f dell: Set parents for Dell WD15/TB16 docks 2018-05-03 08:07:04 +01:00
Mario Limonciello
4a981d599c dell: Set TPM alternate mode device under regular mode 2018-05-03 08:07:04 +01:00
Richard Hughes
2c86dc0e9a unifying: Set known parent for unifying peripherals 2018-05-03 08:07:04 +01:00
Richard Hughes
cc664d7d36 amt: Put the AMT device as a child under the system UEFI firmware 2018-05-03 08:07:04 +01:00
Mario Limonciello
6e0663ae6c thunderbolt: Set known parent for Thunderbolt devices in Dell TB16 2018-05-03 08:07:04 +01:00
Richard Hughes
db211de617 dfu: Fix a potential DoS by limiting filling holes to 1MiB 2018-05-01 11:35:53 +01:00
Richard Hughes
d7a04f6e86 trivial: Add the generated SREC examples for easy fuzzing 2018-05-01 09:53:10 +01:00
Richard Hughes
7c6b94118c Add support for parsing Motorola S-record files 2018-05-01 09:16:19 +01:00
Richard Hughes
dd10a8f595 trivial: Fix a tiny memory leak when using 'dfu-tool dump' 2018-04-30 11:22:47 +01:00
Mario Limonciello
01b4f05072 uefi: Match the bootdir argument to fill in uefi.conf by default
This will make it more obvious which path it's defaulting to
2018-04-26 15:56:38 +01:00
Mario Limonciello
f669efcc74 amt: Fix a compilation error on Fedora
../plugins/amt/fu-plugin-amt.c: In function ‘mei_context_new’:
../plugins/amt/fu-plugin-amt.c:77:2: error: implicit declaration of function ‘memcpy’ [-Werror=implicit-function-declaration]
  memcpy (&ctx->guid, guid, sizeof(*guid));
  ^~~~~~
../plugins/amt/fu-plugin-amt.c:77:2: error: incompatible implicit declaration of built-in function ‘memcpy’ [-Werror]
../plugins/amt/fu-plugin-amt.c:77:2: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
../plugins/amt/fu-plugin-amt.c:78:2: error: implicit declaration of function ‘memset’ [-Werror=implicit-function-declaration]
  memset (&data, 0, sizeof(data));
  ^~~~~~
../plugins/amt/fu-plugin-amt.c:78:2: error: incompatible implicit declaration of built-in function ‘memset’ [-Werror]
../plugins/amt/fu-plugin-amt.c:78:2: note: include ‘<string.h>’ or provide a declaration of ‘memset’
../plugins/amt/fu-plugin-amt.c: In function ‘mei_recv_msg’:
../plugins/amt/fu-plugin-amt.c:117:9: error: implicit declaration of function ‘strerror’; did you mean ‘g_strerror’? [-Werror=implicit-function-declaration]
     rc, strerror(errno));
         ^~~~~~~~
         g_strerror
../plugins/amt/fu-plugin-amt.c:117:9: error: nested extern declaration of ‘strerror’ [-Werror=nested-externs]
../plugins/amt/fu-plugin-amt.c:116:39: error: format ‘%s’ expects argument of type ‘char *’, but argument 6 has type ‘int’ [-Werror=format=]
         "read failed with status %zd %s",
                                      ~^
                                      %d
     rc, strerror(errno));
         ~~~~~~~~~~~~~~~
../plugins/amt/fu-plugin-amt.c: In function ‘mei_send_msg’:
../plugins/amt/fu-plugin-amt.c:142:40: error: format ‘%s’ expects argument of type ‘char *’, but argument 6 has type ‘int’ [-Werror=format=]
         "write failed with status %zd %s",
                                       ~^
                                       %d
         written, strerror(errno));
                  ~~~~~~~~~~~~~~~
../plugins/amt/fu-plugin-amt.c: In function ‘amt_verify_code_versions’:
../plugins/amt/fu-plugin-amt.c:288:14: error: implicit declaration of function ‘strlen’ [-Werror=implicit-function-declaration]
       len != strlen(code_ver->versions[i].version.string))
              ^~~~~~
../plugins/amt/fu-plugin-amt.c:288:14: error: incompatible implicit declaration of built-in function ‘strlen’ [-Werror]
../plugins/amt/fu-plugin-amt.c:288:14: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
../plugins/amt/fu-plugin-amt.c: In function ‘fu_plugin_amt_create_device’:
../plugins/amt/fu-plugin-amt.c:430:2: error: incompatible implicit declaration of built-in function ‘memcpy’ [-Werror]
  memcpy (&ver, response->data, sizeof(struct amt_code_versions));
  ^~~~~~
../plugins/amt/fu-plugin-amt.c:430:2: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
cc1: all warnings being treated as errors
2018-04-23 10:29:48 -05:00
Mario Limonciello
df860bbf4f Revert "trivial: Compile upower and test plugins with -O0 (Closes: #472)"
This reverts commit 6b0eb07886.

Per debian bug 896012 this is intentional behavior and a problem with
linitin.  An additional commit will be added to ignore this lintian
error.
2018-04-23 10:29:48 -05:00
Richard Hughes
34e0dab1f1 Add fu_plugin_add_compile_version()
This allows plugins to set and explicit build-time version. It also uses the
same AppStream component-ID scheme rather than the home-grown 'FooVersion' key.

Also, use the new runtime and compile-time versions in the report metadata.
Due to the key change we'll also need to update some LVFS rules.
2018-04-20 20:45:08 +01:00
Richard Hughes
b01b4869bb trivial: Use fu_plugin_add_runtime_version() in the Dell plugin 2018-04-20 20:45:08 +01:00
Richard Hughes
0eb123b986 Allow requiring specific versions of libraries for firmware updates
In some cases firmware can only be installed with an up to date GUsb (e.g. with
some STM-DFU hardware) or with a new version of fwupdate (e.g. any UEFI
UpdateCapsule without a capsule header).

We should be able to match against other software versions like we can the
fwupd version, e.g.

    <requires>
      <id compare="ge" version="0.9.2">org.freedesktop.fwupd</id>
      <id compare="ge" version="11">com.redhat.fwupdate</id>
    </requires>

Also, rather than checking each requirement we know about on the component,
check each requirement on the component about things we know. This ensures we
don't allow firmware to be installs that requires for instance fwupdate 22 when
the runtime version is only being added in fwupdate 12 and up.

This means the following is now an error that will fail to allow the firmware
to be installed:

    <requires>
      <firmware>doesnotexist</firmware>
      <some_future_tag>also_unknown</some_future_tag>
    </requires>

Also add a lot of self tests to test the various new failure modes.

Fixes https://github.com/hughsie/fwupd/issues/463
2018-04-20 16:19:05 +01:00
Mario Limonciello
16d72a23ba Update the fwupdate minimum version to 10.
Similar logic as previous commit with versions in Ubuntu and Fedora.
2018-04-20 09:05:17 -05:00
Mario Limonciello
ce2a8231ea Bump appstream-glib minimum version to 0.7.4
Ubuntu's LTS and Fedora's newest releases have it.  All CI targets
have it.
2018-04-20 09:05:17 -05:00
Richard Hughes
e598fc3447 trivial: Show the VID and PID when failing to add a USB device
Fixes https://github.com/hughsie/fwupd/issues/476
2018-04-19 20:15:09 +01:00
Mario Limonciello
6b0eb07886 trivial: Compile upower and test plugins with -O0 (Closes: #472)
This is a workaround for what looks like a compiler bug introduced
in Debian and Ubuntu gcc-7.

After the compiler bug is sorted in Debian testing it should be
reverted.
2018-04-18 20:11:43 +01:00
Mario Limonciello
ed1ac2a74b Enable CentOS 7 for CI
There are a lot of hacks here;
 * Pulling newer libappstream-glib from Fedora
 * Pulling a systemd backport
 * Manually installing pillow and pygobject
 * PKCS7 is turned off (gnutls is too old)
2018-04-18 10:25:22 -05:00
Mario Limonciello
a98df55d82 Disable -Wunused-function on clang builds (Closes #467)
GLib creates two static inline functions for paramaters that may
not be used that set off warnings in clang but not gcc.

Ignore these on clang builds everywhere that
G_DEFINE_AUTOPTR_CLEANUP_FUNC is used.
2018-04-17 10:10:43 +01:00
Mario Limonciello
7877769cad trivial: uefi: Remove an unused variable
Caught by clang:

../plugins/uefi/fu-plugin-uefi.c:311:32:  warning: unused variable 'iter' [-Wunused-variable]
	g_autoptr(fwup_resource_iter) iter = NULL;
2018-04-17 10:10:43 +01:00
Sjoerd Simons
8d38e0eae2 synapticsmst: Fix self test
A test run should really fail if it cannot find the test data, rather
then reporting success (thus masking that it never ran). Fix the test to
find it data (probably broken with the port to meson) and make it fail
if it cannot find its data.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-12 20:31:30 -05:00
Sjoerd Simons
2bc6d0a38a synapticsmst: Improve error reporting
Rather then always assuming open() fails because of permission denied,
generate the GError code from the errno and add the related strerror to
the message. And ofcourse output the error message in debugging rather
then just ignoring it.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-12 20:31:30 -05:00
Mario Limonciello
bf998580b8 thunderbolt-power: don't recoldplug (#457)
If recoldplug is called in the middle of a Thunderbolt firmware update it will
cause the Thunderbolt controller to be in the wrong state and make it appear
that the controller update failed.
2018-04-11 15:44:25 +01:00
Sjoerd Simons
9b0d1d4ca4 synapticsmst: Only enumerate Dell Docks if the type is known
The type of Dell dock gets used in the device GUID, so make that
mandatory for device enumeration to succeed. Only relying on the
synapticsmst plugin to be cold plugged after the dell plugin isn't
enough to ensure this.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-10 15:57:59 -05:00
Sjoerd Simons
6761896b33 synapticsmst: Disable remote control on failure
When hitting a failure during enumerating make sure remote control mode
is disabled again.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-10 15:57:59 -05:00
Sjoerd Simons
9f10cbacaf Set Dell dock metadata
On Dell dock devices set the FU_DEVICE_METADATA_DELL_DOCK_TYPE metadata
field which gets used by the synapticsmst plugin for recognizing dell
dock types.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-10 15:57:59 -05:00
Mario Limonciello
1f10dc2ba7 thunderbolt-power: Prevent a theoretical critical warning on shutdown 2018-04-10 13:50:39 -05:00
Mario Limonciello
0bd8c74cc0 thunderbolt-power: If a timer is still running from coldplug, stop it (#457)
A race condition is hypothesized in the following scenario:

1. User starts up the system and fwupd doesn't start automatically.
2. User manually calls fwupdmgr install blah.cab (or fwupdmgr update really) which uses dbus activation to start fwupd systemd unit.
3. This runs coldplug on thunderbolt plugin, no devices found. Thunderbolt power runs coldplug routine.
  a. This sets forcepower with a timeout to turn off after 20 seconds.
  b. Coldplug exits.
4. update routine starts
  a. Thunderbolt plugin starts flash routine.
  b. Thunderbolt power plugin turns off force power in middle of flash routine.
  c. Issue described happens.
2018-04-10 13:50:39 -05:00
Richard Hughes
612a9c1684 trivial: Use the SSL www-less homepage URL everywhere
Fixes https://github.com/hughsie/fwupd/issues/440
2018-03-14 18:15:17 +00:00
Mario Limonciello
937299d72b uefi: Check that EFI system partition is mounted (Fixes: #436)
If the ESP isn't mounted it's possible that the update may look
succesful on the Linux side, but certain to fail later.
2018-03-14 09:54:04 +00:00
Richard Hughes
d3cc2255e9 Delete any old fwupdate capsules and efivars when launching fwupd
Fixes https://github.com/hughsie/fwupd/issues/431
2018-03-09 13:44:45 +00:00
Richard Hughes
3b6397e08a trivial: Check for the ESRT supported status in setup() 2018-03-09 13:44:45 +00:00
Richard Hughes
54dcd29b3c trivial: Use the new fwup_get_esp_mountpoint() call to log the defined ESP 2018-03-09 13:44:45 +00:00
Richard Hughes
d421da0597 trivial: Set the fwupdate esp mountpoint in setup() 2018-03-09 13:44:45 +00:00
Richard Hughes
afd05b88bd trivial: Load the custom ESP mountpoint from _setup() 2018-03-09 13:44:45 +00:00
Yehezkel Bernat
1ccd5d0bbd thunderbolt: correct handling of unknown devices
For unknown device only vendor and model IDs should be checked

Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
2018-03-09 13:08:56 +00:00
Andrei Emeltchenko
1e1789c7e6 plugins: thunderbolt: Add support for newest chips
Add support for the latest TR Thunderbolt controllers.
2018-03-09 18:53:45 +08:00
Richard Hughes
00a5f2cb30 trivial: Code style fixup 2018-03-02 14:52:42 +00:00
Richard Hughes
ab4c2d13a6 Remove support for RaspberryPi
This was never used, and the foundation want to stick to the existing 'just
download a new file' distribution method.
2018-03-01 18:45:47 +00:00
Mario Limonciello
2d8f2455c9 trivial: amt: Adjust to use [] instead of () in device name
This makes it more friendly to bash completion
2018-03-01 09:27:29 -06:00
Mario Limonciello
963dc4245c
uefi: Allow overriding ESP mount point via conf file (Fixes: #421) (#422)
* uefi: Allow overriding ESP mount point via conf file (Fixes: #421)
2018-02-27 14:26:58 -06:00
Ogier Bouvier
620d973fc2 unifying: fix signature writing and parsing for texas bootloader
Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2018-02-26 11:25:51 +00:00
Richard Hughes
efc5abe74e unifying: Fix a tiny memory leak on daemon unload 2018-02-23 13:08:58 +00:00
Mario Limonciello
02c469052f uefi: Report if UX capsule was supported in the report metadata 2018-02-19 15:06:29 -06:00
Richard Hughes
7b19f7db5b Use a longer timeout when powering back the Thunderbolt device
It seems 2s is not long enough on some hardware. We also get a much better
error message if the device fails to come back online.
2018-02-19 19:02:36 +00:00
Richard Hughes
fbf17e9c85 Allow devices to use the runtime version when in bootloader mode
Some devices like the Nitrokey use a generic DFU bootloader that reports a
version number unrelated to the version number of the runtime. Add a flag so
that we can set the correct version when switching plugins during detach and
attach.
2018-02-16 18:23:07 +00:00
Mario Limonciello
a076c81a07 uefi: Log the efivar library version too into the report 2018-02-13 19:19:11 +00:00
Mario Limonciello
b27639ae9f uefi: Save SecureBoot status into debug log and LVFS report 2018-02-13 09:18:30 -06:00
Richard Hughes
50aea367b7 thunderbolt: Enforce the thunderbolt version is xx.yy
Fixes: https://github.com/hughsie/fwupd/issues/387
2018-02-12 12:48:13 -06:00
Mario Limonciello
2c43d3e6e6 use help2man for dfu-tool too 2018-02-09 17:26:18 +00:00
Mario Limonciello
a31895b316 thunderbolt: Report safe mode and native in success/fail 2018-02-09 14:43:56 +00:00
Richard Hughes
65e44cac96 Always return useful information when calling GetResults()
Previous to having the history database we could only notify about firmware that
as installed using the uefi plugin, as that had a few system-wide API calls to
say 'this update failed' or 'this was the error'.

Now we have the local history database not only can we report more details about
the UEFI update (e.g. the old version number) but we can also offer the same
functionality for all other plugins.

Although this does rework how the data for GetResults() is populated, it does
make the FuEngine object quite a lot less confused.

It also fixes a warning in the fwupd plugin for gnome-software, which was
expecting the FwupdRelease to be populated for the FwupdDevice.
2018-02-07 10:20:19 +00:00