Commit Graph

1843 Commits

Author SHA1 Message Date
Richard Hughes
f0f504c740 trivial: Do not use FuProgressbar in dfu-tool
This is a debug-only command line program, and we don't want plugins to have
access to the animated progressbar header in the future.
2019-11-26 17:15:18 +00:00
Richard Hughes
ed3f6cfd4f synaptics-prometheus: Manually set the bootloader mode when attaching
The fingerprint reader device doesn't actually disconnect and reconnect and
so the FuDevice->setup() vfunc never gets called.
2019-11-26 14:15:11 +00:00
Richard Hughes
aba4a5a2bd trivial: Split out a new helper funtion
Other devices need to use this functionality too.
2019-11-26 14:15:11 +00:00
Richard Hughes
11d10a00e7 Always use the more portable 3-arg form for open() 2019-11-26 14:14:37 +00:00
Richard Hughes
5c508de173 trivial: Allow compiling without <fnmatch.h>
This also allows us to add a Win32 implementation if required in the future.
2019-11-26 13:13:31 +00:00
Richard Hughes
28e8b953d0 Revert "synaptics-rmi: Use the build ID as the version number to match the vendor tool"
This reverts commit 28ab968cbf as Synaptics
deviced that vmajor and vminor would actually be useful.
2019-11-26 08:25:45 +00:00
Richard Hughes
cb59a44f28 synaptics-prometheus: Mirror the _IS_BOOTLOADER from device to config 2019-11-25 18:10:38 -06:00
Richard Hughes
741e1e5323 vli_usbhub: Set the composite parent at construction time 2019-11-25 20:01:33 +00:00
Richard Hughes
0df243ad44 synaptics-prometheus: Set the composite parent at construction time 2019-11-25 20:01:33 +00:00
Richard Hughes
52e15b8fb3 vli-usbhub: Whitelist the PD and I²C devices
On advice from VIA.
2019-11-25 12:36:13 -06:00
Richard Hughes
56ac823af9 Set the protocol per-device not per-plugin
Some plugins have devices with more than one protocol. Logically the protocol
belongs to the device, not the plugin, and in the future we could use this to
further check firmware that's about to be deployed.

This is also not exported into libfwupd (yet?) as it's remains a debug-feature
only -- protocols are not actually required for devices to be added.
2019-11-25 18:01:54 +00:00
Richard Hughes
28ab968cbf synaptics-rmi: Use the build ID as the version number to match the vendor tool 2019-11-25 17:44:25 +00:00
Richard Hughes
1665837e78 Make gudev a compile-time option
This should make it nearly possible to build fwupd on FreeBSD.
2019-11-25 09:29:46 +00:00
Richard Hughes
afdba37644 trivial: Set the offline trigger using an environment variable
This allows us to build a object that does not have a custom FU_OFFLINE_DESTDIR.
2019-11-25 09:29:46 +00:00
Mario Limonciello
6abe21efbd trivial: stop including fu-hash.h as part of fu-plugin-vfuncs.h
Explicitly include it in all "in-tree" plugins.

If headers are exported out of tree we will likely explicitly not
export this header.
2019-11-25 09:29:46 +00:00
Leo
6640b571bf Fix shebangs on scripts 2019-11-24 18:51:56 -06:00
Richard Hughes
668ee21567 trivial: Use prefixes for DATADIR in config.h for portability
DATADIR is an enumerated type in MinGW, and the other names are very generic.
2019-11-24 14:17:38 -06:00
Mario Limonciello
89a9e245f9 trivial: optionrom: remove unneeded includes 2019-11-23 14:34:55 -06:00
Richard Hughes
633445dc10 trivial: Allow compiling without <errno.h> 2019-11-23 17:07:53 +00:00
Richard Hughes
8694dee4e7 trivial: Allow compiling without realpath() 2019-11-23 17:07:53 +00:00
Richard Hughes
01c0badd38 trivial: Allow compiling without getuid() 2019-11-23 17:07:53 +00:00
Mario Limonciello
0f54b54250 trivial: plugins: only build coreboot when option set
The option was set but wasn't being used.
2019-11-22 14:50:15 -06:00
Richard Hughes
18b0a739e2 dell: Use the more portable g_usleep() 2019-11-22 14:23:48 +00:00
Richard Hughes
7eeebae1c7 vli-usbhub: Make erasing less verbose and writing more obvious 2019-11-22 14:07:39 +00:00
Richard Hughes
ae21b15ec1 vli-usbhub: Correctly print the 24-bit USB3 offset 2019-11-22 14:07:39 +00:00
Richard Hughes
ad7c7e5fb3 vli-usbhub: Print the PD firmware offset and size for debugging 2019-11-22 14:07:39 +00:00
Richard Hughes
233868124e vli-usbhub: Open the parent device before attempting to read or write from the child 2019-11-22 14:07:39 +00:00
Richard Hughes
6496f12b37 vli-usbhub: Set the install duration for the PD device 2019-11-22 14:07:39 +00:00
Richard Hughes
24ce9837e9 trivial: Fix a failed error prefix string 2019-11-22 14:07:39 +00:00
Mario Limonciello
8bcaad800e trivial: wacom-raw: Remove embedded from device name
This is already implied by the internal flag.
2019-11-21 13:03:12 -06:00
Mario Limonciello
59970600ad wacom-raw: Correct HWID support
This support was using the wrong commands to add a HWID and thus
never actually functioned.  Furthermore it's purpose is to pull
the PID out of the bootloader to be able to properly identify
the device when in bootloader mode (as in recovery mode).

When in this state, generate the correct instance IDs for both
possible Wacom VID.  We can't tell which Wacom VID we are in
bootloader mode.
2019-11-21 13:03:12 -06:00
Richard Hughes
fdb4c4507b uefi: Just use a uint16_t for BootNext processing
This makes everything simpler, at the expense of not being able to create a
`BootFFFF` entry -- but if we get that far something has already gone very
wrong with the firmware...
2019-11-20 16:24:21 +00:00
Richard Hughes
5772e8451c uefi: Use a simpler entries set algorithm
Although slightly wasteful on memory, allocating 64kb is no big deal, and it
means we can simplify creation and reading a lot.
2019-11-20 16:24:21 +00:00
Richard Hughes
55b2df9df6 vli-usbhub: Add support for writing using I2C passthru 2019-11-20 11:07:23 +00:00
Richard Hughes
9f960c154a vli-usbhub: Support updating PD devices that share the hub flash 2019-11-20 11:07:23 +00:00
Richard Hughes
171f18c1c8 vli-usbhub: Support the PD file format 2019-11-20 11:07:23 +00:00
Mario Limonciello
66fcf55f9a trivial: uefi: correct a NULL pointer dereference
This could happen if the machine doesn't have `/etc/os-release`.
2019-11-18 16:22:01 -06:00
Mario Limonciello
e888b58ccd uefi: fall back to ID_LIKE when the path for ID doesn't exist (Fixes:# 1566)
Some derivative distributions re-use bootloader paths from their
upstream.  When this happens the current logic to look for the `ID`
key in `/etc/os-release` doesn't work properly.

Adjust the logic to:
1) Use `ID`
2) Test the path exists.  If so, use it.
3) If it doesn't use `ID_LIKE`.
4) Test if that path exists, if so use it.
5) If that path doesn't exist, return the key from `ID`
6) The plugin will make this path.
2019-11-18 14:55:04 -06:00
Jan Tojnar
34743c5fab uefi: Make generate_binary.sh more robust
command is a shell builtin unlike which, which might not be available.

While at it, let us also make the variables space-safe.
2019-11-18 18:43:40 +00:00
Richard Hughes
22c124dba4 trivial: Detect the USB version automatically
Unfortunately we can't remove the usb2 and usb3 custom flags as we don't yet
depend on a new enough GUsb version.
2019-11-15 18:59:44 +00:00
Mario Limonciello
e2b8a2797e Skip cleanup after device is done updating if will-disappear is set (Fixes: #1529)
This fixes a regression introduced by 2031ce3bf6
that leads to:
```
USB error on device 2dc8:5750 : No such device (it may have been disconnected) [-4]
```
2019-11-14 08:06:17 -06:00
YiFei Zhu
8b044c6cb3 efi: use a wildcard section copy for final EFI generation
The GNU gold linker uses the section name `.rela.dyn` instead of
`.rela` for containing the relocation information. If this section
is not copied the EFI executable can crash.

Fixes #1530
2019-11-14 09:46:50 +00:00
Aleksander Morgado
705f5b64e3 modem-manager: explicitly use plain version format
The devices managed by this plugin expose version strings that are to
be treated as plain ASCII and compared just as plain ASCII.
2019-11-13 17:41:22 +00:00
Aleksander Morgado
e66e0b7114 modem-manager: add quirks for the Foxconn T77W968 modules 2019-11-13 10:54:29 +00:00
Mario Limonciello
e8ec462e07 trivial: thunderbolt: clarify error message
In an error block that checks for `NULL` sysfs, you will always see
`(null)` in the string.

```
FuPluginThunderbolt  Unable to read generation: failed get id generation for (null)
```
2019-11-11 16:16:51 -06:00
Richard Hughes
d630b5ee66 superio: Never read from port offset zero
At this point, PM1 IOBAD0 is unset, and thus zero...
2019-11-08 17:51:43 +00:00
Richard Hughes
025fc77d7a superio: Fix regression when coldplugging superio devices
Fixes https://github.com/fwupd/fwupd/issues/1546
2019-11-08 17:51:43 +00:00
Mario Limonciello
9b944d8999 trivial: synapticmst: allow missing /proc/modules
If a kernel is compiled without loadable module support this shouldn't
stop synapticsmst plugin from loading, just we can't do an extra safety
check.
2019-11-08 09:52:02 -06:00
Mario Limonciello
5151aa5222 synapticsmst: filter invalid chip IDs
This device was showing up from a LG 38UC99-W USB-C monitor
```
VMM0000:
      Device ID:           d762543f8c20f636e6fff031a000078d3e10c600
      Summary:             Multi-Stream Transport Device
      Current version:     0.00.000
      Vendor:              Synaptics
      GUIDs:               42addef4-40f9-5e89-b925-d564e35ed368 ← MST-(null)-vmm0000-0
                           cf8c03c5-18bf-53c4-971f-4a08f88932b5 ← MST-(null)-0
                           e9427b6a-7389-5461-a592-1da5f8ec99fd ← MST-(null)
      Device Flags:        • Updatable
```
2019-11-08 09:45:39 -06:00
Richard Hughes
2414f24b8a trivial: Provide some defines for common image names 2019-11-08 09:30:09 -06:00
Richard Hughes
c5384e9173 Allow aborting early when using fu_archive_iterate() 2019-11-08 09:30:09 -06:00
Aleksander Morgado
0066195a2c modem-manager: increase re-enumeration delay to 20000ms
The default of 10000ms was a bit too close to the real time seen in
e.g. the DW5821e/eSIM.
2019-11-07 21:34:35 +00:00
Aleksander Morgado
def263e697 modem-manager: add counterpart GUID for the DW5821e/eSIM 2019-11-07 21:34:35 +00:00
Richard Hughes
1e98534e37 trivial: Fix the protocol ID for VLI usbhub devices 2019-11-07 09:37:34 +00:00
Mario Limonciello
330434550c trivial: wacom-raw: add more device IDs for Dell devices 2019-11-07 00:40:22 -06:00
Mario Limonciello
79ac523224 synaptics-rmi: correct an error cleaning up on probe
```
failed to close device: Bad file descriptor
```

fu-udev-device will open a locker automatically now.
However synaptics-rmi closes the file descriptor on it's own with `g_clear_object`.

So destroy the fd in synaptics-rmi.
2019-11-06 08:21:51 -06:00
Richard Hughes
6e55cff444 fastboot: Fix a regression when updating modem firmware
Set `IS_BOOTLOADER` unconditionally when in fastboot mode. This seems logically
what it is; a degraded mode that's able to update firmware without runtime
functionality.

Fixes https://github.com/fwupd/fwupd/issues/1532
2019-11-05 06:04:36 -06:00
Mario Limonciello
d8c8249d16 trivial: conflict with old unifying plugin 2019-11-04 13:35:36 -06:00
Mario Limonciello
5123d4333e Rename unifying plugin to logitech-hidpp (Fixes: #1329) 2019-11-04 13:35:36 -06:00
Richard Hughes
7cb0592f72 trivial: Fix a compile error with older versions of gudev
Just move the G_DEFINE_AUTOPTR_CLEANUP_FUNC to the internal header to avoid
forgetting to define this in each plugin.
2019-11-02 07:47:02 -05:00
Mario Limonciello
15e3137f81 trivial: wacom: add vid/pid for panels in Moffett 2019-11-01 14:23:15 -05:00
Mario Limonciello
6c5e7c1e92 unifying: notify users to replug when using dfu control (Fixes: #1383) 2019-11-01 14:31:03 +00:00
Mario Limonciello
2e06dcd5e3 trivial: 8bitdo: set a transient failure while waiting for user action 2019-11-01 14:31:03 +00:00
Mario Limonciello
8ecb08ec23 trivial: 8bitdo: show the same message for SN30pro and SN30pro+ 2019-11-01 14:31:03 +00:00
Richard Hughes
02792c0ba3 trivial: Fix up some typos from codespell 2019-11-01 14:21:20 +00:00
Richard Hughes
62e7112b4e trivial: Ensure config.h is included in all source files 2019-11-01 13:56:26 +00:00
Richard Hughes
f4998a7636 trivial: Fix up some NULL/FALSE confusion 2019-11-01 13:55:32 +00:00
Richard Hughes
bf00080d3f Move the file descriptor lifecycle into FuUdevDevice
This also means we can provide common 'safe' versions for plugins to use.
This makes a lot of plugins much simpler and we can delete a lot of code.
2019-10-31 09:21:35 -05:00
Richard Hughes
7f1b8e7dce ebitdo: Modernize the plugin to use FuFirmware
This allows us to do three things:

* Fuzz the loader with `fwupdtool firmware-parse`
* Check the firmware *before* the hardware is put into bootloader mode
* Use FuChunk to build the 32 byte payload chunks
2019-10-31 09:21:35 -05:00
Richard Hughes
2ff3cdca06 nitrokey: Use fu_common_dump_raw() when debugging 2019-10-31 09:21:35 -05:00
Mario Limonciello
7e38dffdcb thunderbolt: Create a unique GUID including Thunderbolt controller path
Systems with multiple host controllers will most likely have a different
NVM image for each controller but there is no guarantee that the device_id
within the NVM image varies from one controller to another.

To account for this, build a GUID that contains the last element of the
Thunderbolt controller's udev path.

Sample GUID strings from an XPS 9380 (which only contains one host controller):
```
  Guid:                 0f401ed2-b847-532a-adc8-3193fc737be6 <- TBT-00d408af-native
  Guid:                 420b0596-f5cb-5fd7-8416-c99d48ad8de9 <- TBT-00d408af-native-0000:05:00.0
```

This commit follows the presumption that the kernel will enumerate the controllers
in the same order every time.
2019-10-30 14:19:36 -05:00
Richard Hughes
6bbc4c787b jabra: Move the Jabra-specific detach out into its own plugin
This also lets us remove the call to dfu_device_wait_for_replug() which was
causing a deadlock due to unsafe main context usage. Splitting the code allows
us to use the device list to watch for replug, without adding even more Jabra-
specific plugin code to the DFU plugin.

Looking at this with a 40,000ft view, the Jabra runtime really doesn't have
much in common with DFU and the reason it was originally all lumped together
was that the daemon couldn't "change" plugins between detach and update.

It's unfortunate that we have to include a sleep() in the DFU code after the
DFU probe, but this is specified by Jabra themselves. Attempting to open the
device without waiting reboots the hub back into runtime firmware mode, so we
can't even retry the failing setup action.
2019-10-30 15:09:49 +00:00
Richard Hughes
f04be98153 vli-usbhub: Add support for updating V2 devices 2019-10-30 09:41:32 -05:00
Richard Hughes
51a869a01d Use XMLb to query quirks
During startup we do 1898 persistent allocations to load the quirk files, which
equates to ~90kb of RSS. Use libxmlb to create a mmap'able store we can query
with XPath queries at runtime.
2019-10-30 08:29:58 -05:00
Richard Hughes
480b386512 synaptics-prometheus: Don't add a config-subdevice in bootloader mode
We can't use the IOTA mechanism in bootloader mode, and failing to create the
FuSynapromDevice object means we can't recover the hardware if the flash failed.
2019-10-30 06:44:14 -05:00
Richard Hughes
b9f812750f dfu: Use the VID/PID to identify devices without download capability in runtime
The name is not always going to identify the device.
2019-10-30 10:32:15 +00:00
Mario Limonciello
d2701b12b2 ebitdo: Add SN30Pro+ to recognized quirk list (Fixes: #1503) 2019-10-28 11:31:32 +00:00
Richard Hughes
83e49ddf4a dfu: Add several quirks for Realtek camera hardware 2019-10-28 08:39:47 +00:00
Richard Hughes
d0b821f832 dfu: Always mark devices as UPDATABLE
Some devices don't set the CAN_DOWNLOAD attribute in their runtime descriptor.

Rather than quirk these devices just assume that all DFU devices with a DFU
interface can download in DFU mode. The logic being, why would they expose a
runtime DFU interface if they can't download new firmware in DFU mode...

Devices like the DW1820A that are currently blacklisted because of broken DFU
support will remain blocked with this change.
2019-10-28 08:39:47 +00:00
Mario Limonciello
e7b2ea02b9 uefi: use genpeimg to mark ASLR and DP/NX on EFI binary
If the tool is available at build time use it to this.
2019-10-26 12:59:11 -05:00
Mario Limonciello
7474976481 trivial: solokey: correct a typo 2019-10-25 09:20:41 -05:00
Mario Limonciello
44b9e46d37 uefi: rework ESP path detection and lifecycle
This makes the daemon less destructive at startup, especially if the ESP
is not mounted.

It's stored in 3 different places right now, so move it into one point of truth.

Now the ESP is detected when needed including all point of time safety checks and
dynamically mounted and unmounted if necessary.
2019-10-24 15:22:01 -05:00
Mario Limonciello
9160fd4dd1 trivial: uefi: show more metadata in to_string method 2019-10-24 15:22:01 -05:00
Richard Hughes
679d1c0f9a Add a plugin to update VIA USB hub hardware
Only protocol V1 hardware (VL810~VL813) is currently supported.
2019-10-24 12:52:18 +01:00
Richard Hughes
4b40590460 solokey: Allow parsing firmware with fwupdtool 2019-10-22 18:38:36 +01:00
Richard Hughes
95c98a95b6 Allow fwupdtool to dump details of common firmware formats
To do this, the plugins have to register the GType(s) they are using for
firmware, along with a short 'id' that can be used in CLI scripts.
2019-10-22 12:36:15 -05:00
Mario Limonciello
66dd3a02cb trivial: dell: work around a memory leak caught by address sanitizer
It appears to only happen on non-dell systems trying to look up system
ID through `sysinfo_get_dell_system_id`

Other than CI non-dell systems won't be running this code.
2019-10-18 22:07:49 -05:00
Mario Limonciello
cbbde24e38 ebitdo: if the device has the will disappear flag, don't wait for ack (Fixes: #994)
Some 8bitdo receivers seem to automatically reboot when done writing,
so just stop if we have that flag and notice this behavior.
2019-10-18 14:47:14 -05:00
Mario Limonciello
eb5d7a4659 Add a new plugin for working with eMMC devices (Fixes: #1455) 2019-10-18 14:18:09 -05:00
Mario Limonciello
3d65399626 trivial: coreboot: fix a clang compiler error
```
../plugins/coreboot/fu-plugin-coreboot.c:96:7: error: assigning to 'gchar *' (aka 'char *') from 'const gchar *' (aka 'const char *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]

        name = fu_plugin_coreboot_get_name_for_type (plugin, NULL);

             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../plugins/coreboot/fu-plugin-coreboot.c:98:8: error: assigning to 'gchar *' (aka 'char *') from 'const gchar *' (aka 'const char *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]

                name = fu_plugin_get_dmi_value (plugin, FU_HWIDS_KEY_PRODUCT_NAME);
```
2019-10-18 10:22:21 +01:00
Mario Limonciello
97c1e727c4 Add new device flags indicating update resilience
fwupd clients will ideally use this information as part of a policy to schedule
updates in the background without user interactions on safe devices.
2019-10-17 11:38:46 -05:00
Patrick Rudolph
0b7143da66 plugins: Add coreboot plugin
Detect and parse current coreboot version.
There's no need to depend on libflashrom for now.

An update mechanism isn't implemented as the kernel interface isn't
stable yet and will be implemented in a separate commit.

Tested on coreboot enabled machine.
Example output:
coreboot System Firmware
  DeviceId:             81104bde9db7cb037936659ea727c739f47a5029
  Guid:                 230c8b18-8d9b-53ec-838b-6cfc0383493a <- main-system-firmware
  Guid:                 de6fd40f-4ec9-5c0b-95e1-8fb13d1b030c <- LENOVO&ThinkPad T410&2537VG5
  Guid:                 978b0d18-bfe9-5279-9a9f-68dc247a705f <- LENOVO&ThinkPad T410&LENOVO&2537VG5
  Summary:              Open Source system boot firmware
  Plugin:               coreboot
  Flags:                internal|registered
  Vendor:               LENOVO
  Version:              4.10.991
  VersionFormat:        triplet
  Icon:                 computer
  Created:              2019-10-14

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2019-10-17 18:31:01 +02:00
Richard Hughes
9e4bf87184 dfu: Implement FuDevice->to_string() 2019-10-17 14:06:27 +01:00
Mario Limonciello
dc01c717ed trivial: colorhug: fix a crash that occurs when flashing sometimes
If calling `ch_strerror` with some values returns `NULL` which makes
the `GError` not get populated.

```
0  0x00007f252d64d3bd in fu_colorhug_device_attach (device=0x560d7b5c4520 [FuColorhugDevice], error=0x7ffc57a51040) at ../plugins/colorhug/fu-colorhug-device.c:200
1  0x0000560d7a398279 in fu_device_attach (self=0x560d7b5c4520 [FuColorhugDevice], error=0x7ffc57a51040) at ../src/fu-device.c:1988
2  0x0000560d7a3a4b6c in fu_plugin_device_attach (self=0x560d7b57e160 [FuPlugin], device=0x560d7b5c4520 [FuColorhugDevice], error=0x7ffc57a51040) at ../src/fu-plugin.c:856
3  0x0000560d7a3a553f in fu_plugin_runner_device_generic
   (self=0x560d7b57e160 [FuPlugin], device=0x560d7b5c4520 [FuColorhugDevice], symbol_name=0x560d7a3d4258 "fu_plugin_update_attach", device_func=0x560d7a3a4ac1 <fu_plugin_device_attach>, error=0x7ffc57a51040) at ../src/fu-plugin.c:1049
4  0x0000560d7a3a618d in fu_plugin_runner_update_attach (self=0x560d7b57e160 [FuPlugin], device=0x560d7b5c4520 [FuColorhugDevice], error=0x7ffc57a51040) at ../src/fu-plugin.c:1333
5  0x0000560d7a3bcc33 in fu_engine_update
    (self=0x560d7b4b9830 [FuEngine], device_id=0x560d7b64f200 "d45c9d222f7eeb3987c6a7674478bc6aec127b3f", blob_fw2=0x560d7b62c0d0, flags=FWUPD_INSTALL_FLAG_NONE, error=0x7ffc57a51150)
    at ../src/fu-engine.c:2001

(gdb) print error_local
$1 = (GError_autoptr) 0x0
```
2019-10-16 14:40:38 -05:00
Mario Limonciello
50202f5a89 thunderbolt: some more clarifications when using ICL
Currently ICL shows up like this:
```
├─Unknown Device:
│     Device ID:           d066959bf1b0da600f4fcaab5aa31cab3ff05eee
│     Summary:             Unmatched performance for high-speed I/O
│     Current version:     71.00
│     Update Error:        Missing non-active nvmem
│     Flags:               internal|require-ac|registered
│     GUID:                e72e778e-94f7-5ed2-b560-1c1262ee217c
```

Which isn't very useful to end users.  Instead show the generic name
`Thunderbolt Controller` which matches the behavior change we've made
in UEFI FW and Touchpad FW items too.

```
├─Thunderbolt Controller:
│     Device ID:           d066959bf1b0da600f4fcaab5aa31cab3ff05eee
│     Summary:             Unmatched performance for high-speed I/O
│     Current version:     71.00
│     Update Error:        Missing non-active nvmem
│     Flags:               internal|require-ac|registered
│     GUID:                e72e778e-94f7-5ed2-b560-1c1262ee217c
```

Also, quite the messages about missing vid/did as these won't exist
on ICL either.
2019-10-16 10:35:04 +02:00
Mario Limonciello
8e987c7737 trivial: synaptics-cxaudio: Add Google Pixel buds
I saw a mention that they're actually CX21986 and had some on hand.
They do enumerate:

```
├─Pixel USB-C earbuds:
│     Device ID:           672c087de09848d9e7ee32aa1dea2fbeb8b81e6b
│     Summary:             CX21986 USB audio device
│     Current version:     71.133.20
│     Bootloader Version:  03.01.00.00
│     Vendor:              Google (USB:0x18D1)
│     Install Duration:    3 seconds
│     Flags:               updatable|registered
│     GUIDs:               d76048a5-ca69-5cb8-ac86-d418d70c5f29
│                          98043a29-72c5-549b-ad23-de4e2db20a14
│                          93279fe8-d478-531b-9637-05d026be3c2e
│                          8b71f776-f6d0-549d-9547-42740b24bbbc
```
2019-10-15 15:16:26 -05:00
Richard Hughes
1db25c9f2c Allow a custom FuFirmwareImage->write() in superclassed objects 2019-10-15 08:10:11 -05:00
Richard Hughes
6b72cfa25a dfu: Remove two completely unused helpers 2019-10-15 13:04:09 +01:00
Richard Hughes
8cc41cfa6f dfu: Make DfuFirmware derive from FuFirmware 2019-10-14 15:24:08 -05:00
Richard Hughes
f7862c0085 dfu: Make DfuImage derive from FuFirmwareImage 2019-10-14 15:24:08 -05:00
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