Commit Graph

1104 Commits

Author SHA1 Message Date
Richard Hughes
f6838c738a trivial: Add fu_udev_device_get_slot_depth()
We'll need this for another plugin soon.
2019-01-29 22:28:09 +00:00
Richard Hughes
82f7499faa udev-device: Add a utility function for debugging
I normally have to remember this trick every time I write a new plugin, so
include this in the common code to be called by plugins as required.
2019-01-29 22:28:09 +00:00
Richard Hughes
57d8afd659 udev-device: Set the firmware revision automatically 2019-01-29 22:28:09 +00:00
Richard Hughes
297e1e8971 udev-device: Set the serial number automatically 2019-01-29 22:28:09 +00:00
Richard Hughes
caadb7b66a udev-device: Fall back to non-database model and vendor values 2019-01-29 22:28:09 +00:00
Richard Hughes
fc4fbfc98f udev-device: Fix critical warning if the device has no parent 2019-01-29 22:28:09 +00:00
Mario Limonciello
32241f4256 Add support for an UpdateMessage and display it in tools
The idea is that if the user should know something about the device update
"after" it's succesfully completed then the plugin can set `UpdateMessage`
for the device and a client can show it.

An example would be a device that doesn't reboot on its own and the user
needs to power cycle it manually.
2019-01-29 13:59:07 -06:00
Mario Limonciello
1e35e4c22d fu-tool: Port the get-updates command over
Now that there is actually support to load non-static information
(at least from fwupd perspective) it makes sense to support this
command in both tools.
2019-01-29 09:21:54 -06:00
Mario Limonciello
4f24d0bae3 When using directory remote type automatically generate metadata
The CAB files will be parsed upon `fwupd`/`fwupdtool` startup and
loaded into the daemon.
2019-01-29 09:21:54 -06:00
Mario Limonciello
706ab43898 libfwupd: Add support for new remote type "directory"
This remote will be used for automatically building metadata based
on files in a directory.
2019-01-29 09:21:54 -06:00
Richard Hughes
fd826c10a0 trivial: Print some debugging when ignoring a remote path 2019-01-29 09:21:54 -06:00
Richard Hughes
0af196151d Ensure cabinet archives always have a container checksum
This means the correct hash is shown when using `fwupdtool get-details` and
will be useful for future functionality.
2019-01-28 13:00:30 +00:00
Richard Hughes
7185828163 Add support for a per-release source and details URL
The source URL allows us to comply with our various obligations when shipping
firmware built from GPL licensed sources. The details URL allows vendors to
include a link to a full HTML details page about the specific release.
2019-01-28 12:59:39 +00:00
Richard Hughes
9d3ec971f3 trivial: Never allow the content checksum filename to be NULL
This prevents a critical warning from gcab_folder_get_file_by_name()
2019-01-28 12:53:53 +00:00
Mario Limonciello
51ddf18faa When generating a CAB Silo use the prefix "components"
This makes fu_engine_get_details use a more standard prefix.
2019-01-28 09:52:37 +00:00
Mario Limonciello
3f243a9e9e fu-util/fu-tool: sync up reboot and shutdown behavior
It's currently a hodge podge of commands that can install files not
always invoking a reboot or shutdown.

Move the actual code into `fu-util-common.c` and make sure that all
`install` and `update` functions call it now.
2019-01-22 21:06:08 +00:00
Richard Hughes
650eea91ee trivial: Fix a build issue when building with high -j values 2019-01-22 10:17:51 +00:00
Aleksander Morgado
37b985c156 Check if plugin changed after the device attaches or detaches
If the device is rebooted into a different shape, the plugin managing
the device may also be different.

This would be the case for plugins that just subclass the update_detach()
method, and leave to other plugins the actual required update procedure.
2019-01-20 20:01:40 +00:00
Richard Hughes
f425d29a28 Show a console warning if loading an out-of-tree plugin
Fixes https://github.com/hughsie/fwupd/issues/950
2019-01-19 07:26:20 +00:00
Richard Hughes
f803964e37 Add _NEEDS_SHUTDOWN flag for devices
Some devices require the system to be powered down and back up, rather than
just being "warm" rebooted.
2019-01-17 16:35:34 +00:00
Richard Hughes
a958e1c32f trivial: Fix a potential type-check warning when setting SUPPORTED
We can't use the superclassed FuDevice as this was created as a FwupdDevice.
2019-01-17 16:35:34 +00:00
Richard Hughes
fc90f3954e nvme: Add flag to support manually aligning the firmware to the FWUG value
This is required for drives from Phison.
2019-01-16 13:14:50 +00:00
Mario Limonciello
46aaee8cec fu-tool: Add support for an 'update' command to fwupdtool
This will perform updates with all currently present metadata.

It is "intended" for usage with local metadata repositories referring
to local files.

fwupdtool however does also support fetching a file from the web
and if the metadata refers to the file on the web it should also work
for that.
2019-01-11 12:59:00 +00:00
Mario Limonciello
baa5af4504 trivial: fu-engine: Clarify the message when no releases are available 2019-01-11 12:59:00 +00:00
Richard Hughes
3548186462 trivial: Make fu_common_dump_raw() more useful for debugging 2019-01-08 12:53:57 +00:00
Mario Limonciello
46bb4e91a0 fu-main: remove incompatible locale error message
Downgrade this to debugging instead. (Fixes: #912)
2019-01-08 11:03:50 +00:00
Richard Hughes
f692b71dc4 Correctly migrate the history database
I forgot to include the protocol column when migrating to v3, so create a v4
which ignores the sqlite error if the column already exists.

Fixes https://github.com/hughsie/fwupd/issues/909
2019-01-04 09:34:56 +00:00
Richard Hughes
8be03791c7 Log an error if started with an incompatible locale
Test with `LC_ALL=de_DE.UTF-8 ./src/fwupd`
2018-12-26 06:28:30 -06:00
Richard Hughes
0e17e6d030 Fix building with -Wl,-z,defs
This allows us to find undefined references at compile time, not runtime.
2018-12-25 16:10:54 -06:00
Richard Hughes
319dbcba5c trivial: Don't show 'Update Duration: 49710 days'
Use the correct 'value not found' constant for xb_node_get_attr_as_uint().
2018-12-18 17:59:09 +00:00
Richard Hughes
6055200822 trivial: Check the GUID length before attempting to parse it
It seems uuid_parse() doesn't check the string length before unwrapping the
string into a struct. Fixes:

    Conditional jump or move depends on uninitialised value(s)
       at 0x4E0C358: uuid_is_null (isnull.c:44)
2018-12-18 08:33:12 +00:00
Richard Hughes
45bbfc9cae Check the device checksum as well as the content checksum during verify
Some firmware has a different on-device checksum to the hash of the firmware
file itself. This may be because:

 * The content is not a binary file, e.g. Intel HEX or SREC
 * Only part of the firmware is flashed, e.g. ignoring the bootloader section
 * The device checksum is calculated using another method entirely, e.g. PCR0

It's also made complicated as there may be more than one 'correct' device
checksum in some cases, but nothing that a union query can't solve.
2018-12-14 19:23:04 +00:00
Richard Hughes
08435169a7 trivial: Don't invalidate the current checksums for fw that requries a reboot 2018-12-14 19:23:04 +00:00
Richard Hughes
1812fc783b trivial: Clear the device checksums only if the plugin implements verify()
This ensures that plugins that set the checksums in probe() or setup() don't
get erased by accident.
2018-12-14 19:23:04 +00:00
Richard Hughes
4e886a4dfa Include the device checksum and update protocol in the historydb 2018-12-14 19:23:04 +00:00
Richard Hughes
b56015ed3f uefi: Add the PCR0 value as the device checksum for system firmware
We can't actually access the UEFI ROM from userspace, but the PCR0 is a hash
built from the ROM itself. We could use this value to ensure the firmware has
been written correctly, and that the PCR0 matches the expected value specified
in the metadata.
2018-12-14 19:23:04 +00:00
Richard Hughes
adeb2b1b4d Add new API to get the release protocol from the metadata 2018-12-14 18:15:01 +00:00
Richard Hughes
9729584ee4 Allow plugins to define support for a 'well-known' protocol
Future metadata from the LVFS will set the protocol the firmware is expected to
use. As vendors love to re-use common terms like DFU for incompatible protocols,
namespace them with the controlling company ID with an approximate reverse DNS
namespace.

This also allows more than one plugin to define support for the same protocol,
for instance rts54hid+rts54hub and synapticsmst+dell-dock.
2018-12-14 18:15:01 +00:00
Richard Hughes
4badf7e963 Do not allow a GUID of zero
The tempation for OEMs or ODMs to ship firmware updates matching a NULL GUID is
too fragile to allow -- even with CHID restrictions.
2018-12-07 09:05:30 -06:00
Richard Hughes
bccaaf5194 Add shared functionality for reading and writing with O_NONBLOCK
Two plugins have very similar code already, and we're about to get another.
2018-12-06 14:07:02 +00:00
Richard Hughes
d583bafb6f Only run attach and detach if the device is in the wrong mode 2018-12-06 08:22:00 +00:00
Richard Hughes
e59cb9af01 trivial: Add fu_common_dump_raw() 2018-12-05 15:09:56 +00:00
Richard Hughes
55b8a249e0 Sanitize the version if the version format has been specified
This converts versions like 'v1.2.3' into a valid semver of '1.2.3' if the
version format has been set.

Fixes https://github.com/hughsie/fwupd/issues/884
2018-12-05 07:07:35 -06:00
Richard Hughes
a07a80ff28 Fix a regression when doing GetReleases on unsupported hardware
With an indexed string we can return INVALID_ARGUMENT before the query actually
runs if nothing matches.
2018-12-03 15:02:48 +00:00
Richard Hughes
1af48b13bd Correctly parse format the version numbers correctly using old metadata
The LVFS has always sent components with the old-style '<metadata>' section
rather than the new-style '<custom>' section, and when using appstream-glib
we just accepted either element name. Although the LVFS has just been fixed to
use the new name, old metadata might be present on the system already.

When all clients have downloaded new metadata we can revert this, perhaps in a
couple of weeks time. Until then, the belt-and-braces approach is probably a
good idea.

Fixes https://github.com/hughsie/fwupd/issues/874
2018-12-03 12:14:28 +00:00
Richard Hughes
7cd6d363e1 trivial: Correctly calculate the erase length for all locales
This fixes the progressbar going crazy when using fwupdmgr with zh_CN.
2018-11-30 15:56:28 +00:00
Richard Hughes
cd2fb3eb62 Check plugins set error on failure
Don't explode in a ball of flames if the plugin forgets to set the error.
This at least gives us a journal warning when a plugin goes crazy.
2018-11-30 15:22:17 +00:00
Richard Hughes
1d9c2ec1f1 trivial: Allow loading archives ignoring the path 2018-11-30 12:18:37 +00:00
Richard Hughes
74f976a821 Add more standard USB identifier GUIDs
These are specified in:
https://docs.microsoft.com/en-us/windows-hardware/drivers/install/standard-usb-identifiers
2018-11-29 13:26:53 +00:00
Richard Hughes
596f93f50b trivial: Allow calling fu_device_has_guid() with non-GUID text
This matches the behaviour of fu_device_add_guid().
2018-11-28 17:53:21 +00:00