Commit Graph

113 Commits

Author SHA1 Message Date
Richard Hughes
63f4038328 Fix some trivial null-correctness spotted by Tartan 2022-12-15 17:27:22 +00:00
Richard Hughes
48557a428e Add fwupd_device_has_checksum() for future usage 2022-10-12 13:02:44 +01:00
Mario Limonciello
17c636686d trivial: libfwupd: move some duplicated code to fwupd-common
Several of the string/integer/time functions are duplicated in multiple
source files for no discernable reason.  Move them into fwupd-common
as private symbols instead.
2022-07-26 20:11:23 +01:00
Richard Hughes
74e9b04b39 trivial: Return a more invalid value if FWUPD_IS_DEVICE() fails
We don't want to return something that's actually the initial value.
2022-07-21 21:27:24 +01:00
Richard Hughes
ac3f7f5521 trivial: Add some checks when adding children and setting the parent 2022-07-21 21:27:24 +01:00
Richard Hughes
7566e56fb5 Add fwupd_device_from_json() for future use 2022-07-18 16:27:59 +01:00
Richard Hughes
9b9799f9c6 Use the correct protocol member when converting to JSON 2022-07-16 21:43:01 +01:00
Gaël PORTAY
9b969de718 Save serial number and instance-ids when trusted
See commit e3016602f8.
2022-06-20 12:57:40 -04:00
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