Commit Graph

38 Commits

Author SHA1 Message Date
Richard Hughes
1a24d9da90 Include the device VID and PID in the calculation of the device-id
If we plug in USB device A, remove it, plug in USB device B and get the same
autogenerated string all kinds of nasty things happen to the history database.
2018-02-01 14:01:50 +00:00
Richard Hughes
6b0e5c4f21 Fix a daemon warning when using fwupdmgr get-results
The FwupdRelease needs to be manually added in some circumstances.
2018-01-28 21:51:41 +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
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
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
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
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
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
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
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
4eada34d4c trivial: Fix up introspection issues in the daemon code 2017-10-05 10:32:05 +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
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
27e5df2fe7 trivial: Fix a tiny leak in the daemon 2017-09-14 11:28:50 +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
6fae095fe5 trivial: Less whitespace in the output of fu_device_to_string() 2017-09-11 10:29:52 +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
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
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
ce38d94d5e trivial: Get rid of useless internal-only gtk-doc markup 2016-06-29 11:25:25 +01:00
Richard Hughes
043bc15f6d Allow metainfo files to match only specific revisions of devices
For example, matching on the 'USB\VID_0000&PID_0000&REV_0000' GUID rather than
the 'USB\VID_0000&PID_0000' GUID.

This is now possible as we can specify multiple GUIDs for a device.
2016-05-17 18:46:25 +01:00
Richard Hughes
feb8965d2e Add fu_device_get_alternate()
This daemon-only method allows a provider to associate one device with another.

Inspired by a patch by Mario Limonciello <mario_limonciello@dell.com>.
2016-05-17 16:27:59 +01:00
Richard Hughes
f76956be6f Make the device display name nicer 2016-04-15 09:02:28 +01:00
Richard Hughes
8e9762d174 Use libfwupd inside the daemon
This also entailed writing some compat defines to work on FuDevices without
casting each one to a FwupdResult.
2016-03-17 10:14:17 +00:00
Richard Hughes
1d96633198 Add 'Created' and 'Modified' properties on managed devices
This allows us to show suitable UI in GNOME Software when reporting historical
firmware updates.
2016-01-27 13:25:45 +00:00
Richard Hughes
b1b59d83cb Do not misdetect different ColorHug devices
Allow devices to have a specific device ID, which also matches other equivalent
IDs from other providers

This allows the user to plug in one type of device, and not match a different
cached device that also matches the same provider.
2016-01-06 13:20:58 +00: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
d7dba98e68 Move boolean properties on the device to a set of flags
This is much less boilerplate and allows us to expand in the future.
2015-05-05 16:02:20 +01:00
Richard Hughes
f910ac9541 trivial: Also export the status enum codes 2015-03-19 10:54:06 +00:00
Richard Hughes
0e883ee815 Add and document the offline-update lifecycle
Also allow providers to override getting and clearing the last update status.
2015-03-19 10:31:23 +00:00
Richard Hughes
bbac6d7932 Return some more fields when returning data about firmware files 2015-03-12 11:41:20 +00:00
Richard Hughes
1b5ea3517d Add an OnlyOffline property for devices that cannot do online updates 2015-03-04 22:30:12 +00:00
Richard Hughes
1ffde6cd72 Return the device properties when calling GetDevices()
This allows us to discover a version number, and other things.
2015-03-02 22:44:58 +00:00
Richard Hughes
8dbfb1c478 Add initial build files and enough code to launch a simple D-Bus daemon 2015-02-26 18:16:40 +00:00