Commit Graph

1104 Commits

Author SHA1 Message Date
Richard Hughes
f271142c47 trivial: Do not recover the pending update if the boot time is unchanged
This ensures we can restart the fwupd service without marking updates that need
a reboot as failed.
2018-01-12 16:17:27 +00:00
Richard Hughes
59c2ebe5cd Add in the kernel boot time to the uploaded report 2018-01-12 16:17:22 +00:00
Richard Hughes
a899713863 Rescan supported flags when refreshing metadata
The SUPPORTED flag is used when a device appears in the AppStream metadata of
any enabled remote, so when we rescan the modified store also ensure the flag
state is still correct.

Fixes https://github.com/hughsie/fwupd/issues/363
2018-01-12 15:04:21 +00:00
Richard Hughes
0d2320735d Nag the user to upload reports when doing common operations
This is supposed to be a gentle nag, rather than being obnoxious. To disable
this, simply remove the ReportURI key from the relevant remote.
2018-01-11 21:31:29 +00:00
Richard Hughes
0a7bc97317 Add a 'report-history' command to fwupdmgr
This shares your history with a reporting server, typically the LVFS.

NOTE: no data is sent without the user opting-in, and the data sent is shown to
the user before upload.
2018-01-11 21:31:29 +00:00
Richard Hughes
80b79bb9aa trivial: Allow plugins to add metadata to the uploaded reports 2018-01-11 21:28:22 +00:00
Richard Hughes
473c520e38 Add in extra metadata to the uploaded reports
Save the dependency versions, architecture and the kernel versions in the
history database as metadata as it may be different to the time of upload.
2018-01-11 21:28:22 +00:00
Richard Hughes
38c59fcf4a Allow saving extra metadata in the history database
This will be used to store things like the kernel version in the future, and
also means we can stop abusing the vendor property for the fwupd version.
2018-01-11 21:27:44 +00:00
Richard Hughes
e09dbd4ce1 trivial: Do not save flags with daemon state in the history database 2018-01-11 20:20:03 +00:00
Richard Hughes
d29df0819f Allow specifying the reporting server in the remote key files 2018-01-11 20:20:00 +00:00
Richard Hughes
611f1a9cbf Set the remote-id on devices returned by GetHistory 2018-01-11 20:19:41 +00:00
Richard Hughes
3eb2a00d10 trivial: Fix up the version check for offline firmware reporting 2018-01-11 20:19:16 +00:00
Richard Hughes
6b22295cf0 Add a D-Bus method to modify a historical device
This allows us to set specific flags on the device stored in the database.
2018-01-11 10:20:48 +00:00
Richard Hughes
a2f8e45c0f trivial: Set the update state for any updates that need a reboot
This has to be done at each engine startup, as this will happen on the *next*
OS boot.
2018-01-11 10:11:17 +00:00
Richard Hughes
476363ac19 Add a D-Bus method to get the history information 2018-01-11 10:08:58 +00:00
Richard Hughes
af54a0778a trivial: Add a 'clear-history' command to fwupdmgr
This needs to be run as the root user to work.
2018-01-11 10:04:50 +00:00
Richard Hughes
bc3a4e1f57 Store firmware update success and failure to a local database
Rename FuPending to FuHistory to better represent what the object is now doing.
Also, while we're here, switch to using SQLite prepared statements to avoid a
possible invalid read on i386 hardware.
2018-01-11 09:59:34 +00:00
Richard Hughes
9c808e838e trivial: Add fu_test_compare_lines()
This is for future use.
2018-01-11 08:17:02 +00:00
Richard Hughes
3e90a58096 trivial: Do not hardcode the update state in fu_pending_add_device() 2018-01-11 08:16:33 +00:00
Richard Hughes
696e6fdcf3 trivial: Don't allow deleting the pending database
If we're going to use this for history we have to be a little more subtle.
2018-01-11 08:16:25 +00:00
Richard Hughes
718be2de6b trivial: Prefer https_proxy for metadata downloads 2018-01-11 08:16:18 +00:00
Richard Hughes
74fa2ca635 Fix firmware downloading using gnome-software compiled against fwupd 1.0.x
Always set the AppStream app properties on the FwupdRelease. In some cases we
were returning FwupdRelease objects with no name or summary which gnome-software
was ignoring.
2018-01-10 21:37:43 +00:00
Richard Hughes
eafba48905 trivial: Namespace the ignored cleanup error better 2018-01-08 21:59:08 +00:00
Richard Hughes
d980ccb757 trivial: Do the fwupdmgr network setup in a new function
This is for future use by other commands.
2018-01-08 16:57:01 +00:00
Richard Hughes
054b68457d trivial: Use the shared FwupdClient when monitoring 2018-01-08 16:56:56 +00:00
Richard Hughes
9939f1c85c trivial: Fix tiny memory leak when getting GUIDs from an invalid archive 2018-01-08 16:56:19 +00:00
Richard Hughes
e5711c762b trivial: Fix NULL handling in FuPending
We never want to store '(NULL)' as a string in the database.
2018-01-08 16:45:56 +00:00
Richard Hughes
5bed9341b4 trivial: Fix self test failure with newer versions of GCab 2018-01-06 22:46:35 +00:00
Richard Hughes
639da4776b trivial: Allow calling all FuPlugin runners from the self tests 2018-01-06 22:44:24 +00:00
Richard Hughes
c7bbbc246b Allow specifying the maximum archive size in the daemon config 2018-01-03 07:38:27 +00:00
Richard Hughes
4f50e6268a Do not try to parse huge compressed archive files
We don't want to allow DoS-ing the daemon by trying to decompress a huge sparse
cabinet archive.
2018-01-03 07:38:27 +00:00
Richard Hughes
eec8a3c068 trivial: Fix a compile warning with the latest GLib 2018-01-02 20:37:31 +00:00
Richard Hughes
deea2da041 Use the new functionality in libgcab >= 1.0 to avoid writing temp files
Using old versions of gcab we could only do one thing: extract the files in the
cabinet archive to a new directory in /tmp, and then fwupd would have to read
them back in to memory to parse them. This was both inelegant and wasteful, and
probably not an awesome idea from a security or privacy point of view.

Using libgcab >= 1.0 we can decompress to a GBytes blob, and then verify the
firmware and metainfo file without anything being written to disk.

As this is a security sensitive operation, move the fwupd-specific helper code
out of libappstream-glib and also add a lot of internal self tests.

The gcab code will have to remain in libappstream-glib for a long time, but we
don't have to use it. Handling the cab file here also allows us to fix two
long-standing bugs:

 * MetaInfo or firmware files in a subdirectory are handled correctly

 * The archive can also be self-signed using PKCS7 instead of using GPG
2017-12-21 08:54:00 +00:00
Richard Hughes
8f89cf04fb Add more metadata to the user-agent string 2017-12-21 08:25:29 +00:00
Richard Hughes
650dadebe6 Choose the correct component from provides matches using requirements
In the case of multiple <component> sections with different AppStream IDs, but
with the same GUID <provides>, filter using the requirements rather than just
choosing the first one.

This allows the update of Logitech devices with secure bootloaders. Many thanks
to Ogier Bouvier for identifying the problem.
2017-12-14 15:50:19 +00:00
Richard Hughes
963cb45793 ebitdo: Use quirks rather than hardcoding a list of VIDs and PIDs
This means we can trivially support new devices in the future without compiling
any new code. This makes it easier to add support for new hardware for LTS
distros like RHEL.
2017-12-11 16:49:28 +00:00
Richard Hughes
fbcebe096b Connect the progress and status callbacks on the new FuDevice on replug
This ensures we get progress events when replugging a device. Also, remove the
callbacks on the 'old' device to avoid causing multiple events on a 2nd-replug.
2017-12-11 16:48:56 +00:00
Richard Hughes
9934fb514c trivial: Apply the quirks again if the backing GUsbDevice changes 2017-12-11 16:48:42 +00:00
Richard Hughes
853ce90d79 trivial: Actually set the plugin hints from the device GType
This is a typo from the last commit
2017-12-11 12:10:49 +00:00
Richard Hughes
d9e6cca414 csr: Add a new plugin to add support for CSR "Driverless DFU"
CSR is short for Cambridge Silicon Radio, which is a the OEM that makes most
of the bluetooth audio chips in vendor hardware. The hardware vendor can enable
or disable features on the CSR microcontroller depending on licensing options.

The hardware vendor can also use a custom USB descriptor, or just set a custom
PID. In the latter case we need to set the vendor and model to reality using
quirks.

This commit allows the user to update the firmware in the AIAIAI H05 wireless
headphones.
2017-12-11 10:47:18 +00:00
Richard Hughes
306c15b3a0 Add quirks based on the device GType
This allows us to have one per-plugin device quirk without having to call
fu_quirks_lookup_by_usb_device() in each plugin.
2017-12-11 10:47:18 +00:00
Richard Hughes
4cea617967 trivial: Add a quirk for setting the USB device version 2017-12-11 10:47:18 +00:00
Richard Hughes
5060246526 trivial: Move the USB quirks from FuPlugin to FuUsbDevice
Also rename some general USB quirks that are not specific to any one plugin.
2017-12-11 10:47:18 +00:00
Richard Hughes
a29711c4a1 Move the FuQuirks reference down from DfuDevice to FuDevice 2017-12-11 10:47:18 +00:00
Richard Hughes
7de50dbe92 trivial: Only reuse the added device if it has recently been removed 2017-12-11 09:44:36 +00:00
Richard Hughes
9b7bd190ed trivial: Don't show (null) in the debug logs 2017-12-10 14:50:54 +00:00
Richard Hughes
ae252cd83c trivial: Add some common functionality from reading and writing to a buffer 2017-12-08 20:07:09 +00:00
Richard Hughes
725c19fa88 Add a quirk for setting the USB device vendor 2017-12-08 19:36:09 +00:00
Richard Hughes
024cc230ed Add fu_device_set_progress_full()
This allows the plugin to use the raw byte values as a progress counter without
first converting to a percentage.
2017-12-08 09:36:57 +00:00
Richard Hughes
fa34bcffa3 trivial: Add a to_string() vfunc for any objects subclassing FuDevice 2017-12-08 09:36:57 +00:00
Richard Hughes
55f8f236a9 trivial: Allow setting the platform-id from the object constructor 2017-12-08 09:36:57 +00:00
Richard Hughes
e755d6bb05 Add a more general quirk for adding GUIDs to devices
This replaces fwupd-dfu-alternate-vidpid which was only useful in the DFU plugin
and somewhat poorly defined.
2017-12-04 17:00:22 +00:00
Richard Hughes
23135eb1c9 trivial: Remove the now-unused fu_plugin_set_status() 2017-12-04 17:00:22 +00:00
Richard Hughes
20323d63ec Always use the descriptor-provided version and GUID
If a device has gone to the trouble of adding the extra interface data then we
should prefer it over the auto-generated values.
2017-12-01 10:49:39 +00:00
Richard Hughes
460f0b123c trivial: Allow calling ->probe if the GUsbDevice changes 2017-11-30 20:56:33 +00:00
Richard Hughes
4a036018f7 Set the progress and state on the FuDevice, not the FuPlugin
This makes more sense; we're updating the device, not the plugin itself.

This also means we don't need to funnel everything through callbacks like
GFileProgressCallback and we can also update the state without adding an
explicit callback to each derived device type.
2017-11-30 20:51:52 +00:00
Richard Hughes
909d556c03 Get the serial number from USB devices
This is currently unused.
2017-11-30 14:16:34 +00:00
Richard Hughes
c7ad7fb746 trivial: Add fu_usb_device_is_open() for future use 2017-11-30 14:16:34 +00:00
Richard Hughes
c3476d56de Add a method to probe a FuUsbDevice before it is opened
This allows us to further clean up device creation.
2017-11-30 14:16:34 +00:00
Richard Hughes
450f952763 trivial: Do not emit a warning when setting a FuUsbDevice:dev to NULL 2017-11-30 14:16:34 +00:00
Richard Hughes
e2e40501ea trivial: fu_usb_device_set_dev(NULL) should imply a close() 2017-11-30 14:16:34 +00:00
Richard Hughes
18fcbdac53 trivial: Do not allow calling klass->close multiple times on the same device 2017-11-30 14:16:34 +00:00
Philip Withnall
4fbba6f7c0 src: Add some gpointer casts to eliminate compiler warnings
These introduce no functional changes, but do shut up
-Wincompatible-pointer-types-discards-qualifiers warnings.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-30 13:44:41 +00:00
Philip Withnall
a68a050f39 plugins: Remove various unused variables
Fix some compiler warnings to reduce the build noise.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-30 13:44:41 +00:00
Richard Hughes
df149ac006 Remove the superfluous check for a duplicate FuDevice addition 2017-11-29 15:56:29 +00:00
Richard Hughes
94e94eb976 Never overwrite GUsbDevice properties
Getting the string indexes from the hardware is not cheap, and also triggers a
warning from the fwupd daemon.
2017-11-29 15:52:12 +00:00
Richard Hughes
634e9228f8 Always show coldplugged USB devices
When adding GUsbDevice we didn't account for coldplugging devices using the
GUsbContext enumeration.
2017-11-29 15:50:08 +00:00
Richard Hughes
f3d46c6b03 trivial: Include the remote name if it failed to be updated 2017-11-28 14:14:39 +00:00
Richard Hughes
86914c52da trivial: Fix whitespace issue 2017-11-28 14:14:36 +00:00
Richard Hughes
f77d706fff trivial: Add some more profiling to narrow down a slow boot issue 2017-11-27 18:07:53 +00:00
Richard Hughes
5b5e945b18 trivial: Fix the prefix of profiling statements 2017-11-27 18:07:53 +00:00
Richard Hughes
d0cff7caec Remove autoconf-isms from the meson configure options
See https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
2017-11-27 18:07:53 +00:00
Richard Hughes
8b15bd1223 usb: Get the descriptor GUID and version in FuUsbDevice 2017-11-27 18:07:53 +00:00
Richard Hughes
4bc2462301 trivial: Don't show a critical warning when a USB device has no vendor 2017-11-27 18:07:53 +00:00
Richard Hughes
4591bdacbf Add quirks to set common USB properties
The name, summary and icon are not strictly required for a USB device
supporting both DFU interfaces, but having this extra data makes GNOME Software
look much nicer. Using the quirks feature means we can merge in support for new
devices after fwupd has been released for stable distros.
2017-11-27 18:07:53 +00:00
Richard Hughes
3e1da8f9b8 Do not hardcode the device name when not required
If we're getting it from a USB descriptor we don't also need to hardcode it.
2017-11-27 18:07:53 +00:00
Richard Hughes
5f733f2581 Fix critical warning when more than one remote fails to load
See https://github.com/hughsie/fwupd/issues/318
2017-11-26 16:14:20 +00:00
Richard Hughes
88adcbe601 Show a nicer error message if the requirement fails
`Not compatible with fwupd version 1.0.2, requires >= 1.0.3`

...is easier to understand than...

`Value of org.freedesktop.fwupd incorrect: failed predicate [1.0.3 ge 1.0.2]`
2017-11-24 16:37:15 +00:00
Richard Hughes
104f651132 Add a fu_plugin_usb_device_added() dedicated vfunc
This saves all the USB plugins from connecting to the context and managing the
device lifecycle and allows devices that uses FuUsbDevice to be removed
automatically.

This makes supported plugins *much* smaller indeed.
2017-11-24 16:13:44 +00:00
Richard Hughes
858269ebed trivial: Copy over any missing GUIDs when changing the plugin for a FuDevice 2017-11-24 14:42:27 +00:00
Richard Hughes
381b26c2db trivial: Inherit the version when changing the plugin for a FuDevice
Some plugins like DFU might not be able to get the current version number.
2017-11-24 14:42:27 +00:00
Richard Hughes
a0705aa712 trivial: Inherit the vendor ID when changing the plugin for a FuDevice 2017-11-24 14:42:27 +00:00
Richard Hughes
70425fe923 Allow different plugins to claim the same device
When changing from runtime->bootloader->runtime the usual way of handling this
in a fwupd plugin is to:

* reset the device and wait for a replug
* flash the hardware
* reset the device and wait for a replug

This works well when the runtime and bootloader modes are handled by the same
plugin. For situations like the Nitrokey device, where one plugin handles the
runtime (nitrokey), and another handles the bootloader (dfu) we have to have
the ability to 'ignore' the device removal and just issue a 'changed' signal
so the client refreshes the properties.
2017-11-24 14:42:27 +00:00
Richard Hughes
2dadd09cb1 Optionally delay the device removal
In the case where we can trigger the replug automatically we can have to wait
for a USB re-enumeration (typically a few hundred ms) but when the user is
requred to unplug, and then replug we have to wait a bit longer.

The 'remove delay' allows us to modify per-device the removal delay. In the
case the device does not show back up in the correct time the device will be
auto-removed and the session will get a DeviceRemoved signal. In the case where
the device in bootloader mode shows up within the timeout the session just gets
a DeviceChanged event.

For the duration of the delayed removal the flags for the device are set to
zero to ensure the session does not try to interact with the device whilst
re-enumerating.
2017-11-24 14:42:27 +00:00
Richard Hughes
170c0c13c3 trivial: Route the ::added and ::removed through the FuDeviceList
This will allow the list to withhold events in the future, no functional changes now.
2017-11-24 14:42:27 +00:00
Richard Hughes
0a7e783cdd trivial: Move the device list to a new object
This moves more functionality out of the engine, and will allow us to add some
cleverness to the device list to allow the FuDevice to be shared between
different plugins.
2017-11-24 14:42:27 +00:00
Richard Hughes
e7e95452fd trivial: Move the plugin list to a new object
FuEngine is getting somewhat large and complicated, so split out as much plugin
list-specific functionality as possible
2017-11-24 14:42:27 +00:00
Richard Hughes
3483410076 Look up the FuPlugin from the FuDevice each time it is used 2017-11-24 14:42:27 +00:00
Richard Hughes
29a524fdfb Add FuUsbDevice helper object
This allows us to move a lot of duplicated functionality out of each plugin.
2017-11-24 14:04:51 +00:00
Richard Hughes
175635b916 trivial: Move assigning a GError for future code 2017-11-22 14:26:49 +00:00
Richard Hughes
e89ab5976f Partially revert the FuDevice weak reference detection
This causes problems for future patchsets that re-populate the FuDeviceItem.
2017-11-22 14:26:49 +00:00
Mario Limonciello
59cfba617c Test version of gcab to determine which tests to run (Closes: #318)
Adjust the disabling of the s390x CI test to only run when on newer
gcab.
2017-11-17 18:48:40 +00:00
Jan Tojnar
cc9f934787 build: Refactor directory selection
Previously, the various install paths were obtained using get_option
as needed.

This patch unifies the directory selection inside the top-level meson
file as requested in https://github.com/hughsie/colord/pull/62.
2017-11-17 17:11:51 +00:00
Richard Hughes
352ba1b833 dfu: Add support for the original AVR DFU protocol
This allows us to flash hardware like the Retrode and other devices using chips
like the AT90USB1287.

The test files can be re-generated using the sample code found here:
https://github.com/hughsie/fwupd-test-firmware and are designed
to be used on the AT90USBKEY2 development board.
2017-11-16 15:30:30 +00:00
Richard Hughes
43f9dd8c40 Sort the output of GetUpgrades correctly
This allows clients to just select the 'first' FwupdRelease for the newest if
there are multiple installable releases.

Fixes https://github.com/hughsie/fwupd/issues/319
2017-11-16 15:24:47 +00:00
Mario Limonciello
370e76d4f4 Skip hwid-requires test on s390x for now.
This makes CI more useful as there is currently a problem with
gcab 0.7 and big endian architectures not yet fixed.

More details available in:
https://github.com/hughsie/fwupd/issues/318
2017-11-16 07:46:42 -06:00
Richard Hughes
b6f79556f1 Use a SHA1 hash for the internal DeviceID
It's actually less scary to see a SHA1 hash than it is to see a path like
/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.2. It's also way easier to
copy and paste into the various fwupdmgr command that require a device ID and
also means we can match a partial prefix much like git allows.

If we also move to a model where plugins can be changed during different stages
of the update (e.g. during detach) then the device might change connection type
and then the sysfs path not only becomes difficult to paste, but incorrect.

Session software doesn't care about the format of the device ID (it is supposed
to be an implementation detail) and so there's no API or ABI break here. A few
plugins also needed to be ported, but nothing too worrying.
2017-11-16 07:18:36 +00:00
Richard Hughes
49fafec020 Set environment variables to allow easy per-plugin debugging
This allows end-users testing a specific plugin to start fwupd with an extra
command line parameter, e.g. `--plugin-verbose=unifying` to output a lot of
debugging information to the console for that specific plugin.

This replaces a lot of ad-hoc environment variables with different naming
conventions.
2017-11-14 14:22:02 +00:00
Richard Hughes
9c4b531945 trivial: Use fu_plugin_runner_device_generic() for unlock() 2017-11-14 11:34:53 +00:00
Richard Hughes
d3d96ccbb2 trivial: Allow running generic vfuncs in the tests without a GModule
This makes it easier to set up test harness in the daemon self tests.
2017-11-14 11:34:33 +00:00
Richard Hughes
0d7fdb3110 Split out the update detach and attach phases as explicit optional vfuncs
This allows us to do two things:

* Attach after a failed update, so the user isn't left with 'dead' hardware
* Split the detach and attach actions into different plugins in the future

This also allows us to have a separate vfunc to get the new version number
after flashing the firmware, as this may be handled in a different plugin to
the detach phase.
2017-11-14 10:49:43 +00:00
Richard Hughes
78c8411253 Use the correct remote-specified username and passord when using fwupdmgr
Spotted by clang, many thanks.
2017-11-09 12:17:24 +00:00
Richard Hughes
2b9b9f359b trivial: Fix a false-positive noticed by clang 2017-11-09 12:16:53 +00:00
Richard Hughes
1cf88d6775 Detect if a plugin incorrectly unrefs the FuDevice
Watch the FuDevice in the FuDeviceItem with a weak reference and try to recover
without crashing the daemon if the plugin does the wrong thing.
2017-11-08 11:02:38 +00:00
Richard Hughes
d44a5ee56d dfu: Add support for XMEGA chips
Notably, bootloaders for this class of device export an incorrect DFU interface.

Additionally, allow setting the buffer size for the UPLOAD to a larger size
than the defined device transfer size, which allows us to return the full
packet from the larger XMEGA devices.
2017-11-07 12:40:25 +00:00
Richard Hughes
bdb6d7027a dfu: Allow setting a specific DFU version for hardware
Ignoring the warning is not good enough when we're setting policy based on the
specific version. Use the new quirk functionality to do this easily, which
also allows us to remove one more thing in the quirk mega-bitfield.
2017-11-07 12:40:25 +00:00
Richard Hughes
2ec78d68db Add support for HWID requirements
In the latest version of the LVFS you can restrict the firmware to a specific
machine type, for instance a specific baseboard vendor. This is the same as
done in Microsoft Update using the CHID mechanism.

This commit adds support for the <hardware> requires type, although it needs to
be built against appstream-glib 0.7.4 to be supported and/or tested.
2017-11-03 23:42:57 +00:00
Richard Hughes
674ed347d2 dfu: Use FuQuirk to map the chip ID to the AVR32 UM0424 alt-name 2017-11-02 19:08:51 +00:00
Richard Hughes
adeefcd4e0 dfu: Use FuQuirk to encode the Jabra magic packet contents
This allows us to remove the Jabra-specific quirk entry in the device bitfield,
and more importantly allows us to support some more Jabra devices in the future
without code changes.
2017-11-02 19:08:51 +00:00
Richard Hughes
74a80ccc50 dell: Use the new quirk infrastructure for version numbers 2017-11-02 19:08:51 +00:00
Richard Hughes
24c452297d dfu: Use the FuQuirk infrastructure to move the quirks out of the code
This is slightly more verbose than desired as we also have to include the quirk
information when running the dfu-tool, which does not have an already set-up
FuQuirks object as it has no plugin.
2017-11-02 19:08:51 +00:00
Richard Hughes
9c028f06b5 Move the database of supported devices out into runtime loaded files
When fwupd is installed in long-term support distros it's very hard to backport
new versions as new hardware is released.

There are several reasons why we can't just include the mapping and quirk
information in the AppStream metadata:

 * The extra data is hugely specific to the installed fwupd plugin versions
 * The device-id is per-device, and the mapping is usually per-plugin
 * Often the information is needed before the FuDevice is created
 * There are security implications in allowing plugins to handle new devices

The idea with quirks is that the end user can drop an additional (or replace
an existing) file in a .d director with a simple format and the hardware will
magically start working. This assumes no new quirks are required, as this would
obviously need code changes, but allows us to get most existing devices working
in an easy way without the user compiling anything.

This allows us to fix issues like https://github.com/hughsie/fwupd/issues/265
2017-11-02 19:08:51 +00:00
Richard Hughes
3b84753769 Use help2man to generate the man page at build time
The man pages are always old and out-of-sync with the actual tool, so just
generate them using the output of --help.

Fixes https://github.com/hughsie/fwupd/issues/285
2017-10-23 16:47:08 +01:00
Mario Limonciello
7af941fee4 synaptics: drop hard dependency on dell plugin and libsmbios
Rather than have a hard dependency use metadata and internal DMI
to communicate the relevant details
2017-10-18 08:27:38 -05:00
Richard Hughes
f50eca4f55 trivial: Add FWUPD_STATUS_DEVICE_BUSY
This is when we're waiting for the device, but we don't know why.
2017-10-12 12:43:25 +01:00
Richard Hughes
cc70f193e9 trivial: Use the new API in libappstream-glib directly 2017-10-09 21:00:26 +01:00
Richard Hughes
cd0d72abbe trivial: Move the man pages to the source locations
This should make it easier to keep them in sync.
2017-10-09 09:59:52 +01:00
Richard Hughes
50ba92dcae trivial: Generate an internal daemon introspection file
This isn't installed and is only used to validate the gtk-doc markup.
2017-10-05 10:32:05 +01:00
Richard Hughes
4eada34d4c trivial: Fix up introspection issues in the daemon code 2017-10-05 10:32:05 +01:00
Richard Hughes
87f8a4a284 Add a waiting-for-auth daemon state
Using IDLE for this isn't right as we're basically blocked on the user.
2017-10-02 14:50:26 +01:00
Richard Hughes
723b4ccaa6 trivial: Don't show a progressbar when then daemon is staying idle 2017-09-29 11:58:21 +01:00
Richard Hughes
7f6d78fb1b Add fwupd_remote_get_checksum() to use in client programs 2017-09-28 09:23:52 +01:00
Richard Hughes
b2fb80925c trivial: Remove fwupd_remote_get_filename()
The data for these was just being generated internally based on the ID and the
basename of the original URI, and that's easy for the calling application to do
itself.
2017-09-28 09:23:52 +01:00
Richard Hughes
642ec13754 trivial: Remove GetUpdates as it is no longer used 2017-09-28 09:23:52 +01:00
Richard Hughes
eb53042c20 trivial: Use FuProgressbar in dfu-tool 2017-09-28 09:23:52 +01:00
Richard Hughes
b73ff8a346 trivial: Use FwupdStatus in the dfu plugin 2017-09-28 09:23:52 +01:00
Richard Hughes
e0bd53e439 trivial: Use standard _to_variant() and _from_variant() forms 2017-09-28 09:23:52 +01:00
Richard Hughes
603e42d527 trivial: Include the releases as part of the device a{sv} array 2017-09-28 09:23:52 +01:00
Richard Hughes
9e1b14067c trivial: Always use a a{sv} type to return value
Mixing sa{sv} and a{sv} made everything very confusing...
2017-09-28 09:23:52 +01:00
Richard Hughes
10c6a89563 trivial: Do not use 'provider' in the public API 2017-09-28 09:23:52 +01:00
Richard Hughes
80893e29fe trivial: Remove FwupdResult from libfwupd 2017-09-28 09:23:52 +01:00
Richard Hughes
b86ef97b36 trivial: Remove fwupd_remote_build_uri()
This also removes the long-deprecated fwupd_remote_get_uri() and fwupd_remote_get_uri_asc()
2017-09-28 09:23:52 +01:00
Richard Hughes
ba73c76d69 trivial: Remove the deprecated fwupd_client_update_metadata()
Also, rename fwupd_client_update_metadata_with_id() to it's now-removed counterpart.
2017-09-28 09:23:52 +01:00
Richard Hughes
07f963a52d trivial: Remove the deprecated fwupd_client_get_details()
Also, rename fwupd_client_get_details_local() to it's now-removed counterpart.
2017-09-28 09:23:52 +01:00
Richard Hughes
eb94c14022 trivial: Remove the deprecated fwupd_client_get_devices()
Also, rename fwupd_client_get_devices_simple() to it's now-removed counterpart.
2017-09-28 09:23:52 +01:00
Richard Hughes
08a37992f9 Allow plugins to depend on each other
The only things that plugins can declare is that they should be run before,
after or never with regard to another plugin.
2017-09-21 17:09:06 +01:00
Richard Hughes
7ada7a8678 Add support for SMBIOSv3
Fixes https://github.com/hughsie/fwupd/issues/262
2017-09-20 22:08:21 +01:00
Richard Hughes
f2eccdee5c trivial: Fix a tiny memory leak when getting the upgrades list 2017-09-20 11:18:03 +01:00
Richard Hughes
34e25a0cc5 trivial: Remove EnableTestSuite from daemon.conf
The same thing can be done using BlacklistPlugins=test
2017-09-19 20:06:44 +01:00
Richard Hughes
10bd8ecfb8 trivial: Remove EnableOptionROM from daemon.conf
The exact same thing can be done using BlacklistPlugins=udev
2017-09-19 20:06:44 +01:00
Richard Hughes
c2af1964b9 trivial: Move /etc/fwupd.conf to /etc/fwupd/daemon.conf 2017-09-19 20:06:44 +01:00
Richard Hughes
b0aa379300 Use a fallback SYSCONFDIR if the default is not set 2017-09-19 20:06:44 +01:00
Richard Hughes
1354ea9cd8 Add fu_plugin_check_supported()
This allows a plugin to see if a GUID is supported in the AppStream metadata of
configured remotes. It allows plugins to skip devices that are not supported
and that do bad things when probed.
2017-09-19 16:00:45 +01:00
Richard Hughes
41fc2d5435 trivial: Hide fu_plugin_has_device_delay() from plugins 2017-09-19 15:19:17 +01:00
Richard Hughes
7769fb8da7 trivial: Add some more FuEngine self tests 2017-09-18 11:12:52 +01:00
Richard Hughes
0dec274e56 Fix a crash when using fu_plugin_device_add_delay()
By removing the device from the hash table before we add it to the devices
array we could inadvertently drop the last object reference if the plugin is
not using the (optional) cache.

Just re-arrange things to fix https://github.com/hughsie/fwupd/issues/259
2017-09-18 11:08:27 +01:00
Richard Hughes
4c95f8973a trivial: Fix build deps to fix ppc64le build 2017-09-17 11:00:19 +01:00
Richard Hughes
c07ac39ad1 trivial: Return a better error for keyring set up failure 2017-09-17 09:33:53 +01:00
Richard Hughes
b5b4beb472 Fix various printing issues with the progressbar
Specifically, fix the progressbar to:

 * Print at 100% after an 'unknown' percentage task has completed
 * Refresh the progressbar if being called without a main loop running
 * Allow the progressbar to start with a h-offset without moving 'left'
 * Don't cause high CPU load when calling fu_progressbar_update() ever few us

Also, add some unit tests to discover all the issues.
2017-09-17 08:56:05 +01:00
Richard Hughes
4f98fe89ba trivial: Use a different SYSCONFDIR for self tests 2017-09-17 08:38:43 +01:00
Richard Hughes
84bf038a52 trivial: Do not log to the journal when calling GetDetails 2017-09-16 18:52:51 +01:00
Richard Hughes
882ab6b4d0 trivial: Add a self tests for the broken metadata bug 2017-09-16 17:53:16 +01:00
Richard Hughes
820dac7fde trivial: Use a different SYSFSFIRMWAREDIR for self tests
This means we can drop some self-test specific code in fu_smbios_setup().
2017-09-16 17:46:41 +01:00
Richard Hughes
e7c6bcab3a trivial: Use a different PLUGINDIR for self tests 2017-09-16 17:44:38 +01:00
Richard Hughes
49938e6a07 trivial: Skip non-conf files when searching for remotes 2017-09-16 13:24:50 +01:00
Richard Hughes
068d34307a Do not fail to load the daemon if cached metadata is invalid
Fixes: https://github.com/hughsie/fwupd/issues/257
2017-09-16 08:26:46 +01:00
Richard Hughes
93b1576bef trivial: Add helpers that can be used for returning local files
This also allows us to drop the use of FwupdResult in the daemon.
2017-09-15 14:12:18 +01:00
Richard Hughes
cc3de2efa4 Do not store the newest release as part of the FuDevice object 2017-09-15 14:12:18 +01:00
Richard Hughes
e7fd8eb81f trivial: Simplify the check for supported devices 2017-09-15 14:12:18 +01:00
Richard Hughes
f11fa3caac trivial: Use the new fwupd_client_get_upgrades() in fwupdmgr 2017-09-15 14:12:18 +01:00
Richard Hughes
a96413a368 Add a method to return a list of upgrades for a specific device 2017-09-15 14:12:18 +01:00
Richard Hughes
97284b1ad8 Move the downgrade calculation to the daemon 2017-09-15 14:12:18 +01:00
Richard Hughes
68982c6624 Make FuDevice derive from FwupdDevice rather than FwupdResult
We're aiming for a model where devices can have multiple releases and we can
nuke FwupdResult completely.
2017-09-15 14:12:18 +01:00
Richard Hughes
b3ca245b74 Move the release trust information to FwupdRelease
It only remained on FwupdResult because I couldn't make up my mind about whether
it was a property of the device, or the firmware release. It's more logically
the latter, as you could have a .cab file with multiple versions of the
firmware and only the first being signed.
2017-09-15 11:31:01 +01:00
Richard Hughes
6ab53111db Never fallback to an offline update from client code
UEFI updates don't need to be retried since a785a1c. If the call to Install()
failed with NOT_SUPPORTED we can just show the error rather than doing the
little dance and involving the offline pending database for no reason.

Fixes some of https://github.com/hughsie/fwupd/issues/255
2017-09-15 09:35:27 +01:00
Richard Hughes
31bbd1691b Add a command 'clear-offline' to fwupdmgr
This allows us to 'unschedule' any offline updates.
2017-09-15 09:33:06 +01:00
Richard Hughes
f6e4d723ca Do not store the AppStream ID in the pending database
We don't actually need it for anything and it complicates future functionality.
2017-09-14 11:45:06 +01:00
Richard Hughes
27e5df2fe7 trivial: Fix a tiny leak in the daemon 2017-09-14 11:28:50 +01:00
Richard Hughes
ba15eebabb trivial: Show the RemoteID when printing available releases 2017-09-14 10:26:15 +01:00
Richard Hughes
d140210b4f trivial: Fix up the hex version numbers when adding to the store
This means we show the 'human readable' version numbers in the debug UI.
2017-09-14 10:26:15 +01:00
Richard Hughes
bd4d2856dd Merge releases where multiple remotes provide the same firmware
For a few months the lvfs-testing remote has not included firmware already
present in the stable lvfs remote. This means if you enable the testing remote
then components in the stable remote are not available to fwupd.

Instead of a simplistic check on the component ID, add the missing releases
no matter the ordering of the remotes.
2017-09-14 10:26:15 +01:00
Richard Hughes
fc0d170334 trivial: Show the available release versions in the daemon debug output
Also, truncate the output when there are lots of versions available.
2017-09-14 10:26:15 +01:00
Richard Hughes
225f3a98fe trivial: Sort the releases returned by GetReleases() 2017-09-13 19:38:51 +01:00
Richard Hughes
30dbf0d7d0 Remove the UniqueID property
This was only ever added for gnome-software, and is too inflexible for anything
else. It turns out we don't even need it in GNOME, as we can construct a
suitable ID ourselves using the existing values.

It was also ambiguous whether the unique ID was in reference to the device
or release -- and for gnome-software we need both.
2017-09-13 15:28:33 +01:00
Richard Hughes
9dde04fbda trivial: Split out some functionality not to be used by plugins 2017-09-13 14:59:32 +01:00
Richard Hughes
a1aab517d1 Move the update state to FwupdDevice
It only remained on FwupdResult because I couldn't make up my mind about whether
it was a property of the device, or the firmware release. It's more logically
the former, and that's how plugins are using it.
2017-09-13 14:59:32 +01:00
Richard Hughes
d2b4fc5e00 trivial: Set the AppStream ID when returning results from GetReleases
We need this for GUI software.
2017-09-12 16:42:46 +01:00
Richard Hughes
c1c2fec6f5 Add optional icons to each device
This allows us to show the devices in a GUI with a nice icon. Some of the icon
mappings are not perfect and I'll be asking the GNOME designers for some
additions to the icon specification.

Custom vendor icons can also be specified, and /usr/share/fwupd/icons would be
a good place to put them. If vendor icons are used they should show a physical
device with the branding, rather than just the vendor logo.
2017-09-11 17:27:35 +01:00
Richard Hughes
6fae095fe5 trivial: Less whitespace in the output of fu_device_to_string() 2017-09-11 10:29:52 +01:00
Richard Hughes
6c6e8d3ab8 Add an 'Summary' property to each device
This was already exported in the libfwupd API, but it had no way of being set
from devices or passed from daemon to client.
2017-09-11 09:30:06 +01:00
Richard Hughes
48ad97fd61 Add a human-readable title for each remote
This allows us to show something useful in a GUI.
2017-09-10 09:08:32 +01:00
Richard Hughes
304ffe4db7 trivial: Fix two big-endian issues in FuSmbios 2017-09-08 09:24:54 +01:00
Richard Hughes
564ad3103b trivial: Fix up a formatting specifier in FuSmbios
Fixes: https://github.com/hughsie/fwupd/issues/233
2017-09-08 09:03:45 +01:00
Richard Hughes
a6bd5580d3 Add ModifyRemote as an easy way to enable and disable remotes like the LVFS
For example:

    $ fwupdmgr modify-remote lvfs-testing Enabled true
2017-09-07 23:02:58 +01:00
Richard Hughes
1941c44559 Do not auto-open all USB devices at startup
Fixes: https://github.com/hughsie/fwupd/issues/220
2017-09-07 19:00:51 +01:00
Richard Hughes
92faae9a41 usb: Use FuDeviceLocker 2017-09-07 19:00:51 +01:00
Richard Hughes
7c52580f9c Add FuDeviceLocker to simplify device open/close lifecycles
We can use the power of g_autoptr() to automatically close devices that have
gone out of scope. When everything is converted we can drop the GUsbContect
AUTO_OPEN_DEVICES flag which is making us look bad in powertop.
2017-09-07 19:00:51 +01:00
Richard Hughes
49e5e05aa8 Parse the SMBIOS DMI table directly
The Linux DMI class still does not provide the information we need, and parsing
the blob directly also allows the Dell and Redfish plugins to get the raw data.
2017-09-05 18:10:36 +01:00
Richard Hughes
19ff7b9571 trivial: Add fu_device_to_string()
This allows us to easily print the FwupdDevice, the FwupdRelease and the
daemon-specific metadata. This can only be called from the daemon or plugins.
2017-09-04 13:27:48 +01:00
Richard Hughes
adc9dadcf2 trivial: Fix the included headers for fu-common.h
The GCancellable object is in gio-2.0.
2017-09-04 13:19:27 +01:00
Richard Hughes
f315719851 trivial: Fix up a literal format string in fwupdmgr 2017-08-31 20:00:01 +01:00
Richard Hughes
1f92addd10 trivial: Remove unused function in fwupdmgr
Fixes 2nd half of https://github.com/hughsie/fwupd/issues/209
2017-08-30 10:51:51 +01:00
Yehezkel Bernat
e43f7fb655 trivial: cleanup for many compilation warnings from clang
Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
2017-08-30 10:43:15 +01:00
Richard Hughes
60eaca18fb trivial: Fix a const-correctness issue discovered using clang
Fixes: https://github.com/hughsie/fwupd/issues/210
2017-08-30 10:37:56 +01:00
Richard Hughes
a785a1c2f6 Remove the confusing ALLOW_OFFLINE and ALLOW_ONLINE flags
Over the months the original meaning of ALLOW_OFFLINE and ALLOW_ONLINE have be
lost, and there is now a confusing mixture of uses in the source tree. With this
commit we make it clear the UPDATABLE flag is used to specify when the device is
updatable (e.g. from the desktop live session, or from the systemd offline
updates mode, or both) and the NEEDS_REBOOT flag lets us know when the update
is actually going to be done.

For instance, a UEFI UpdateCapsule can be *scheduled* from either the desktop
or from the update mode (but the latter would be a bit weird), but does require
a reboot. Some devices might only be updatable outside the live session, for
instance a hard drive update or a GPU update -- there's just too much going on
with a live session and we want to tightly control what's running during the
firmware flash.

This also means we don't have to "retry" the update when scheduling an update
that really can be scheduled whenever, but just requires a reboot to apply.
2017-08-26 18:09:21 +01:00
Mario Limonciello
3bc251b3a8 thunderbolt: when in safe mode on a Dell system look up VID/DID from SMBIOS
Signed-off-by: Richard Hughes <richard@hughsie.com>
2017-08-25 09:46:41 +01:00
Mario Limonciello
35a0e864b8 Introduce concept of CanForcePower to turn on TBT controllers
Supported Dell devices will use this to turn on ThunderBolt controllers
during coldplug.
2017-08-25 09:35:46 +01:00
Richard Hughes
55566b53e6 Allow plugins to set boolean and integer metadata
Handling this in one place prevents plugins setting different values for
non-string values like TRUE/false or with different ways to represent integers.
2017-08-25 09:22:05 +01:00
Mario Limonciello
a4e764c3e2 Introduce a plugin interaction ABI 2017-08-24 13:41:27 -05:00
Richard Hughes
e1fd34d5f1 Allow plugins to set metadata on devices created by other plugins
This could be used, for instance, to set a property on ThunderBolt controllers
inside Dell computers saying that they support forcing the power level during
coldplug. It could also be used to set the dock type for the synapticsmst hub.

Adding this level of complexity allows us to avoid the creep of HAVE_DELL and
HAVE_LENOVO into seemingly unrelated plugins, and also allows us to have
multiple vendor plugins providing the same end result with two different
vendor-specific mechanisms.
2017-08-24 16:15:11 +01:00
Richard Hughes
7ef96b8a4e trivial: Fix up a few NULL/FALSE mismatches 2017-08-23 18:28:24 +01:00
Richard Hughes
c6afb51e32 Add a FirmwareBaseURI parameter to the remote configs
This allows somebody to mirror the CDN without resigning the metadata files.

Fixes: https://github.com/hughsie/fwupd/issues/186
2017-08-23 14:22:12 +01:00
Richard Hughes
0dea1efb92 Use MetadataURI for both kinds of remote
I think this is clearer having one key for both types of remote.
2017-08-23 14:22:08 +01:00
Richard Hughes
9a7db9df7d Show a bouncing progress bar if the percentage remains at zero
Device actions like a Thunderbolt replug can take 25 seconds (!) and so it's a
good idea to show the user that the calling process is still alive.
2017-08-21 15:51:38 +01:00
Richard Hughes
adcc16a53c trivial: Check for zero size firmware image 2017-08-21 12:26:46 +01:00
Richard Hughes
0a8d5df265 trivial: Check the PKCS key purpose before adding to the trust list
According to some best practices this is a good idea, but in this specific case
the certificate will have been installed by the admin or package manager and
so is less important.
2017-08-18 12:19:23 +01:00
Richard Hughes
f03f386c68 trivial: Add a test for firmware signed with a derivative of the LVFS key
This also switches around the test for the self signed key to now fail, as the
generated certificate is no longer loaded into the trust list. This is a more
useful test as it more accurately represents what the fwupd daemon is doing.

As a side-note the detached signature from the derivate cannot be generated
using `--no-p7-include-cert` as only the main LVFS-CA certificate is shipped
with fwupd.
2017-08-18 12:11:59 +01:00
Richard Hughes
14047d7d24 trivial: Split up the keyring setup and public key adding 2017-08-18 11:10:03 +01:00
Richard Hughes
f69a4810fa Return the authority and timestamp as part of the signing validation
This means we return an error when encountering a rollback attack. This can
currently be performed by providing the old metadata and old signature when
calling into UpdateMetadata.
2017-08-17 16:15:47 +01:00
Richard Hughes
556ec355db trivial: Fix getting the keyring for PKCS7-enabled remotes
Found using Coverity, thanks.
2017-08-16 13:42:10 +01:00
Richard Hughes
455fdd3ab6 trivial: Add some debugging into the common helper functionality 2017-08-16 13:42:10 +01:00
Richard Hughes
67cbe64070 trivial: Fix an abort when the pollable input stream couldn't be read 2017-08-16 13:42:10 +01:00
Richard Hughes
99e621d388 Save the metadata signature in the local cache
This is useful if the admin wants to re-verify the metadata, or if a public
key is removed or expires.
2017-08-16 13:42:10 +01:00
Richard Hughes
f0d57235f4 trivial: Fix a few cases of over-keen sed'ing 2017-08-16 13:42:10 +01:00
Richard Hughes
b9ad09ca93 trivial: Correctly search for the .cab detached signature 2017-08-15 15:35:47 +01:00
Richard Hughes
7ee42feb83 trivial: Add common function for making required parent directories 2017-08-15 15:35:36 +01:00
Richard Hughes
7403dc505f Optionally use GnuTLS to verify PKCS7 certificates
We can use this as an alternative for GPG. No PKCS7 certificates are currently
installed by fwupd and it's expected that the LVFS will still only provide GPG
detached signatures.

If an OEM distributor wants to sign firmware with a PKCS7 and the corresponding
certificate is provided then the firmware will be marked as valid.

Only firmware shipping with a .p7b file will use the PKCS7 functionality,
similarly remote metadata validation will default to GPG unless Keyring=pkcs7
is specified in the config file.
2017-08-14 09:42:48 +01:00
Richard Hughes
0724d8bde0 trivial: Bump the appstream-glib requirement to 0.6.13 2017-08-09 17:21:48 +01:00
Richard Hughes
f6f72a439e trivial: Look for bwrap executable in the path 2017-08-09 16:25:25 +01:00
Richard Hughes
443e409377 trivial: Allow non-shell startup scripts for the firmware builder 2017-08-09 16:07:31 +01:00
Richard Hughes
2bd16ac8b3 trivial: Remove unused allocated path 2017-08-09 16:04:08 +01:00
Richard Hughes
049ccc8f6c Add a helper function to spawn a subprocess
This allows us to watch the output of a flashing tool and screen-scrape the
progress completion.
2017-08-09 15:35:58 +01:00
Richard Hughes
41cbe2aab3 Add a firmware builder
This runs a script inside the firmware archive to generate firmware specific to
the machine. This uses bubblewrap to protect the local machine.
2017-08-09 10:33:39 +01:00
Richard Hughes
954dd9fd88 trivial: Add fu_common_rmtree() for future use 2017-08-09 10:23:23 +01:00
Richard Hughes
94f939aa4d trivial: Move the archive decompression to common code 2017-08-09 10:23:23 +01:00
Richard Hughes
d7704d4cc2 Allow plugins to get DMI data from the hardware in a safe way
The returned strings are converted to ASCII and have leading and trailing
spaces removed.
2017-08-09 10:19:13 +01:00
Richard Hughes
e7472a22cc Use a static library to avoid symlinking files for the tests 2017-08-09 10:19:13 +01:00
Richard Hughes
d0d2ae66e0 trivial: Add fu_common_get_contents_bytes() for future use 2017-08-09 09:37:48 +01:00
Richard Hughes
2d95a71a0c Support embedded devices with local firmware metadata
In this mode, both the metadata and firmware is stored on the local filesystem
and distributed using a distribution system like OSTree.

Fixes https://github.com/hughsie/fwupd/issues/162
2017-07-28 17:41:24 +01:00
Richard Hughes
ba51279752 trivial: Fix two tiny leaks in fwupdmgr 2017-07-27 16:32:43 +01:00
Mario Limonciello
9ac53e28b1 Add information about compile-time dependency versions
Since the codebase looks at these versions for turning on and off
functionality it will be useful to use this for debugging
2017-07-24 15:30:28 -05:00
Richard Hughes
1ad45caeec Use new GUsb functionality to fix flashing Unifying devices
This avoids open()ing and close()ing multiple times on hotplug -- which in
itself isn't a huge problem as the requests are refcounted in libusb, but it
matters hugely when a plugin accidentally closes a device that was not opened.

As all the devices are going to be opened anyway (to read the vendor strings)
and the cost of keeping the device is open is tiny, just get libgusb to
auto-open *all* devices and keep them open for the duration.

Fixes: https://github.com/hughsie/fwupd/issues/155
2017-07-24 11:08:25 +01:00
Richard Hughes
535664cd1e Run the plugin coldplug methods in a predictable order
When reading with g_dir_read_name() the returned files do not have to be sorted
in any particular order and could even change between invokation. This patch
makes debugging the interactions between plugins much easier.
2017-07-24 10:32:06 +01:00
Richard Hughes
ca52a8541e trivial: Fix self tests after downgrading warnings commit 2017-07-21 15:42:32 +01:00
Richard Hughes
3cca1c65c2 trivial: Remove or downgrade some superfluous warnings
Fixes bugs like https://github.com/hughsie/fwupd/issues/159
2017-07-21 13:38:27 +01:00
Mario Limonciello
5033d9c92e Add capability to enable test suite via /etc/fwupd.conf 2017-07-17 14:45:51 -05:00
Mario Limonciello
c29b398ad0 trivial: fix various spelling errors 2017-07-17 13:07:05 -05:00
Richard Hughes
4851158249 trivial: Fix a -Wsign-compare warning on 32 bit 2017-07-17 16:39:35 +01:00
Richard Hughes
e8b5db66f4 Fix a hang on 32 bit computers
It turns out using a string hash for a pointer object doesn't always work...
2017-07-17 14:18:29 +01:00
Mario Limonciello
5735fd67c1 trivial: set engine back to idle
A regression from 9945edbe74 causes
a missing newline for many actions because it doesn't go back to idle
2017-07-13 16:22:19 -05:00
Mario Limonciello
790701f32b trivial: adjust get-details and get-devices output Display Name output
This returns them back to the more readable 0.8.x behavior where
devices have the name first and then all the details indented.
2017-07-13 16:22:19 -05:00
Richard Hughes
32684f2344 Check all the device GUIDs against the blacklist when added
To the user it's not obvious which is the default GUID.

See https://github.com/hughsie/fwupd/issues/127
2017-07-13 09:32:26 +01:00
Mario Limonciello
dc8c985159 trivial: back the requirement on appstream-glib to 0.6.9
The items that 0.6.13 requires are now guarded by a version test.
This should allow running fwupd master on more distros that haven't
yet picked up appstream-glib 0.6.13.
2017-07-10 14:32:42 -05:00
Richard Hughes
b3dca14e90 trivial: Never compare a string against zero to avoid warnings 2017-07-06 18:28:01 +01:00
Mario Limonciello
b04c13e1cf Include optional git checkout information in --version
When users are running from git this should aide in
debugging if they have a fix included.
2017-07-05 17:49:50 -05:00
Richard Hughes
89483f1bb9 Add --version option to fwupdmgr
$ fwupdmgr --version
    client version:	0.9.6
    daemon version:	0.9.6

Fixes https://github.com/hughsie/fwupd/issues/153
2017-07-04 20:49:27 +01:00
Richard Hughes
ed34991bd8 Do not unlock devices when doing VerifyUpdate
We used to do this dance to avoid reading the Option ROM on hardware by default
(some faulty hardware would crash...) but now we're doing the verify update in
the daemon there's no need to split this into two steps.

Fixes: https://github.com/hughsie/fwupd/issues/149
2017-06-22 10:37:10 +01:00
Richard Hughes
b9bddfd7ac trivial: Ensure the verify component is replaced on veriy-update, not merged 2017-06-22 10:34:18 +01:00
Richard Hughes
08f12de44c trivial: Avoid warning when doing verify-update multiple times
Applications always need a valid source with newer appstream-glib versions;
even in this case where the source is the hardware itself.
2017-06-22 10:33:32 +01:00
Richard Hughes
22c88de8e4 trivial: Increase the warning level when a plugin adds a device twice 2017-06-22 09:36:32 +01:00
Richard Hughes
943d2c9bb5 trivial: Split out some common functionality from fu-engine.c 2017-06-21 09:04:39 +01:00
Mario Limonciello
f3f4390155 Only use the test runner plugin when CI is set in the env (#148)
This prevents an installed system from showing FakeDevices but
still allows exercising every commit with Travis CI
2017-06-20 13:56:13 -05:00
Richard Hughes
a5bb4d8428 trivial: Fix a missing signal causing a warning in the recent refactor 2017-06-19 20:22:25 +01:00
Richard Hughes
b53ad36012 trivial: Fix up a number of FALSE/NULL return issues 2017-06-19 13:50:42 +01:00
Richard Hughes
d60421a5fa trivial: Ensure all source files include config.h 2017-06-19 13:50:42 +01:00
Richard Hughes
9945edbe74 Split up the daemon into the loader and an engine object
The idea here is that we move a lot of the 'meat' out of fu-main into the
engine. This also lets us simplify a lot of things and ensures the user
authentication is simple and easy to audit.
2017-06-19 13:50:38 +01:00
Richard Hughes
5475427ca9 Remove the UpdateMetadata D-Bus method as the fallback is done client-side 2017-06-19 09:58:11 +01:00
Richard Hughes
1f162e2f16 Implement the GetDetails->GetDetailsLocal fallback client side
This allows us to get rid of some more complex daemon code.
2017-06-19 09:56:43 +01:00
Richard Hughes
cda1cdf606 Also watch the metadata cache filename for changes
If something changes the cache behind our back (e.g. deleting or updating the
file) we need to reload the list of remotes so that the age is correctly shown.
2017-06-16 21:49:37 +01:00
Richard Hughes
feb8027ee3 Show the age of the remote metadata in 'fwupdmgr get-remotes'
Note: we have to transfer the mtime (not the age) when creating the GVariant,
as we want calls to fwupd_remote_get_age() to update the value without getting
the remote from the daemon each time.
2017-06-16 20:24:41 +01:00
Richard Hughes
83fb8d95f4 Do not fall back to the default release when verifying
This is never going to be valid. What we want is to try and get a new AsApp and
AsRelease from the system store, not the verification store.
2017-06-16 17:13:05 +01:00
Richard Hughes
0a87f6fb03 Store the metadata files rather than merging to one store
Now we have multiple remotes that can be enabled or changed at runtime we need
to do several things better:

* Only load components from remotes that are enabled

* Only load a component if a higher priority remote has not already added it

Rather than just appending all recieved metadata into one big XML file, save
the original metadata .xml.gz files in /var/lib/fwupd/remotes.d and only load
them in the correct priority order if the remote is known and enabled.

Remove the old /var/cache/app-info/xmls/fwupd.xml file, also noting it wasn't
really a cache file at all but actually something quite important.
2017-06-16 16:43:13 +01:00
Richard Hughes
5935ebda5a Check the remote exists and is enabled when using UpdateMetadataWithId 2017-06-16 15:40:31 +01:00
Richard Hughes
4c36970445 Move the remotes parsing from the client to the server
This allows us to load the metadata stores in a more sensible way in the future.
2017-06-16 15:31:40 +01:00
Richard Hughes
f0bde3e4af Add a get-remotes command to fwupdmgr
This allows the user to show the configured remotes.
2017-06-16 14:31:20 +01:00
Richard Hughes
980ef147eb Move the config file parsing out to a new object
This will allow us to move the remote parsing here soon.
2017-06-16 12:46:40 +01:00
Richard Hughes
81f96797f6 trivial: Do not remove all apps in the store when loading metadata 2017-06-16 12:40:49 +01:00
Richard Hughes
8a8425f7be Do not store the verify store in the cachedir
The list of verification hashes is certainly not a cache, it's important data
that needs to be kept for a long time somewhere important.

Move it from /var/cache/app-info/xmls to /var/lib/fwupd and delete the old file
as it may have now-incorrect contents.
2017-06-16 12:40:44 +01:00
Richard Hughes
bbde1df44f Fix downgrades when version_lowest is set
Also, add some tests to test this with the dummy device.
2017-06-16 12:40:15 +01:00
Richard Hughes
8a870d0399 trivial: Ensure there are no updates after the update is applied 2017-06-16 12:40:10 +01:00
Richard Hughes
954de52612 trivial: Make --verbose work in fwupdmgr 2017-06-16 07:59:02 +01:00
Richard Hughes
40aeea4167 trivial: Show the release (not device) checksums in 'fwupdmgr get-updates' 2017-06-16 07:59:02 +01:00
Richard Hughes
ababbb7ae1 trivial: Clear any device checksums before doing device::verify 2017-06-15 20:19:23 +01:00
Richard Hughes
f556d371da trivial: Clear any device checksums after the online update 2017-06-15 20:19:19 +01:00
Richard Hughes
c2a20d7fff trivial: Show the release (not device) checksums in 'fwupdmgr get-releases' 2017-06-15 20:19:03 +01:00
Richard Hughes
ae7e0d21b2 Add an installed test for verification 2017-06-15 16:23:52 +01:00
Richard Hughes
20d2d726e0 Fix the self tests when running on PPC64 big endian 2017-06-15 12:05:11 +01:00
Richard Hughes
109526bf34 trivial: Fix a harmless warning when building RPMs 2017-06-15 11:07:00 +01:00
Richard Hughes
18b73a4bdd trivial: Return with exist code 0 when there is nothing to do 2017-06-14 15:16:06 +01:00
Richard Hughes
d424d0d193 Use the correct type signature in the D-Bus introspection file 2017-06-14 13:55:57 +01:00
Richard Hughes
4619f9f5c1 trivial: Use the 'message' level for normal events 2017-06-14 13:55:30 +01:00
Richard Hughes
2899cb28d5 Show progress download when refreshing metadata 2017-06-13 16:31:18 +01:00
Richard Hughes
b38a4fdfd6 Fix a crash when refreshing metadata
When processing the file handles it seems g_variant_get() actually wants to
write the fd integer. This bug does not happen every time, and seems to vanish
every time under valgrind.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1460429
2017-06-13 15:24:06 +01:00
Richard Hughes
fd381cc96e Add the ability to restrict the firmware installation to specific vendor IDs
This allows us to fix https://github.com/hughsie/lvfs-website/issues/4
2017-06-12 20:22:25 +01:00
Richard Hughes
b86484a585 Export some more API for dealing with checksums 2017-06-09 10:11:58 +01:00
Richard Hughes
3d2fc1e353 Ensure that firmware provides are legal GUIDs
If they are raw device strings, e.g. 'USB\VID_046D&PID_AAAC' just fix them
in-place.
2017-06-08 14:26:40 +01:00
Piotr Drąg
748ae3154e trivial: Fix a typo in a translatable string (#132) 2017-06-07 16:59:40 -05:00
Richard Hughes
cffef2654b trivial: Include the device name in the output of 'fwupdmgr get-releases'
If only one device is present, then it's not obvious what this output refers to.
2017-06-07 15:34:53 +01:00
Richard Hughes
6d7c33c5da trivial: Fix two tiny leaks in the new HWIDs support 2017-06-07 15:34:53 +01:00
Richard Hughes
97fc78bbc3 trivial: Fix a harmless warning from clang 2017-06-07 15:34:53 +01:00
Richard Hughes
68cc00c7e9 Allow multiple checksums on devices and releases
Although we supported other hashes than SHA1 (which is now moderately unsafe)
we had to switch the metadata provider and daemon on some kind of flag day to
using SHA256. Since that's somewhat impractical, just allow multiple checksums
to be set on objects and just try to match whatever is given in preference
order.

This also means we can easily transition to other hash types in the future.

The removed API was never present in a tarball release, so not an API break.
2017-06-06 20:06:53 +01:00
Richard Hughes
985ac07ab7 Only decompress the firmware after the signature check
This is moderately more secure, in the event that g_zlib_decompressor_new() has
an exploitable overflow. Spotted by Sebastian Krahmer, many thanks.
2017-06-06 20:02:54 +01:00
Richard Hughes
fe461b618e trivial: Use SHA256 for the store origin
If we're using this for caching it seems a good idea to use a secure cache function.
2017-06-06 14:18:17 +01:00
Richard Hughes
7e206447a8 Use the user cache directory for firmware
We don't need to redownload this multiple times if we have multiple devices
needing the same firmware update.
2017-06-06 12:22:30 +01:00
Richard Hughes
81c7649dd8 libfwupd: Add fwupd_client_get_devices_simple() to return us an array of devices, not results 2017-06-06 11:10:57 +01:00
Richard Hughes
45c1545b0a Add a 'downgrade' command to fwupdmgr
This allows the user to downgrade the firmware on a device.
2017-06-06 09:44:47 +01:00
Richard Hughes
224002ab38 Prompt for the device ID if nothing specified in get-releases
This makes it somewhat easier to use for the common case.
2017-06-06 09:34:46 +01:00
Richard Hughes
6e48871bce trivial: Respect the checksum kind when calling VerifyUpdate 2017-06-05 17:48:13 +01:00
Richard Hughes
e4a100cfee Add a GetReleases() D-Bus call to return all releases for a device
This allows us to downgrade firmware in the future.
2017-06-05 17:42:57 +01:00
Richard Hughes
1642b3b95a Deprecate the old FwupdResult API
It will be removed next time we bump soname.
2017-06-05 17:41:11 +01:00
Richard Hughes
502a2ca64a Do not re-download firmware that exists in the cache 2017-06-05 09:23:10 +01:00
Richard Hughes
01c13d1634 trivial: Use a helper to get the sysconfig dir
This makes testing using a prefix much easier.
2017-06-05 09:10:17 +01:00
Richard Hughes
b8f8db2082 Add support for Microsoft HardwareIDs
This commit provides a new "hwids" subcommand for fwupdmgr that shows the
hardware GUIDs on the local system. It also provides API that plugins can use
to self-disable when a specific HWID does not match.

The GUIDs used in this implementation match that of ComputerHardwareIds.exe
2017-06-04 19:46:36 +01:00
Richard Hughes
f29a6eeb2c trivial: Modernize the daemon private data cleanup 2017-06-02 20:14:14 +01:00
Richard Hughes
0b57806b68 Use the correct user and password for the firmware download 2017-06-02 13:19:08 +01:00
Richard Hughes
90bcd058f0 Return the remote ID when getting updates about hardware 2017-06-02 13:19:08 +01:00
Richard Hughes
d4bdfd6883 Do not copy the origin from the new metadata file
If the system has multiple remotes enabled then simply setting the origin to
the 'last-updated' source is confusing.
2017-06-02 13:19:08 +01:00
Richard Hughes
1b50d960f2 Send the daemon the remote ID when sending updated firmware metadata
This allows us to 'tag' the components with the correct remote ID value, which
then means we can tell where the firmware information has come from when saving
a composite store. It also allows us use the correct username and password in
the future when downloading the firmware blob itself.

Keep the old D-Bus method around to preserve API for existing clients.
2017-06-02 13:19:05 +01:00
Richard Hughes
dfed515573 Allow downloading metadata from more than just the LVFS
Add the concept of 'remotes' that can dropped into /etc and used as firmware
metadata sources. This may be desirable when firmware is only accessable with
a valid support contract or from behind a VPN.
2017-06-02 13:19:05 +01:00
Eric Koegel
23603f0452 Add support for ConsoleKit2
Make systemd and ConsoleKit support an optional compile time flag
with both enabled by default. If both are used, the ifdef/elif will
ensure only the systemd calls are used so there's no conflict.
2017-06-01 09:00:16 +01:00
Timo Gurr
555c634a92 Allow to specify bindir 2017-05-29 16:54:30 +01:00
Richard Hughes
f5f400fe52 trivial: Do not fail to startup if an invalid AppStream file is installed 2017-05-15 10:52:49 +01:00
Richard Hughes
741dc5054a trivial: Use g_autoptr for the fwupdmgr private data 2017-05-08 20:38:17 +01:00
Richard Hughes
df5652ffb5 trivial: Return a sensible error if DownloadURI is intentionaly left blank 2017-05-08 19:06:08 +01:00
Richard Hughes
860640e32a trivial: Fallback to the system-wide config file if running from tree 2017-05-08 19:04:25 +01:00
Richard Hughes
b0fce88754 Do not spew a critial warning when parsing an invalid URI 2017-05-08 19:02:24 +01:00
Richard Hughes
c7f61b62db trivial: Fall back to the system config file
This makes trying the daemon locally much easier.
2017-04-26 10:18:42 +01:00
Mario Limonciello
66132d6b63 disable allowing the daemon test suite running in parallel to plugin test suites 2017-04-20 14:36:36 -05:00
Mario Limonciello
5c1df14d05 fix test suite localstate directory to be a temporary directory 2017-04-20 13:53:19 -05:00
Mario Limonciello
8e0f242d75 fix libexecdir to respect config option (#109) 2017-04-19 10:21:59 -05:00
Richard Hughes
a9a99bdb48 Actually use /usr/libexec/fwupd/fwupd
It appears the enormity of replacing a directory with a file is just too much
for package managers in 2017.

I guess we might ship other things in /usr/libexec/fwupd/ in the future.
2017-04-19 08:50:52 +01:00
Richard Hughes
05ede65e24 Add a config option to allow runtime disabling plugins by name
See https://github.com/hughsie/fwupd/issues/110
2017-04-16 09:11:39 +01:00
Richard Hughes
fc921ae0ce trivial: Fix underlinking in the daemon self tests 2017-04-16 09:10:45 +01:00
Richard Hughes
d1ced695ca Set the source origin when saving metadata
If this is not done the origin from the last file that was read (which might be
from Fedora, for instance) will be used. This isn't hugely important but can
give misleading and confusing unique-id's in gnome-software.
2017-04-15 12:27:26 +01:00
Mario Limonciello
acd288c322 correct test suite compliation failure 2017-04-14 15:04:32 -05:00
Richard Hughes
ee401a17c4 Support proxy servers in fwupdmgr 2017-04-14 19:56:04 +01:00
Richard Hughes
da3ec457c4 Use a 60 second timeout on all client downloads 2017-04-14 19:46:57 +01:00
Richard Hughes
1fdb335025 Remove the automake build system 2017-04-13 18:42:08 +01:00
Richard Hughes
9f0c47b36a Fix the raspberrypi self test code under meson
Also, refactor the common test code to a new source file.
2017-04-13 10:09:33 +01:00
Richard Hughes
87e82a716d trivial: Add the optional valgrind functionality back 2017-04-12 18:21:08 +01:00
Richard Hughes
c388002b72 trivial: Fix under-dep issue with 'ninja test' 2017-04-12 18:08:49 +01:00
Richard Hughes
57746cb839 Add the Meson build system as an alternate to autotools
Automake and autoconf are impossible to fully understand and Meson now provides
everything we need for a much smaller, faster, and more understandable build.

See http://mesonbuild.com/ for more information.
2017-04-12 16:35:18 +01:00
Richard Hughes
24a580f622 trivial: Allow TESTDATADIR to be multiple locations
We need this when srcdir != destdir.
2017-04-12 16:34:17 +01:00
Richard Hughes
d6db6b4d8a trivial: Change the name of a generated file
The meson build system does not let you choose the output name of the resource.
2017-04-12 15:03:11 +01:00
Richard Hughes
d3f4b5a428 trivial: Define the build dir outside the source file 2017-04-12 14:26:14 +01:00
Richard Hughes
4af05398af trivial: Define the plugindir in one central place 2017-04-12 14:18:15 +01:00
Richard Hughes
e643fb283f Create directories in /var/cache as required
These can be nuked at any time by users, so don't rely on the package manager
or installer to create these for us.
2017-04-12 14:09:06 +01:00
Mario Limonciello
6d0aa3dcf7 trivial: make valgrind an optional build dependency
Packagers should still enable it so that tracking lost memory
in plugins is possible, but on some distros some archs don't
have valgrind available which would otherwise prevent fwupd
from running.

This is as problem currently for Debian unstable where some
archs valgrind fails to compile.
2017-02-28 08:22:27 -06:00
Shea Levy
345a7b7f3d Only try to mkdir the localstatedir if we have the right permissions (#96) 2017-02-27 20:41:58 -06:00
Richard Hughes
8738a9f8e4 trivial: Do not use deprecated appstream-glib API 2017-02-27 10:11:29 +00:00
Richard Hughes
576c012d20 Do not dlclose modules when running under valgrind
Without this patch, unloading the module means we can't resolve the symbols
where the memory was leaked.
2017-02-24 09:47:00 +00:00
Richard Hughes
afe00a91e7 trivial: Prevent a critical warning when using --timed-exit 2017-02-21 09:36:49 +00:00
Richard Hughes
6ad951d27c trivial: Do not allow plugins to call _device_add_delay() with the same device
Also, add some unit tests for this codepath.
2017-02-03 10:12:14 +00:00
Richard Hughes
f0a799eabf Only register the D-Bus service when all devices have been added
Poll each plugin, and only register the service when all the delayed coldplug
devices have been added to the device list. This prevents returning an error
when calling "fwupdmgr get-devices" for the very first time.

Resolves: https://github.com/hughsie/fwupd/issues/82
2017-01-18 08:10:32 +00:00
Richard Hughes
ccd78a9703 trivial: Add some sanity guards in plugin-calling functions 2017-01-11 16:57:41 +00:00
Richard Hughes
fcca6f67b2 Include all debug messages when run with --verbose 2017-01-11 16:50:17 +00:00
Richard Hughes
44dee88ad6 trivial: Protect against multiple uses of fu_plugin_alloc_data() in a plugin 2017-01-11 08:31:10 +00:00
Richard Hughes
b21e324c23 trivial: Always call update_cleanup() even when the update action fails
In this case we can't return any failure to cleanup and just log the warning
on the console.
2017-01-11 08:29:17 +00:00
Richard Hughes
57d18229a1 trivial: Add some more documentation for functions used by plugins 2017-01-10 16:09:32 +00:00
Richard Hughes
4190178f94 trivial: Remove the unused fu_plugin_set_name() 2017-01-10 16:09:32 +00:00
Richard Hughes
b082903c5f Add fu_plugin_set_coldplug_delay() to allow hardware to initialize if required 2017-01-10 09:27:08 +00:00
Richard Hughes
f360583f3c trivial: Reschedule a recoldplug after a small delay
This also ensures that we only re-coldplug once if multiple plugins request
the action in the same 1500ms window.
2017-01-08 10:51:57 +00:00
Richard Hughes
f028ba25ac trivial: Do not allow recoldplugging whilst in coldplug itself 2017-01-08 10:45:12 +00:00
Richard Hughes
362d6d7d7d Allow plugins to request that all plugins re-coldplug
This allows a plugin to signal the daemon that something has happened and that
all plugins should wake up connected devices, re-add them all and then put the
devices back to powersave mode. Any duplicate devices will be ignored.
2017-01-07 21:42:17 +00:00
Richard Hughes
46487c944a Add the ability to run a prepare->exec->cleanup on coldplug
The idea here is that plugins can 'wake up' hardware in prepare, and put it
back into powersaving mode when doing cleanup.
2017-01-07 21:26:36 +00:00
Richard Hughes
4852ff8521 Fix the appstream-glib version guards
Resolves: https://github.com/hughsie/fwupd/issues/78
2017-01-04 20:38:29 +00:00
Richard Hughes
7ceb318a27 Add fwupd_result_get_device_version_bootloader()
This functionality is required so that AppStream metadata can check the fwupd
version, the firmware version, bootloader version or a combination of all three.
2016-12-23 11:21:22 +00:00
Richard Hughes
404cc51be3 Allow the metadata to match a version of fwupd and the existing fw version
This allows us to have new markup specified in the MetaInfo or AppStream XML:

  <requires>
    <id compare="ge" version="0.8.1">org.freedesktop.fwupd</id>
    <firmware compare="ge" version="0.1.2"/>
  </requires>

This means that only updates that match these versions will be shown.
2016-12-21 16:16:18 +00:00
Richard Hughes
d4184cf2c6 trivial: Fix a crash when a Unifying USB device is quickly replugged
We need to remove the device from the delayed hash table to ensure we don't
accidently free the helper when it removed a *second* time.
2016-12-21 16:05:19 +00:00
Richard Hughes
2d744f5571 trivial: Fix critical warning when policykit rules are not installed 2016-12-20 09:07:37 +00:00
Richard Hughes
ae3d65f60b Move the device add delay to shared code
This allows us to reuse the logic in other plugins.
2016-12-16 12:41:57 +00:00
Richard Hughes
74702297b2 Move the Option ROM parsing to the Udev plugin 2016-12-15 17:09:38 +00:00
Richard Hughes
29c220db9f Add VerifyUpdate to update the device checksums server-side 2016-12-15 17:09:37 +00:00
Richard Hughes
74d95ab988 trivial: Find the release when verifying and there is no version 2016-12-15 12:55:21 +00:00
Richard Hughes
df3aa3bdc9 trivial: Fix a warning when compiling the ROM fuzzer 2016-12-14 10:52:58 +00:00
Mario Limonciello
02ccecb2be fix dfu plugin loading
failed to open plugin
/usr/lib/x86_64-linux-gnu/fwupd-plugins-2/libfu_plugin_dfu.so:
failed to open plugin:
/usr/lib/x86_64-linux-gnu/fwupd-plugins-2/libfu_plugin_dfu.so:
undefined symbol: dfu_device_upload
2016-12-13 13:19:55 -06:00
Mario Limonciello
e781bb9b64 trivial: fix cosmetic fallout from provider -> plugin
some code (such as libfwupd) still internally refers to provider,
but this will need to be more carefully massaged
2016-12-13 12:25:09 -06:00
Richard Hughes
4232185bec trivial: Remove some false-positive messages when using clang 2016-12-13 16:01:52 +00:00
Richard Hughes
59a9344c1e Move the UPower functionality to a plugin 2016-12-12 16:28:16 +00:00
Richard Hughes
e8fb74a341 Return the pending UEFI update when not on AC power
The user will not be notified about firmware security updates all the time they
are on battery power. It's better to handle this in the client prompting the
user to connect the AC power source.
2016-12-12 16:17:38 +00:00
Richard Hughes
7b8b202786 Add a set of vfuncs that are run before and after a device update 2016-12-12 16:15:03 +00:00
Richard Hughes
31bfba3d1b trivial: Fix an error path when getting firmware results 2016-12-12 15:14:12 +00:00
Richard Hughes
cff38bcb3a Convert the providers to plugins to simplify code and for future features
This is a large commit that removes all the providers and turns them into
plugins. I think having both providers _and_ plugins was super confusing.

Plugins are loaded at runtime so you could in theory develop a new plugin
without putting it in the fwupd source tree, although there are no installed
headers or PC files as I'm not sure it's a good idea at this stage.

This commit moves all the per-provider docs, tests, notes, debug dumps and test
data to plugin-specific directories -- these also allows the plugin author to
"own" more of the source tree so we don't enforce fu- prefixes and the style
guide everywhere.

This allows us to run the same action on all the plugins in the future, so we
could have a prepare(FuPlugin, FuDevice) and cleanup(FuPlugin, FuDevice) run
on *all* plugins, so doing an update using one plugin would allow us to work
around hardware quirks in other plugins.

If I've broken your out-of-tree provider it's trivial to port to the new API
with sed and a fixed up build file. If you need help please let me know.
2016-12-12 12:31:23 +00:00
Richard Hughes
319a6bab12 Move the plugins into plugin-specific directories
This will allow us to add further documentation here in the future.
2016-12-12 11:52:03 +00:00
Richard Hughes
28bbab532a Unexport libebitdo
Nothing is ever going to use this except fwupd, so it makes no sense adding the
extra overhead.
2016-12-09 09:56:31 +00:00
Richard Hughes
bc93e4ab6e Make all providers and plugins share a GUsbContext
This means we don't have more that one thread just watching for the USB
hotplug events. To achieve this split up the coldplug into setup and coldplug
phases and run the enumerate just once in the daemon.
2016-12-08 19:51:55 +00:00
Richard Hughes
7419e9624a trivial: Use the correct index value when getting the local file descriptor
I assume GLib in F25 is more strict about invalid values.
2016-11-22 19:48:06 +00:00
Philip Withnall
bc339aa657 Fix redeclaration of polkit autocleanup functions
ifdef cannot be used to determine if a C symbol is defined, as it’s
evaluated by the preprocessor, before symbols are parsed. Instead, try
to detect whether polkit.h is suitably recent enough to define its own
auto-cleanup functions.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2016-11-22 16:13:33 +00:00
Richard Hughes
39148003a7 trivial: Add a Option ROM fuzzer to use with afl 2016-11-22 14:46:57 +00:00
Richard Hughes
467fdba7ce trivial: Never dump past the ROM size for corrupt option ROMs 2016-11-22 14:36:12 +00:00
Richard Hughes
f33d2c0d64 trivial: Use the entry point to detect NVIDIA ROMs 2016-11-22 14:36:12 +00:00
Richard Hughes
0023912e1c trivial: Be more helpful when failing to detect the firmware kind 2016-11-22 14:36:12 +00:00
Richard Hughes
fb049f75b7 trivial: Make the NULL padding detection safer 2016-11-22 14:36:12 +00:00
Richard Hughes
87764f0cc1 trivial: Refactor to create fu_rom_load_data() 2016-11-22 13:41:16 +00:00
Tsunghan Liu (Robert Liu)
a02bbb1c4e * close USB devices before error returns (#73) 2016-11-21 09:12:28 -06:00
Richard Hughes
f3b1bc6c0c trivial: Check the return code when using g_file_get_contents()
Not actually a bug, but pointed out by Coverity.
2016-11-09 20:14:15 +00:00
Richard Hughes
8072bb6fb7 trivial: Fix pointless header check
It can never be NULL. Found using Coverity.
2016-11-09 19:33:47 +00:00
Richard Hughes
710bf295b2 trivial: Fix two missing break statements
Found using Coverity.
2016-11-09 19:32:26 +00:00
Richard Hughes
e686719e38 dell: Fix a possibly-impossible-to-hit buffer overrun
Found using Coverity.
2016-11-09 19:30:37 +00:00
Richard Hughes
4417c062fe dell: Don't return the address of a stack variable
Found using Coverity.
2016-11-09 19:27:08 +00:00
Richard Hughes
fec2480330 trivial: Fix a critical warning on shutdown 2016-11-04 09:30:14 +00:00
Mario Limonciello
155f054dff trivial: re-enable dell tpm mode switching for system ID 07a4 2016-10-27 13:09:46 -05:00
Mario Limonciello
11dee100af Clarify the test in --help and man page related to offline (#69) 2016-10-19 15:56:48 -05:00
Mario Limonciello
54a5a21757 Show a different error when checking for updates while on battery power (#68) 2016-10-19 14:29:53 -05:00
Mario Limonciello
a91214f545 Enable hardening flags on more binaries 2016-10-14 12:43:02 -05:00
Richard Hughes
73b3bc59ac trivial: fake DFU runtime devices need a manual step 2016-10-14 18:07:34 +01:00
Mario Limonciello
cdf5b86e04 dell: If running in test suite, don't try to get product ID from sysfs
It's possible that the test suite was running in an environment without
bind mounted sysfs.
2016-10-03 14:32:47 -05:00
Mario Limonciello
cd272ac1cf dell: Match on TB16 as well 2016-09-28 15:58:47 -05:00
Richard Hughes
f401775c8a Don't create the UEFI dummy device if the unlock will happen on next boot 2016-09-27 15:35:01 +01:00
Richard Hughes
b0af181b01 Fix an assert when unlocking the dummy ESRT device 2016-09-27 15:27:23 +01:00
Mario Limonciello
3ef952fcea Verify devices support updating in mode they are called.
Providers that have both online and offline update methods don't
do verification that the device actually supports that mode.

This caused problems for Dell TPM devices where if you called
$ fwupdmgr install tpm.cab

It would attempt to use the online stub added in 1d97c8b5.
This would of course fall over requiring you to call with
$ fwupdmgr install tpm.cab --allow-offline

This fix will guarantee that the current install fallback
logic takes into account both device and provider support
for online/offline.
2016-09-20 12:34:42 -05:00
Mario Limonciello
7b2ea4de23 trivial: dell provider: allocate memory for online update SMI call 2016-09-02 14:41:48 -05:00
Richard Hughes
27aad5ac1f Add a fallback for older appstream-glib releases
Fixes: https://github.com/hughsie/fwupd/issues/62
2016-08-29 16:12:26 +01:00
Richard Hughes
4ced466f95 trivial: Fix two more compile warnings 2016-08-26 17:33:10 +01:00
Richard Hughes
2db526d178 Save the unique ID in the pending database
Also, generate something sensible if we're reading the status of an old task.
2016-08-25 15:07:25 +01:00
Richard Hughes
111be7431f trivial: Fix upgrading from an old version of fwupd 2016-08-25 14:40:35 +01:00
Richard Hughes
cec5c1dd88 Do not attempt to add DFU devices not in runtime mode 2016-08-25 13:05:42 +01:00
Richard Hughes
fdf46169f3 Ignore devices that do not add at least one GUID 2016-08-25 13:05:18 +01:00
Richard Hughes
644562e291 Use the correct define prefix for FwupdDeviceFlags
Also, add the compat flags so we don't break API.
2016-08-22 10:30:24 +01:00
Richard Hughes
5c066adf29 Use the SHA1 hash of the local file data as the component origin
This means we have a different cache-id for locally modified .cab files.
This allows us to update the text in the metadata without reloading the client.
2016-08-18 18:38:33 +01:00
Richard Hughes
fa782a3915 Add fwupd_result_get_unique_id()
This allows us to have a unique string that identifies the component and can be
used as a cache key.
2016-08-18 18:36:11 +01:00
Richard Hughes
ee3352ec02 trivial: Remove some dead code
If we do this for SteelSeries devices, we'll need a proper provider.
2016-08-17 17:46:15 +01:00
Richard Hughes
da004cf318 Show a progress notification when installing firmware 2016-08-17 17:46:15 +01:00
Richard Hughes
060af614a5 trivial: Ensure the daemon always returns to IDLE 2016-08-17 17:46:15 +01:00
Richard Hughes
14d176499d Handle the 8Bitdo bootloader in a better way 2016-08-17 17:46:15 +01:00
Richard Hughes
876c007b1a Allow providers to export percentage completion 2016-08-17 17:46:15 +01:00
Richard Hughes
ae87438781 trivial: Don't show the current release in the fwupdmgr get-updates output 2016-08-17 17:46:15 +01:00
Richard Hughes
20003d1c88 Add fwupd_result_remove_device_flag() 2016-08-17 17:46:15 +01:00
William Hua
12082bb863 trivial: link against fwup
If UEFI is disabled, but Dell non-ESRT capsule support enabled, fwupd fails to
link against libfwup as needed.
2016-08-17 09:30:13 -04:00
Richard Hughes
01b9a838b4 Show the vendor flashing instructions when installing 2016-08-16 17:59:32 +01:00
Richard Hughes
4fd38c8f1b trivial: Only show the device error when no devices are due to be updated
Showing a 'no attached hardware matched' then a large list of GUIDs isn't
super helpful.
2016-08-16 17:57:49 +01:00
Richard Hughes
0abde9c39a Fix writing 8Bitdo device firmware 2016-08-16 16:40:58 +01:00
Richard Hughes
535a5b9746 Get the firmware version correctly from 0Bitdo gamepads 2016-08-11 15:36:44 +01:00
Richard Hughes
0bda054f63 trivial: Show a warning when a requested plugin is not loaded 2016-08-11 15:35:30 +01:00
Mario Limonciello
49f789e10f trivial: Dell: for MST and NVM, if a version is set update online not offline 2016-08-01 10:56:35 -05:00
Mario Limonciello
1d97c8b563 trivial: split out dell updates to offline and online
(online still are missing lots of code to be fully functional obviously)
2016-08-01 10:42:40 -05:00
Richard Hughes
33a518a615 Add another compile warning and fix up any build failures 2016-07-27 16:57:36 +01:00
Mario Limonciello
2bb4f005d6 trivial: Remove an extra guint i missed from f192bf0 2016-07-27 10:21:05 -05:00
Richard Hughes
f192bf025a trivial: Switch to compiling with C99 by default
We're already using non-MSVC features like g_autoptr().
2016-07-22 08:41:59 +01:00
Mario Limonciello
94cdd0af27 Add XPS 9250 to Dell TPM modeswitch blacklist 2016-07-20 16:46:22 -05:00
Mario Limonciello
09e2630a59 trivial: re-enable Dell self tests 2016-07-18 09:32:24 -05:00
Mario Limonciello
f93dc38410 trivial: move structs and defines necessary for test suite into header file 2016-07-18 09:31:53 -05:00
Richard Hughes
3ddb6d90b6 trivial: Disable the Dell self tests until they compile 2016-07-18 09:24:14 +01:00
Richard Hughes
0d28b30104 trivial: Fix a couple of compiler warnings 2016-07-18 09:24:03 +01:00
Richard Hughes
9a52c5ed2c Allow blacklisting devices by their GUID
Fixes: https://github.com/hughsie/fwupd/issues/10#issuecomment-233207616
2016-07-18 09:17:02 +01:00
Mario Limonciello
958ead697b Add Dell TPM and TB15/WD15 support via new Dell provider.
This provider will provide support for items that can be flashed
as capsules but aren't present in the ESRT table.

The MST hub and TBT NVM are not yet updatable, but GUIDs are
created to represent them when they are.
2016-07-13 12:30:25 -05:00
Richard Hughes
c8646aff32 Show a more detailed error when installing firmware on the wildcard
Based on a patch by Mario Limonciello, many thanks.
2016-07-04 13:06:17 +01:00
Richard Hughes
bd40528575 Don't make failures critical while checking versions or locked state
Based on a patch by Mario Limonciello, many thanks.
2016-07-04 13:00:54 +01:00
Richard Hughes
3ab17e63dd trivial: Refactor the update helper
No logic changes.
2016-07-04 12:37:22 +01:00
Richard Hughes
346ea88135 trivial: Move a conditional out of the way 2016-07-04 12:31:06 +01:00
Richard Hughes
ce38d94d5e trivial: Get rid of useless internal-only gtk-doc markup 2016-06-29 11:25:25 +01:00
Richard Hughes
a4a2c18ac8 Use the correct firmware blob when installing a composite device update 2016-06-29 11:08:29 +01:00
Richard Hughes
fe5cc9021c Add support for installing against multiple devices from a CAB file
Based on a set of patches from Mario Limonciello <mario_limonciello@dell.com>,
many thanks.
2016-06-29 11:08:29 +01:00
Richard Hughes
db468eef67 trivial: Explicitly tag downgrades in the helper 2016-06-29 10:11:53 +01:00
Richard Hughes
4eb527f873 Use a private gnupg key store
Although it's convenient that you can just log in as root and add another
trusted key, it makes the selinux developers unhappy. Use a private keystore
in /var/lib/fwupd/gnupg to avoid the possibility of a somehow hacked fwupd
being able to export the root gpg secrets if any happened to exist.

If you've trusted keys other than the LVFS for metadata or firmware you'll need
to re-import them into this new location.

See b7f12bd377

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1303531
2016-06-28 09:18:45 +01:00
Richard Hughes
4921bd9770 Ensure the update ID is set when getting local firmware details 2016-06-27 11:17:43 +01:00
Mario Limonciello
8eaadd09d8 In get-details output, display the blob filename
This makes it easier to debug issues with CAB files with multiple
payloads
2016-06-22 15:01:09 -05:00
Mario Limonciello
c2cbd1ab6f trivial: s,cd_,fu_, in a few places in fu-main 2016-06-22 14:59:42 -05:00
Mario Limonciello
2c5ff43556 trivial: correct fu-debug.h definitions 2016-06-22 14:57:43 -05:00
Richard Hughes
d0583ae340 Only claim the DFU interface when required
It appears that some expensive USB sound cards do not like the DFU interface
being claimed at the same time the kernel starts using a different endpoint.

I suspect this is a device bug or limitation in some reference implementation
somewhere, but seeing as we only need the interface when verifying or writing
new firmware the sensible thing to do is not claim it until required.

Fixes: https://github.com/hughsie/fwupd/issues/50
2016-06-08 16:42:49 +01:00