Commit Graph

221 Commits

Author SHA1 Message Date
Richard Hughes
9b1349b885 libdfu: Add an explicit 'attach' method
This can also deal with the m-stack quirk in a central place.
2015-11-27 10:54:26 +00:00
Richard Hughes
922dbc721a Rescan the DFU device after firmware has been updated 2015-11-25 15:01:18 +00:00
Richard Hughes
a2b2b1cc68 Export the AppStream ID when returning device results
This allows us to match up the AppStream data we've parsed in gnome-software and the firmware update we've got from fwupd. This means we can get access to some of the data that fwupd doesn't care about, for instance the how-to-upgrade screenshots.
2015-11-25 15:00:51 +00:00
Richard Hughes
6511f5011f f 5d057a8fce 2015-11-25 13:53:10 +00:00
Richard Hughes
a6778df664 f 5d057a8fce 2015-11-25 13:39:54 +00:00
Richard Hughes
291e9a6b19 trivial: Remove some dead code 2015-11-25 10:34:34 +00:00
Richard Hughes
fd50193cd8 trivial: Bump the dep on libcolorhug 2015-11-25 10:33:28 +00:00
Richard Hughes
0bb530be97 libdfu: Copy the platform ID and invalidate the GUsbDevice when removed 2015-11-25 10:27:36 +00:00
Richard Hughes
5d057a8fce Split out the DFU provider as a new file 2015-11-25 10:27:36 +00:00
Richard Hughes
a45d00eb2c Rescan the DFU device after replug to get the new version 2015-11-24 12:35:22 +00:00
Richard Hughes
a3a8f5039c Emit the changed signal after doing an update
This allows the UI to re-request the update list.
2015-11-24 12:35:22 +00:00
Richard Hughes
999e96bbd4 Close DFU devices as soon as possible after the transfer has completed
This allows clients like 'dfu-tool watch' to report the status values correctly.
2015-11-24 12:35:22 +00:00
Richard Hughes
5d6066c002 libdfu: Use signals to propagate device state
Also, add padding to the various class structs so we can add more signals in
the future without breaking ABI.
2015-11-23 10:19:24 +00:00
Richard Hughes
e7aaf39de2 libdfu: Fix multi-interface devices like the Neo Freerunner
The DFU specification specifies that only one of the DFU interfaces has to
export a functional descriptor; I assumed they all had to. Adding support
for this kind of device rapidly turned into a massive restructure and it was
all too complicated anyway.

Reorganise the code so that we can support these kinds of devices and clean up
the API so it's sane and easy to use. This also allows us to generate the
GObject introspection GIR and to also install libdfu as a shared library.

If you've got any comments about the API, please shout now as when 6.0 is
released it will become API and ABI stable.
2015-11-22 21:17:48 +00:00
Richard Hughes
e7ba943cf5 libdfu: Support download and upload to ST DfuSe devices
Also, simplify the general download and upload API now we can deal with
element data in chunks.
2015-11-20 14:14:05 +00:00
Richard Hughes
a941c3a9e9 Use new API available in fwup 0.5
This allows us to schedule a UEFI update without writing a temp file.
2015-11-17 11:06:29 +00:00
Richard Hughes
3ad474214b Ignore the DFU device detach:attach when verifying 2015-11-16 16:36:55 +00:00
Richard Hughes
7d79e580bb Use the same device identification string format as Microsoft
Using our own special version for the input for the GUID calculations means
that the result is not 'googlable'.

This does have the result of changing the GUIDs stored in the 'verify' database
but given the string->GUID function in appstream-glib has also changed to
become standards compliant and that only a few people are using it I felt it
was worth the pain.
2015-11-15 11:02:33 +00:00
Richard Hughes
62633af0db libdfu: Add support for DfuSe firmware
Also, move some shared stuff down from DfuTarget to DfuDevice.
2015-11-14 16:34:09 +00:00
Richard Hughes
a3acd7f711 Add support for updating USB devices with DFU
This adds a private libdfu library and also a small utility program called
dfu-tool.
2015-11-12 17:32:48 +00:00
Richard Hughes
e49b266fd5 trivial: Fix a small critical warning for broken USB devices 2015-11-12 17:32:48 +00:00
Richard Hughes
a48361f82f Use strerror() when printing errors from libfwupdate
Fixes https://github.com/hughsie/fwupd/issues/37
2015-11-12 17:29:30 +00:00
Mario Limonciello
e43cfdcb3d trivial: return for UEFI errors is a decimal not string.
This is for part of issue #38.
2015-11-12 10:06:39 -06:00
Mario Limonciello
6fade1ffea Fix compile error against fwupdate git due to dropped functions.
Closes #37
2015-11-10 18:13:48 -06:00
Richard Hughes
b2fe639940 Use the correct user agent string for fwupdmgr 2015-11-05 08:48:48 +00:00
Richard Hughes
0f89bcd47d trivial: Update the run-fwupd.sh script to include all debugging 2015-10-30 08:49:03 +00:00
Richard Hughes
bb840ceaff Do not assume that the compressed XML data will be NUL terminated
In most cases this is out of chance, but in some random cases the gzip
decompressor decides to reuse the input buffer as a decompression buffer,
which means we get junk data after the decompressed text.

To solve this, just truncate the data at the reported size, and then feed this
into the XML parser.

Fixes: https://github.com/hughsie/fwupd/issues/36
2015-10-30 08:47:28 +00:00
Richard Hughes
f2fca01989 Avoid seeking when reading the file magic during refresh 2015-10-30 08:44:44 +00:00
Richard Hughes
727664fa20 Clear the in-memory firmware store only after parsing a valid XML file
If we send junk to UpdateMetadata() the deamon did something like this:

* Clear existing entries from memory
* Try to load junk file into memory -> error

This left us with no entries in the in-memory store, which required the user to
either keep retrying the 'fwupdmgr update' until it worked or just forced them
to restart fwupd so it loaded the old valid store from the cache file.

Now, only clear the in-memory store and add the new firmware entries when
we know the file has been parsed correctly.

Fixes: https://github.com/hughsie/fwupd/issues/35
2015-10-27 09:56:13 +00:00
Richard Hughes
d9fa06b8c9 trivial: Fix compile with really new versions of appstream-glib 2015-10-18 20:56:16 +01:00
Richard Hughes
709d0114e3 Fix verify-update to produce components with the correct provide values 2015-10-09 12:17:08 +01:00
Richard Hughes
60f48c2013 trivial: Do no ship the old-style cleanup functions 2015-10-08 20:25:51 +01:00
Richard Hughes
3f23650f15 Add profiling data to debug slow startup times 2015-10-08 20:11:57 +01:00
Richard Hughes
d449447fc8 Add the update description to the GetDetails results 2015-10-08 20:11:34 +01:00
Richard Hughes
01d9ac56f0 trivial: Fix make check 2015-10-08 19:57:03 +01:00
Richard Hughes
5d14deff4a Support cabinet archives files with more than one firmware
This allows a vendor to upload a single file that targets different versions of
the same hardware. If this feature is used, the metainfo.xml files *must* have
something like <checksum target="content" filename="firmware2.rom"/> inside the
latest <release> tag.
2015-10-07 17:45:11 +01:00
Richard Hughes
9e1768940d When the version is from the 'FW' extension do not cache the device
This ensures we don't get confused when plugging in and out multiple ColorHug
devices of the same kind but with different version numbers.
2015-10-06 10:37:32 +01:00
Richard Hughes
2b549a6419 trivial: Remove unused struct member 2015-10-06 10:37:32 +01:00
Richard Hughes
2d32b8f0e9 trivial: Include the filename in the error when fwupd.conf is not found
This can happen if the user deletes it from /etc or is running inside a prefix
shell, e.g. jhbuild.
2015-09-28 13:56:42 +01:00
Richard Hughes
a48106f1f8 Show the dotted-decimal representation of the UEFI version number 2015-09-24 10:08:18 +01:00
Richard Hughes
697eb60320 Ensure D-Bus remote errors are registered at fwupdmgr startup
Fixes: https://github.com/hughsie/fwupd/issues/31
2015-09-23 10:04:17 +01:00
Kalev Lember
1f819d7adc offline update: Use glib api for for reading symlinks
readlink() man page says that applications must not rely on it returning
null-terminated links. This commit switches it to use g_file_read_link()
instead that has much nicer API and shields us from readlink() oddities.
2015-09-18 13:54:34 +02:00
Richard Hughes
9d76a877db Fix the error message when no devices can be updated
Fixes: https://github.com/hughsie/fwupd/issues/30
2015-09-17 12:49:07 +01:00
Richard Hughes
f00f1e90ea trivial: Do not show the D-Bus error prefix 2015-09-17 12:48:26 +01:00
Richard Hughes
c2da4b2580 Do not reboot if racing with the PackageKit offline update mechanism
The very first thing the PackageKit updater does is delete this symlink...
2015-09-14 12:15:41 +01:00
Richard Hughes
46832432ea Raise the dep on GLib to support and use g_autoptr() 2015-09-11 13:43:15 +01:00
Richard Hughes
033ccba050 Do not merge the existing firmware metadata with the submitted files
This just causes confusion and makes things hard to debug.
2015-09-10 15:06:26 +01:00
Richard Hughes
2257cee8ee Simplify the version properties on devices to avoid complexity and bugs
This reduces the number of 'version' properties from 4 to 2... We can just use
these consistently to mean 'older' and 'newer'.
2015-09-08 16:53:49 +01:00
Richard Hughes
82856d9843 Add application metadata when getting the updates list 2015-09-08 16:53:49 +01:00
Richard Hughes
51f5083b09 Depend on appstream-glib >= 0.5.0 2015-09-08 16:53:49 +01:00
Richard Hughes
5c35abb1a5 Remove fwsignd, we have the LVFS now 2015-08-27 14:45:42 +01:00
Richard Hughes
98dd640f41 Don't apply firmware if something else is processing the offline update
This also stops us rebooting the computer a few seconds into a PackageKit
offline update...
2015-08-25 14:07:48 +01:00
Mario Limonciello
001558db63 Install fwupd and fwsignd into /usr/lib/$(triplet)/fwupd instead.
Fixes https://github.com/hughsie/fwupd/issues/29
2015-08-14 18:58:33 -05:00
Richard Hughes
ff7e6ceb98 Generate the ColorHug test files at runtime
Also, fix the firmware.inf to have the correct ClassGuid.
2015-08-12 09:09:28 +01:00
Richard Hughes
ba14582ef4 Use the AppStream 0.9 firmware specification by default 2015-08-11 14:34:08 +01:00
Richard Hughes
76d14e1a03 trivial: Use the new libappstream-glib API where available 2015-08-10 09:29:18 +01:00
Richard Hughes
25cf6ab53e Add a Raspberry Pi firmware provider
This queries the current firmware version and also allows online or offline
updating.
2015-08-05 12:14:56 +01:00
Richard Hughes
804c075fee Make parsing the option ROM runtime optional
On devices with a lot of PCI devices this can take a couple of seconds per
device, and if this feature is not desired then disabling it saves system
resources.
2015-08-04 14:56:39 +01:00
Richard Hughes
ac8b192033 Add a simple config file to store the correct LVFS download URI 2015-08-04 14:56:39 +01:00
Richard Hughes
e00d70dabe trivial: Fix compile with AppStreamGlib git master 2015-08-04 14:44:37 +01:00
Richard Hughes
c6ff8fa574 Move the verification and metadata matching phase to the daemon
This allows us to use the functionality in gnome-software or cockpit without
loading the system AppStream store.
2015-08-03 18:00:54 +01:00
Richard Hughes
9985a24a29 Fix validation of written firmware
It turns out comparing sha1{firmware.cab} and sha1{firmware.bin} doesn't match.
Require appstream-glib 0.5.x for the new API required to fix this.
2015-08-03 13:22:34 +01:00
Richard Hughes
d51173d448 Allow no arguments to 'fwupdmgr verify-update' and use sane defaults
Reading firmware from devices and writing to the default path will typically
require authentication.
2015-07-30 19:56:04 +01:00
Richard Hughes
40b6b3f597 Prefer the GUID from the firmware than the device
The firmware may be more generic, and it also allows us to match the GUID then
doing 'verify' on a device with a different device PID than the firmware
actually declares.
2015-07-30 18:41:39 +01:00
Richard Hughes
a7c99b54ea Devices with option ROM are always internal 2015-07-29 15:55:48 +01:00
Richard Hughes
441785d215 trivial: Fix up some harmless lint, no code changes 2015-07-28 14:56:19 +01:00
Richard Hughes
eaa09993b0 trivial: Remove some unused code found by clang 2015-07-28 14:05:26 +01:00
Richard Hughes
fe8b96e74e Do not pre-convert the update description from AppStream XML
This allows the text clients like fwupdmgr to convert to UTF-8 text, and
graphical clients can use the markdown target to ensure the links are made
clickable and paragraphs are presented in the right way.
2015-07-28 13:13:41 +01:00
Richard Hughes
04ee5856d0 Sign the test binary with the correct key
Use the LVFS key rather than my own GPG key, and load that in the self tests.

Fixes https://github.com/hughsie/fwupd/issues/14
2015-07-28 09:47:03 +01:00
Thomas Hindoe Paaboel Andersen
1058ce8155 trivial: remove unused variables 2015-07-27 00:24:01 +02:00
Richard Hughes
31477cf4e7 trivial: Fix make distcheck 2015-07-25 14:51:36 +01:00
Mario Limonciello
3ed5447c92 Reload appstream data after refreshing. 2015-07-23 19:01:15 -05:00
Mario Limonciello
a570bb5195 Fallback to offline install when calling the update argument.
The fallback support is currently only present in the regular
install argument.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2015-07-23 20:40:52 +01:00
Richard Hughes
0950db9340 Only sign files when the entire file has been copied
For large files, EVENT_CREATED gets emitted when the first chunk hits the disk,
not when the file has finished copying. To fix, just wait for the file monitor
to hint that all the changes in the operation have happened and then process
the firmware files.
2015-07-23 09:15:28 +01:00
Richard Hughes
e70f12af9e trivial: Allow parsing unsigned firmware 2015-07-22 17:42:41 +01:00
Richard Hughes
e97261ab3d trivial: rename 'update-metadata' to 'refresh' now we have an 'update' command 2015-07-22 10:36:00 +01:00
Richard Hughes
777917ef21 Add a 'fwupdmgr update' command to update all devices to latest versions
This downloads the latest version of the firmware and applies it to any
matching hardware. e.g.

$ fwupdmgr update
Downloading 1.2.3 for ColorHug...
Updating 1.2.3 on ColorHug...
 * Loading firmware
 * Decompressing firmware
 * Restarting device
 * Writing firmware to device
 * Verifying firmware from device
 * Restarting device
Done!
2015-07-22 10:36:00 +01:00
Richard Hughes
ade063b0df Allow installing an offline UEFI update without --offline
The way this works is we try with the user settings, and if this fails with
NotSupported and the offline flag is unset then we retry the action with a
warning and the flag manually set.

I chose to do this in the client rather than the daemon as I don't want to
encode too many magic rules when we don't know the kind of devices that will
appear in the future.

Fixes the other half of https://github.com/hughsie/fwupd/pull/23
2015-07-22 10:36:00 +01:00
Richard Hughes
63a407ab34 Change the DBus method for installing firmware to 'Install'
It seems a little odd to call it 'Update' when it's being used for downgrading
and reinstalling as well.

As we're making things simpler, just use a single 'install' action in fwupdmgr
rather than 'install', 'update-online', 'update-offline'. We can use the flags
and fallbacks to do the right thing in all cases, and make the typical case
(installing a local file to any matching hardware) simple.

Fixes half of https://github.com/hughsie/fwupd/pull/23
2015-07-22 10:36:00 +01:00
Richard Hughes
7708a0f3fd Move GetUpdates to the daemon
This only returns the latest version, if you actually need to know details
about all versions including downgrades then you still need to load the
AppStream metadata and match devices manually.
2015-07-22 10:35:05 +01:00
Richard Hughes
2b60a33c8f Do not merge existing LVFS metadata
If we change the filenames or hash values we don't want duplicate locations.
2015-07-21 17:19:54 +01:00
Richard Hughes
0b8d461099 trivial: Use the correct error codes when failing to download metadata 2015-07-21 13:27:10 +01:00
Richard Hughes
ebaf7ba035 Allow running fwsignd as the non-root user
...however, most users will still want to use the root user so that the owner
and group are set correctly on the destination files.
2015-07-21 13:24:26 +01:00
Mario Limonciello
28b8151ca0 Don't call efibootmgr after fwupdate.
fwupdate will handle creating the appropriate BootNext entry.
No other changes are needed from fwupd.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2015-07-20 16:21:24 +01:00
Richard Hughes
c7cf166a2f Automatically download metadata using fwupdmgr if required
Using no arguments to 'fwupdmgr update-metadata' means we use the network.
2015-07-20 16:19:20 +01:00
Richard Hughes
691e02d652 Add a simple signing server that operates on .cab files 2015-07-20 15:31:10 +01:00
Richard Hughes
1a886b1b76 Allow cab files to be saved
This means reworking the way we load the file as we have to keep the full
filelist in case we have to re-extract and save each and every file.
2015-07-20 15:31:05 +01:00
Richard Hughes
eec19e760d Add the ability to create detached signatures 2015-07-20 15:30:48 +01:00
Richard Hughes
8ffbd403cb Fix ROM PPID searching to work for all ROMs 2015-07-08 14:28:53 +01:00
Richard Hughes
f720e9fe92 trivial: Do not add an extra ROM section for a NUL padded ROM 2015-07-05 21:13:43 +01:00
Richard Hughes
fe68ff584f Make the version parsing more resilient to corrupt firmware 2015-07-03 12:37:56 +01:00
Richard Hughes
53fc7961dc trivial: Remove a magic number introduced with the last patch 2015-07-01 14:12:15 +01:00
Richard Hughes
885128a7c8 Keep hitting the hardware until it gives us enough ROM 2015-07-01 14:06:28 +01:00
Richard Hughes
5e330b0f0c Fix trivial bug when parsing firmware versions 2015-07-01 13:30:23 +01:00
Richard Hughes
46535115ee trivial: Remove debug info that snuck in 2015-07-01 13:05:01 +01:00
Richard Hughes
5dc6f5ccfc Add a 'verify-update' command to fwupdmgr
This allows us to do something like:

    $ fwupdmgr verify
    e9b8eebd-b5f8-18d4-9fbd-d7da7711985c	f21e1d2c969dedbefcf5acfdab4fa0c5ff111a57	No metadata
    $ find /sys/devices -name rom -exec sudo fwupdmgr verify-update /var/cache/app-info/xmls/fwupd-verify.xml {} \;
    $ fwupdmgr verify
    e9b8eebd-b5f8-18d4-9fbd-d7da7711985c	f21e1d2c969dedbefcf5acfdab4fa0c5ff111a57	OK
    $ # flash the firmware
    $ fwupdmgr verify
    e9b8eebd-b5f8-18d4-9fbd-d7da7711985c	5c946b3950deaf7b102e75be488052afd4dcf16	        Failed: for v013.012.000.019.000000 expected f21e1d2c969dedbefcf5acfdab4fa0c5ff111a57
2015-07-01 12:16:09 +01:00
Richard Hughes
826a5698e3 trivial: Always return the verification hash for the first verify run
The property is being cached, so re-request the list of devices.
2015-07-01 12:07:07 +01:00
Richard Hughes
5e33bccd54 Accept multiple files at one time when using fwupdmgr dump-rom 2015-07-01 11:53:33 +01:00
Richard Hughes
c14aa63c25 Actually parse the PCI option ROM
This allows us to get more details about the firmware.
2015-07-01 11:52:02 +01:00
Richard Hughes
84e1efa65e trivial: Split out the GUID functionality to a new file 2015-07-01 11:50:38 +01:00