Commit Graph

1104 Commits

Author SHA1 Message Date
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
91353d48bd Stop showing the current release during updates in fwupdmgr
With handling composite CAB files this information isn't relayed to the
frontend on which release is being handled, but was rather guessed.

Avoid showing invalid information in this instance.
2018-10-10 11:24:27 -05:00
Richard Hughes
12c849966d Allow firmware files to depend on versions from other devices
At the moment firmware can declare that it has certain requirements, for
instance the existing firmware version, the bootloader version, or the
vendor ID of the device.

In some situations we actually want to check the firmware version of a
*different* device. Good examples here would be only allowing an EC upgrade if
a specific BIOS update has already been done, or only allowing a wireless
reciever to be updated if the attached wireless devices have been updated first.

To use this, you can do something like:

    <requires>
      <id compare="ge" version="1.1.3">org.freedesktop.fwupd</id>
      <firmware compare="ge" version="0.9.0">guid-of-other-device</firmware>
    </requires>
2018-10-02 06:53:52 -05:00
Mario Limonciello
769d768be9 trivial: fu-engine: downgrade couldn't find new device message to debug
I've found that this message comes up sometimes due to reprobing order
and it shouldn't be considered important enough to generate a warning.
2018-10-02 11:52:28 +01:00
Richard Hughes
58bf3674e9 trivial: Show a critical warning rather than crashing
Found when constructing devices manually in the self tests, it's not possible
to hit this during normal runtime.
2018-10-02 11:03:12 +01:00
Mario Limonciello
70ae1d59ed fu-debug: Redirect all debugging output to stderr instead of stdout
This makes it easier for tools to still remain functional but capture
relevant debugging logs by calling `fwupdtool` with `--verbose 2>log`
2018-09-29 07:55:25 +01:00
Mario Limonciello
559c52ff71 trivial: Update FU_DEVICE_REMOVE_DELAY_USER_REPLUG from 20s to 40s (Fixes: #758)
Sometimes it's difficult to get 8bitdo controllers to turn off, so
give users more time to do it.
2018-09-27 09:22:24 -05:00
Mario Limonciello
9cecbe1d1b fu-engine: Optionally wait for replug before updating a device
Plugins may have marked a device as needing to replug duing a
composite device preparation due to the order devices were plugged
in.
2018-09-27 09:18:31 -05:00
Mario Limonciello
8a45acb806 fu-device-list: Use delayed device removal when removing the tree
If a parent device being removed causes child devices to be removed,
take into account all of the delays for children.
2018-09-27 09:18:31 -05:00
Mario Limonciello
ccd5fd0088 trivial: device-list: Correct a minor logic error
If one of the child devices has gone away, this potentially will
cause the daemon to segfault while accessing it.
2018-09-26 07:56:12 -05:00
Mario Limonciello
7c10696690 Add support for devices to show an estimated flash time (Closes: #765)
This time is provided to frontends to be able to show estimates
before a user would agree to flash the device.
2018-09-26 11:35:59 +01:00
Richard Hughes
34fcc02052 trivial: Fix a tiny memory leak on startup
The property value is a floating reference, and so if we're not using it as a
parameter to g_variant_new() we need to unref it manually.
2018-09-19 18:17:38 +01: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
2d4b7a5826 trivial: fu-util/fu-tool: Move --version into a common shared function
This is mostly for usage with the flatpak so it's easy to tell what
version of the flatpak is installed.
2018-09-14 18:22:38 +01:00
Mario Limonciello
fc139357e1 fu-engine: Don't show devices pending a reboot in GetUpgrades
Fixes part of http://gitlab.gnome.org/GNOME/gnome-software/issues/341
2018-09-13 10:37:29 -05:00
Richard Hughes
37d0943844 Add FuMutex helper to make various parts of the daemon thread-safe 2018-09-12 16:10:38 +01:00
Richard Hughes
5a9a6bd479 trivial: Return reference counted devices from FuDeviceList 2018-09-12 16:10:38 +01:00
Mario Limonciello
fde4773294 fu-tool: Import debugging options from fu-debug like fu-main 2018-09-11 18:59:05 +01:00
Mario Limonciello
e6d2cf4dda trivial: Skip debugging messages for skipped releases
These are less interesting than which releases actually get added.
2018-09-11 18:59:05 +01:00
Richard Hughes
36a2bd06ec trivial: Allow specifying --daemon-verbose to set the log handler 2018-09-11 18:59:05 +01:00
Richard Hughes
a1e82d3448 trivial: Add the components to the daemon store in one operation
This removes hundreds of lines of debugging spew.
2018-09-11 18:59:05 +01:00
Richard Hughes
17558acb35 trivial: Only show the number of loaded components at startup 2018-09-11 18:59:05 +01:00
Richard Hughes
90f5070c0f trivial: Remove overzealous debugging 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
beb47a8a1f trivial: Remove an assert statement from the daemon
Asserts mean crashes, and crashes mean reported bugs. In this case the cause is
an older daemon loading plugins using newer features than it knew how to handle.
2018-09-11 18:42:38 +01:00
Richard Hughes
83cce1bdfa trivial: Fix a NULL/FALSE confusion 2018-09-10 16:42:30 +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
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
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
Richard Hughes
841c1807e1 trivial: Copy the parent if set for the repluged device
Based on a patch from Mario Limonciello, many thanks.
2018-09-07 15:32:32 +01:00
Mario Limonciello
b6fa47381e trivial: Refresh the list of devices sent to composite_cleanup()
If one of the devices went into replug during update the FuDevice instance will
have changed.
2018-09-07 15:16:14 +01:00
Mario Limonciello
e1c5cd8637 trivial: Look at both logical and physical IDs for replug matching
This resolves erroneously matching a logical child to it's parent if the child
is in replug.
2018-09-07 15:09:37 +01:00
Richard Hughes
bd747ded4f trivial: Use an elipsis when showing the remaining time 2018-09-07 14:29:18 +01:00
Richard Hughes
ed0512269a trivial: Support HID_PHYS in fu_udev_device_set_physical_id() 2018-09-07 14:28:52 +01:00
Mario Limonciello
0307a0a843 trivial: fu-device: don't show messages with (null) for device ID
device ID might not yet be initialized, so just show the word
"unknown"
2018-09-07 09:13:14 +01:00
Mario Limonciello
e3016602f8 Include serial number in daemon device output when trusted
This moves the storing of the serial number into the daemon and
when the calling process is UID 0 includes it in device output
2018-09-06 13:34:28 -05:00
Richard Hughes
405baebbf2 trivial: Don't allow plugins to call fu_udev_device_emit_changed() 2018-09-06 16:22:46 +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
Richard Hughes
b5024e33a3 trivial: Do not overwrite device values set from quirk files 2018-09-06 12:50:51 +01:00
Richard Hughes
037ce37fe6 trivial: Add some error prefixes to help debug a replug issue 2018-09-06 09:24:23 +01:00
Richard Hughes
2a679cd3b5 trivial: Open the device in fwupdtool before attaching and detaching 2018-09-05 15:32:38 +01:00
Mario Limonciello
da0e90f263 fu-install-task: Allow using --force to ignore version_lowest (Closes #701) 2018-09-05 08:03:28 -05:00
Richard Hughes
afa5ee75ec trivial: Run FuDevice:probe() when adding children
Probe does not require the device to be open and can be used automatically.
2018-09-05 13:32:26 +01:00
Mario Limonciello
14c823e967 trivial: fu-install-task: Correct error message ordering (#701) 2018-09-05 10:26:28 +01:00
Mario Limonciello
b172fb8f63 fu-device: Add platform ID after creating GUID for children
This fixes issues where the child gets the same ID as the parent.
2018-09-04 21:43:50 +01:00
Richard Hughes
e39801f00d trivial: Fix some NULL/FALSE confusion 2018-09-04 20:37:17 +01:00
Mario Limonciello
b4e4b0bdbd trivial: fu-usb-device: s/FU_IS_UDEV_DEVICE/FU_IS_USB_DEVICE/
Probably just a copy and paste error
2018-09-04 12:53:47 -05:00
Richard Hughes
8ddc864764 trivial: Do not set a vendor ID if the vendor is unknown 2018-09-04 18:02:09 +01:00
Richard Hughes
e1c519299b Fall back to the udev parent if the vendor is unknown
This lets us get the correct vendor for NVMe devices.
2018-09-04 18:02:09 +01:00
Richard Hughes
2c0635ae55 trivial: Fix up some more gtk-doc issues 2018-09-04 14:52:46 +01:00
Richard Hughes
127248560b trivial: Modernize FuPlugin to use 'self' as the instance name 2018-09-04 08:22:39 -05:00
Richard Hughes
8878f1094e trivial: Modernize FuDevice to use 'self' as the instance name 2018-09-04 08:22:39 -05:00
Richard Hughes
828c039c00 trivial: Fix up some gtk-doc warnings 2018-09-04 08:22:39 -05: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
Richard Hughes
62867f1f4e trivial: Add fu_usb_device_get_{v|p}id 2018-09-04 08:22:39 -05:00
Richard Hughes
90479d54c8 trivial: Add a FuDevice:incorporate() vfunc
This allows classes that inherit from FuDevice to copy across private data.
2018-09-04 08:22:39 -05:00
Mario Limonciello
3588cd0e06 Copy over parent GUIDs from other plugin donors
The proxy registration was losing this detail so Dell docks were not
setting this properly for child devices.
2018-09-04 10:00:52 +01:00
Mario Limonciello
e260ead594 Notify all plugins of device removals through a new vfunc 2018-09-04 10:00:52 +01:00
Mario Limonciello
64c905b1f3 Remove children of devices when the parent is removed 2018-09-04 10:00:52 +01:00
Richard Hughes
13c9ffc322 trivial: Provide a FuUdevDevice:probe()
Objects deriving from FuUdevDevice() like FuNvmeDevice typically want to do
FuDevice->FuUdevDevice->FuNvmeDevice rather than FuDevice->FuNvmeDevice.

This matches what FuUsbDevice does.
2018-09-03 19:56:26 -05: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
Richard Hughes
5a86d4792d trivial: Parse the vendor and model from hidraw devices 2018-09-03 19:56:26 -05:00
Richard Hughes
3f3aba2530 trivial: Do not call probe() for every open()+close() cycle
Probe is supposed to be used to check things like the VID and PID, and to
optionally add extra GUIDs to the device. Crucially, it doesn't require open()
to operate, and so it's wrong to reprobe() on calling close().
2018-09-03 19:56:26 -05:00
Richard Hughes
8f0695c762 trivial: Allow setting the VendorID from a quirk 2018-09-03 07:18:36 -05:00
Mario Limonciello
325d5a8f07 fu-device-list: Don't match NULL platform IDs together
This caused errors of mismatching devices that didn't have platform
ID's set.

Example:
18:40:24:0555 Fu  ignoring device 370e10407b1f04ade798a9f1d3e1fa57c67750c3 [uefi] existing device 088df415cdee883ec89563e41e6d495924250174 [amt] already exists

Fixes: 3a8d5328 ("Allow the device list to take care of waiting for the device replug")
2018-09-02 14:45:39 -05:00
Mario Limonciello
4631bd7f21 trivial: fu-device: Downgrade warnings about overwiting same name to debug
Commit 0f72ef2f88 causes probe to be re-run on FuDevices.
Any devices derived from FuUsbDevice that set the "Name" key will have the
quirks re-evaluated when GUIDs are added again leading to warnings like this:

```
(fwupdtool:8259): Fu-WARNING **: 23:04:43.144: device 970e85c8400ed95ec5c02b86e52a0ca4ce6fc051 overwriting same name value: Dell USB hub
```
2018-09-01 08:33:08 -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
457888e418 Always use the same HardwareIDs as Windows
ComputerHardwareIds.exe seems to strip any trailing whitespace before building
the UTF-16 string for hashing. If a SMBIOS blob contains strings with trailing
whitespace then until now the 'fwupdmgr hwids' output would show different
HwIds than when running Windows on the same hardware -- which confuses everyone.

Although this may change the HwIds from 1.1.1 to 1.1.2 on some hardware, I'd
argue it's more important to match the Windows Hardware IDs rather than have
a 'similar, but not the same' implementation.

This affects the Lenovo X380 Yoga, although may also affect other machines.
2018-08-31 16:39:09 +01:00
Richard Hughes
a574a75b61 trivial: Add fu_common_strstrip() for future use 2018-08-31 16:39:09 +01:00
Richard Hughes
1d894f13cc trivial: Move the hwids debug functionality to fwupdtool 2018-08-31 16:39:09 +01:00
Richard Hughes
c440da9494 trivial: Allow running 'fwupdmgr hwids' with an optional DMI file 2018-08-31 16:39:09 +01:00
Richard Hughes
5b281e6f5e trivial: Make the 'Computer Information' match ComputerHardwareIds.exe
The BIOS release is specified in base 16, but seemingly displayed in base 10.
It's hashed with the former, so no HwIds need to change.
2018-08-31 16:39:09 +01:00
Richard Hughes
effcc7a7a7 trivial: Fix regression when enumerating udev subsystems 2018-08-31 14:34:01 +01:00
Richard Hughes
c0c6712fcc trivial: Display a more natural string for the time remaining
We can't pretend we're accurate to 10m in the precision of the float when we're
doing things like USB re-enumeration which can take several seconds. I believe
users want some indication of 'should I wait or go do something else' rather
than any precise timings.
2018-08-31 12:04:58 +01:00
Richard Hughes
3d178befb1 Download firmware if the user specifies a URI 2018-08-31 06:07:46 +01:00
Richard Hughes
798cb062bf trivial: Refactor out functionality to get a user cachedir filename 2018-08-30 17:29:52 +01:00
Richard Hughes
fd406616f7 trivial: Create fu_device_list_replace() for future re-use 2018-08-30 16:58:01 +01:00
Richard Hughes
0f72ef2f88 trivial: Invalidate the probe if the FuDevice is closed
For DFU it is important to re-get the interfaces and list of quirks when
switching from runtime -> bootloader -> runtime.
2018-08-30 16:55:41 +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
50d6bd10bd trivial: Add refcounting to fu_device_open() 2018-08-29 19:12:29 +01:00
Richard Hughes
23170a8195 trivial: Set the plugin name when the GUID is added 2018-08-29 14:27:57 +01:00
Richard Hughes
168a209a14 trivial: Add a vfunc for setting the quirk KVs in derived objects 2018-08-29 14:27:57 +01:00
Richard Hughes
163947bd5f Improve performance when reading keys from the quirk database
Rather than guessing the keys that might be present, and doing two hash lookups
for each, get the key values in one call. This is somewhat more performant, and
allows us to do clever things in the future.
2018-08-29 14:27:57 +01:00
Richard Hughes
143f656b69 Split the quirks query into a two-stage lookup
At the moment quirks are hashed with a key based on the group appended with the
key, which is sometimes made into a GUID. This is suboptimal as when a device
has many different quirk keys (e.g. Name, Summary and Flags) as we hash and
store the same key prefix each time.

Instead, use a 1st level hash to map the group (typically the GUID) to another
hash table. Then use the 2nd level hash to get the value using the key.

This does increase the query time slightly, although reduces RSS considerably --
although not by as much as you'd think as creating a GHashTable with one entry
is more RSS than just storing the string.

This representation does have one huge benefit: You can now get all the keys
of quirk entry without having to guess what they might be. This lets us do some
more efficiency gains with follow up patches.
2018-08-29 14:27:57 +01:00
Salud Lemus
980f2d9551 fu-engine: Don't fail get-details if compiled without GPG/PKCS7
Similar to commit 7d35278 regarding the install option with a daemon compiled without
GPG, but now, if you also have a daemon compiled without GPG, and if you have downloaded a
CAB file from LVFS and ran get-details, it would fail to display the contents
of the associated CAB file.

This allows it to still display the contents of the CAB file, and
a warning will be displayed in the logs.
2018-08-29 10:27:40 +01:00
Richard Hughes
4937ff5499 trivial: Add a self test to test the quirk database performance 2018-08-28 20:47:09 +01:00
Richard Hughes
570f839483 trivial: Fix a tiny memory leak in the self tests 2018-08-28 20:40:50 +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
bda4d81d3d trivial: Allow plugins to add virtual children from quirk files
The example here would be adding virtual i2c devices attached to an existing
USB hub device.
2018-08-28 18:30:00 +01:00
Richard Hughes
96fa7d9f49 trivial: Allow devices to set the parent GUID from a quirk entry 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
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
c1163ba10d trivial: Fix up the quirk documentation now we use DeviceInstanceId 2018-08-28 15:19:31 +01:00
Richard Hughes
73bf2337c1 trivial: Add fu_common_strtoull() as a shared function 2018-08-28 09:41:10 +01:00
Richard Hughes
e0fef5d1c4 trivial: Fix a potential invalid read when merging quirks 2018-08-28 09:13:41 +01:00
Richard Hughes
9d6e0e743b Move the GUdevClient to the core daemon
Allowing plugins to 'register' for different udev subsystems in _init() allows
us to move the client to the engine, reducing the number of wakeups considerably
for each device event. It also will reduce the amount of boilerplate code in
each plugin that uses GUdev, much like we have done for GUsb.
2018-08-26 19:42:28 +01:00
Richard Hughes
dba160be42 trivial: Allow getting the quirks of a FuUdevDevice 2018-08-26 19:42:28 +01:00
Richard Hughes
0216d83b71 Add FuUdevDevice as a derivable helper object
There are currently three plugins that use GUdev rather than libusb, and there
are several more in the works. Add a helper object so we can make the plugins
smaller and simpler, much like we already do with FuUsbDevice.
2018-08-26 19:42:28 +01:00
Richard Hughes
bb764e99a0 trivial: Add fu_device_list_get_by_platform_id() 2018-08-26 19:38:58 +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
b37d54e22d trivial: Link in FuChunk when using fwupdtool 2018-08-24 21:39:15 +01:00
Richard Hughes
98f6757fbb trivial: Add an example key for a USB device 2018-08-24 20:22:05 +01:00
Richard Hughes
1bf7ff9966 trivial: Fix a debugging typo 2018-08-24 20:21:51 +01:00
Mario Limonciello
7d35278cb6 fu-install-task: Don't fail update installation if compiled without GPG/PKCS7
Currently if you download a CAB file from LVFS and try to install it
on a daemon compiled without GPG it will fail to install since LVFS has signed
it.  You had to make an intentional decision to disable GPG.

Allow this scenario to work just as if the CAB file were unsigned, but save
a warning in the logs that it happened.
2018-08-24 19:11:00 +01:00
Richard Hughes
ddb3e20d29 trivial: Fix a few new FALSE/NULL confusions 2018-08-23 11:30:18 +01:00
Richard Hughes
8fe7cddc74 trivial: Add helper function for getting an integer quirk value 2018-08-23 10:09:45 +01:00
Richard Hughes
2d9ba8d1a3 trivial: Don't include the default GUID in the device ID if NULL 2018-08-23 09:47:28 +01:00
Richard Hughes
9d72954cc1 trivial: Fix linking problems with the recent FuChunk move 2018-08-23 09:11:15 +01:00
Mario Limonciello
a913bcd271 fixups 2018-08-22 14:46:11 -05:00
Mario Limonciello
09774dd90b fu-progressbar: Show a time estimate after update has started 2018-08-22 14:46:11 -05: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
61eb20d194 trivial: Fix a gtk-doc typo 2018-08-22 14:03:23 +01:00
Richard Hughes
c0fe556350 Add more common vfuncs to FuDevice
This allows us to abstract out common code for plugins not using FuUsbDevice.
2018-08-22 13:32:29 +01: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
898fc80fde Allow updating just one specific device from the command line 2018-08-21 12:21:50 +01:00
Mario Limonciello
f00ca2a8e0 fu-util: When processing "install" command don't try to show current_release
The frontend was never notified of the release (and didn't parse the CAB) so
it doesn't know at this time what the version of the release is and
so this shows a NULL assertion at the time.
2018-08-21 10:06:27 +01:00
Mario Limonciello
cc50e1ab5b fu-tool: Fix a segfault caused by cleanup of USB plugins
This is the same problem that happened with 3f9a1c182a.
The USB plugins got closed but left a dangling reference to a device.
2018-08-15 06:33:37 +01:00
Mario Limonciello
37b5958d4a firmware-builder: Make running more resilient
Test whether CONFIG_USER_NS and related knobs are set.
* Fail daemon execution if not
* Skip self tests if not.

Detect ENOTTY errno set by process spawn.
Skip self tests if set.

Fixes FTBFS on Debian pbuilder and unprivileged docker.
2018-08-14 08:18:49 -05:00
Mario Limonciello
f78f66d479 trivial: Also show device title for 'install' command in fwupdmgr
Commit 171ec0d added support for 'update' and 'downgrade' operations
in fwupdmgr.  Since users can also install CAB files manually
show the titles for those too.
2018-08-13 10:03:49 +01:00
Mario Limonciello
e10cb70395 trivial: Remove now-unnecessary device-changed callback
In verbose mode this actually makes the progressbar not work as
well and is not needed since the device changed does come with the
progress bar.
2018-08-13 09:58:45 +01:00
Mario Limonciello
9eb66fe274 Show composite update titles in fu-tool too
Commit 171ec0dd95 added this information for 'update' and 'downgrade'
operations in fwupdmgr but forgot to add for the 'install' and 'install-blob'
operations of fwupdtool
2018-08-13 09:58:34 +01:00
Richard Hughes
128c0160b3 Only add new device children
This prevents horrible things happening when different plugins provide the
parent and child, and the child gets added before the parent.

Alternative to https://github.com/hughsie/fwupd/pull/645
2018-08-10 09:21:06 -05:00
Mario Limonciello
6463f311b8 fu-engine: emit signals when initializing
Some devices take a long time to initialize and tools like fu-tool
have no feedback during this time.

Show a status message to indicate what's going on.
2018-08-10 14:52:55 +01:00
Richard Hughes
171ec0dd95 Show the correct title when updating multiple devices with one file
Multiple devices can be updated from one cabinet archive, and it would be quite
confusing just to print the first device title and then have the progressbar go
from 0..100 multiple times.

Use the existing device-changed signal to set the 'current device' and print a
new header if the device changes during the install phase.
2018-08-10 14:50:43 +01:00
Richard Hughes
cc2b6fd2be trivial: Allow changing the progressbar title at runtime 2018-08-10 14:50:43 +01:00
Richard Hughes
ec85ebc760 trivial: Emit device-changed when the device status or percentage changes 2018-08-10 14:50:43 +01:00
Mario Limonciello
59cd4706f0 trivial: fu-engine: downgrade "Using Plugins %s" to debug
This isn't useful for most people and just takes up space in the logs.
When there is a problem it's typically specifically with a plugin
and at that time we ask them to run the daemon with verbose anyway.
2018-08-09 13:47:35 -05:00
Richard Hughes
68f12ddb44 trivial: Do not define _GNU_SOURCE
It prevents coverity from running with gcc7.
2018-08-09 16:59:04 +01:00
Richard Hughes
02c90d8a03 Remove the unused Emacs indenting headers from all source files
Fixes https://github.com/hughsie/fwupd/issues/636
2018-08-09 12:48:04 +01:00
Richard Hughes
69a5f3587b trivial: Allow plugins to get the list of HWIDs 2018-08-08 14:44:47 +01:00
Richard Hughes
81c427ca6d Allow different plugins to add the same device
In this instance, we define the 'same device' to be a FuDevice that has at
least one matching GUID. We allow the plugins to define which one is 'better'
than other plugins, and use this to only have one FuDevice for the physical
device.

Alternative to https://github.com/hughsie/fwupd/pull/604
2018-08-06 21:58:28 -05:00
Mario Limonciello
ece90a4879 trivial: fu-util/fu-tool: Output a new line between devices for get-details
With composite CAB files it's difficult to see between devices when packed:
  Homepage:             http://support.dell.com/
  Vendor:               Dell Inc.
  TrustFlags:           none
Unknown Device
  Guid:                 558d18fa-5530-5fc8-9e4b-de3ee8a5eca7
  Homepage:             http://support.dell.com/
  Vendor:               Dell Inc.
  TrustFlags:           none
Unknown Device
2018-08-06 11:05:52 +01:00
Richard Hughes
881f624eba trivial: Fix getting details about firmware for unknown devices
Fix a logic error when testing requirements; what was supposed to happen was
that a the firmware requirements were only processed when we had a FuDevice set
in the FuInstallTask, but instead we were falling through to the handler for
'unknown requirement type'.
2018-08-06 11:03:08 +01:00
Richard Hughes
38c7c334f4 trivial: Remove duplicate requirement checks
The fu_engine_check_requirements() tests are already called from
fu_engine_get_result_from_app() using a NULL device.
2018-08-06 10:59:13 +01:00
Mario Limonciello
4afe7fb742 fu-engine: Add a timer for device update wrapping blob installation
This makes it a lot easier to benchmark performance relative to
other implementations, systems and buses.
2018-08-06 00:34:42 -05:00
Mario Limonciello
801cca6dc3 synapticsmst: remove support for setting dock type from another plugin
As seen by recent testing this is not working every time.
Since e6cda81f we're now building GUIDs that represent all the possibilities
for shared parts so it's not important to set dock type.
2018-08-06 00:34:42 -05:00
Richard Hughes
a6b1d8d19c Don't potentially expose user passwords for remotes
Inspired by a patch by Mario Limonciello, many thanks.
2018-08-06 06:21:29 +01:00
Mario Limonciello
7154f63397 trivial: Adjust syntax of varying copyright holders to unify across project 2018-08-05 08:22:23 -05:00
Richard Hughes
2d37c3f64b trivial: Add a virtual provide of com.redhat.fwupdate
Some firmware depends on this component, which we absorbed in the last release.

See also: https://github.com/hughsie/fwupd/issues/614
2018-08-04 19:06:03 +01:00
Mario Limonciello
e6cc71bea1 fu-hwids: Fix a segfault in smbios data processing caught by fuzzing
Reported-by: Lionel Debroux <lionel_debroux@yahoo.fr>
2018-08-04 06:31:51 +01:00
Mario Limonciello
d1775bc026 uefi: Populate UpdateError with reasons that the plugin won't run
Previously if missing secure boot binaries, or invalid ESP was created the
plugin would just not load.

Now instead populate UpdateError and remove the updateble flag, but still show
the device in fwupdmgr and fwupdtool.
2018-07-17 14:30:27 +01:00
Mario Limonciello
b821557b35 Fix bubblewrap functionality on Debian systems
Per https://github.com/projectatomic/bubblewrap/issues/200
the paths need to be built differently to be able to accomodate
an unmerged /usr that Debian has.

Use ro bind mounts rather than symlinks to be compatible to both
Fedora's approach and Debian's approach
2018-07-13 10:51:12 -05:00
Mario Limonciello
e6e2bf9d97 trivial: Allow EFI application path to come from a different root 2018-07-10 14:10:16 -05:00
Richard Hughes
f307775675 Add release information for locked devices 2018-06-28 15:51:11 +01:00
Richard Hughes
3c304c4826 trivial: Allow running fu-self-test without ninja 2018-06-28 15:51:11 +01:00
Richard Hughes
ebbb13c2b4 Remove the libfwup dependency from fwupd
In Fedora the only user of libfwupdate is fwupd and the fwupdate command line
tool. It makes sense to absorb the libfwupdate library interface into the
uefi plugin in fwupd. Benefits I can see include:

* fwupd and fwupdate are very similar names; a lot of OEMs are confused

* fwupd already depends on efivar for other things

* We are maintaining an artificial library interface

* The CI and translation hooks are already in place for fwupd

* We don't need to check for features or versions in fwupd, we can just develop
the feature (e.g. BGRT) all in one place.
2018-06-28 15:51:11 +01:00