Commit Graph

105 Commits

Author SHA1 Message Date
Richard Hughes
3e0a4dc1c3 Be smarter and include less header files per source file 2022-06-14 14:36:52 -05:00
Richard Hughes
8ebad4ea75 Specify an enumerated problem when inhibiting devices
This allows us to make smarter policy decisions in the future on when
to show unavailable updates. It also means we can show translated
text in the frond-end clients.

Only problems the user can "fix" are enumerated. For example, opening
the laptop lid, or charging the device battery.
2022-05-19 13:09:03 -05:00
Richard Hughes
679628c091 Move the battery attributes down into libfwupd
This allows us to show the current value and the threshold on the CLI
and in tools like gnome-firmware.
2022-05-18 07:16:07 +01:00
Robert Ancell
cd437175b4 Fix copy-paste error in documentation for FwupdDevice::version_format 2022-05-08 16:44:41 -05:00
Richard Hughes
7eca2b2b16 Export the version_lowest_raw value correctly 2022-04-23 10:28:16 +01:00
Richard Hughes
f595b39f39 Add InstanceIds to the JSON device dump
Fixes https://github.com/fwupd/fwupd/issues/4501
2022-04-07 13:17:00 +01:00
Richard Hughes
4ce9972ce5 trivial: Don't leak the string even on critical failure
Not totally sure this is worthwhile, but it triggered a failure in the
RHEL tests we do - and it's less work to fix it than argue.
2022-03-08 16:01:16 +00:00
Richard Hughes
f63080fbe2 Allow assigning issues to devices
This allows us to show in the tools if a device is currently affected
by a specific CVE. For instance, we could inform the user that a device
requires a critical firmware update that is being actively exploited.

Note, this also means we can show the user a firmware update is now
required, even though the firmware may not be available on the LVFS.

Also show the issue in the `fwupdmgr security` output, e.g.

    There are devices with issues:
      Samsung — MZVLB2T0HALB-000L7:
       • CVE-2022-12345
       • CVE-2022-54321
2022-02-16 14:50:29 +00:00
Richard Hughes
c4590f2f25 trivial: Add some missing g_return_val_if_fail() calls 2022-01-03 22:46:23 +00:00
Richard Hughes
2e99055d1e trivial: Add some more annotations for language bindings 2022-01-03 22:46:23 +00:00
Richard Hughes
3356d8a844 trivial: Add fwupd_device_get_root() for GUI use 2021-12-17 16:44:57 +00:00
Richard Hughes
60612294f5 trivial: Use the device GType as the debugging root
We never show the fu_device_to_string() output to the user in normal
circumstances, and it's super useful for it to match the FuFirmware
format.
2021-11-15 14:59:52 +00:00
Gaël PORTAY
918006f8d5 trivial: Codespell fixes 2021-10-14 09:09:54 -05:00
Richard Hughes
5c60beae29 Show HSiLevel=0 attributes in JSON security output
Don't assume zero always means 'skip'.
2021-09-02 21:41:11 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
ac56353f05 trivial: Use the correct enum name
No functional change
2021-07-30 16:35:24 +01:00
Richard Hughes
f1f0180433 trivial: Add notify::update-error support 2021-07-16 21:11:53 +01:00
Richard Hughes
9829103be9 trivial: Add some generic helpers for building JSON 2021-07-15 20:34:07 +01:00
Richard Hughes
f7a23d7c88 Allow the client to watch for more property changes 2021-07-13 14:56:01 +01:00
Richard Hughes
f34c5d4eb6 trivial: Print the GUIDs in the order they were added
This fixes the self tests on old GLib versions as the order of the
GHashTableIter is not guaranteed to be stable.
2021-07-09 15:43:45 +01:00
Richard Hughes
5343a4a083 Export the build timestamp from plugins 2021-07-08 16:31:07 +01:00
Richard Hughes
121cffe7d8 trivial: Export fwupd_device_has_icon()
This is useful in self tests.
2021-07-06 16:47:50 +01:00
Richard Hughes
7b209bb2c1 Watch for children added or removed after setup has been completed
Some devices may 'discover' child devices during poll, rather than the
more usual case of adding them as children during setup.
2021-07-02 13:27:10 +01:00
Richard Hughes
eb8e43d942 libfwupd: Show unconverted GUIDs when debugging
Add a suffix to any GUIDs that are currently unconverted InstanceIDs.

This makes plugin development much easier as you can now see why GUID
quirks in the subclassed ->setup() are not matching.
2021-06-17 16:22:06 +01:00
Richard Hughes
a02c1073f2 trivial: Fix up some of the developer docs
And add some missing content as requried.
2021-06-11 09:39:03 +01:00
Mario Limonciello
1e17457b16 Allow building the documentation with gi-docgen and gtk-doc
Until gi-docgen is declared stable support either of them.
This effectively means that hand builds and CI builds will use
gi-docgen, but distro builds use gtk-doc-tools.
2021-06-09 22:21:53 +01:00
Richard Hughes
8246e43174 trivial: Convert FwupdDevice to use @self 2021-05-10 14:35:10 +01:00
Richard Hughes
20ef071b3c trivial: Style fixes to lots of gtk-doc 2021-05-10 14:35:10 +01:00
Richard Hughes
89d45a0d91 trivial: Standardize on introspection for @error and @cancellable
Also standarize on `Returns:` for the result.
2021-04-28 16:19:50 +01:00
Richard Hughes
63bc42eace Add a composite ID that is used to identify all devices in the same physical package 2021-04-22 16:27:04 +01:00
Richard Hughes
64416bcd0a trivial: Mark more functions arguments as 'nullable' 2021-04-19 14:46:42 +01:00
Richard Hughes
6ef551a39e Never allow plugins to add a NULL GUID
Not fixing, but should help with https://github.com/fwupd/fwupd/issues/3156
2021-04-19 14:46:42 +01:00
Richard Hughes
b3f9841924 Support more than one protocol for a given device
Devices may want to support more than one protocol, and for some devices
(e.g. Unifying peripherals stuck in bootloader mode) you might not even be able
to query for the correct protocol anyway.
2021-03-01 16:14:36 +00:00
Richard Hughes
7b2621c3de trivial: Incorporate by merging the device flags
If any flags are set in the baseclass (e.g. FuDevice) then incorporating with
a FuUdevDevice or FuUefiDevice is not going to merge the flags.
2021-02-23 14:33:30 +00:00
Richard Hughes
f722b30205 libfwupd: Fix adding multiple flags to devices
Ignore the request if _all_ the new flags are already set, not just any of them.
2021-02-22 22:48:56 +00:00
Richard Hughes
382524d82f trivial: Fix potential crash when doing crazy things
Fix the asan crash when feeding the value back into itself, e.g

    fu_firmware_set_version (firmware, fu_firmware_get_version (firmware));
2021-01-28 14:13:59 +00:00
Richard Hughes
5bb9cf9392 Fix a crash when using fwupdtool
The docs for `fwupd_device_get_children()` make it very clear that only the
parent should be assigned. Also add a warning to `fwupd_device_add_child()`
explaining it is for internal daemon use only.
2021-01-27 15:48:43 +00:00
Richard Hughes
5d534970cb trivial: Show a warning if the child device gets unref'd from the parent
Should not happen, but bugs will be bugs.
2021-01-27 15:48:43 +00:00
Richard Hughes
a378c2902b trivial: Add a GObject property for update-state
This allows us to use ::notify when required.
2021-01-13 09:13:05 +00:00
Richard Hughes
5c9b1fcc81 Only include the start year in the copyright header
The end year is legally and functionally redundant, and more importantly causes
cherry-pick conflicts when trying to maintain old branches. Use git for history.
2021-01-07 14:48:16 +00:00
Richard Hughes
eddaed0c11 Allow specifying more than one VendorID for a device
Asking the user for the UID mapping isn't working very well, as it requires lots
of manual handholding. It also doesn't work very well when the device vendor
does not actually have a PCI ID or if the vendor has split into two entities.

Just use the OUI address as an additional VendorID and match any of the device
IDs against any of the metadata-supplied values.
2021-01-04 22:30:20 +00:00
Richard Hughes
4d781ae14f Revert "If incorporating the version from a subclass, also set the verfmt too"
This reverts commit c0dee27b6d.
2020-11-07 07:57:50 +00:00
Richard Hughes
11832e10af trivial: Fix a warning when generating the GtkDoc pages 2020-11-06 13:18:25 +00:00
Richard Hughes
c0dee27b6d If incorporating the version from a subclass, also set the verfmt too
Otherwise we could be left with a device that sets the expected verfmt in the
plugin _init(), but would not be inherited from the subclass. It would have:

    Version:              0.2
    VersionFormat:        triplet

...which makes no sense.
2020-11-06 13:04:34 +00:00
Richard Hughes
e612078b8d Remove the duplicate parent-child data in FwupdDevice and FuDevice
The FuDevice derives from FwupdDevice, and yet both objects have a (potentially
different) parent and set of children. This is super confusing, and just not
required.

Removing the duplication also removes a sizable memory leak when hotplugging
composite devices as the parent was ref'd by the child and the child was ref'd
by the parent in different objects... Fun to debug...
2020-10-31 13:19:11 +00:00
Richard Hughes
460c4b75fe Add the concept of firmware 'branches'
This allows a device to identify with different streams, for instance a Lenovo
laptop could have a coreboot firmware or a AMI firmware. The GUIDs would be the
same, but switching firmware would only be done rarely and very carefully.

Another example would be switching the Broadcom BCM57xx nework adaptors from the
vendor nonfree firmware with a signed PXE image, to the free software reverse
engineered driver with no PXE support (and thus no signed DXE) at all.

It is expected firmware would have additional metadata something like this:

    ...
    <branch>sdcc</branch>
    <description>
      <p>
        This is an alternate firmware built by the community using only free
        software tools.
      </p>
    </description>
    <requires>
      <id compare="ge" version="1.5.0">org.freedesktop.fwupd</id>
      <client>switch-branch</client>
    </requires>
    ...

Additionally, alternate branch firmware will not be returned for clients not
setting the FWUPD_FEATURE_FLAG_SWITCH_BRANCH before the GetReleases request.
2020-09-30 18:33:00 +01:00
Richard Hughes
7c8a830659 libfwupd: Add async versions of the library for GUI tools
Rather than force the GUI to interact with fwupd using threads, provide
async versions so thay can be run without blocking the UI thread.
2020-09-03 15:46:57 +01:00
Richard Hughes
4fd4b982ac Support LVFS::UpdateImage in GUI clients
The idea here is that we can show the user both a string and an optional
line-art image when the update has completed. The line art is often more well
understood for non-English speakers.
2020-06-26 12:29:54 +01:00
Richard Hughes
0bc65b5e97 Export the device state as part of the D-Bus interface 2020-04-07 15:04:01 +01:00
Mario Limonciello
96117d19df trivial: 1.3.9->1.4.0
We decided to branch at 1.3.8 and backport fix only things for 1_3_X.
So bump all the new stuff to 1.4.0 (which will be next release)
2020-02-28 10:17:56 -06:00