Commit Graph

28 Commits

Author SHA1 Message Date
Richard Hughes
90112823df udev: Manally call fu_device_setup() to convert the instance IDs
The udev plugin is somewhat special as it uses a non-subclassed FuDevice that
never gets 'opened'.

This means that we never automatically call fu_device_setup() and thus the
instance IDs are not converted into GUIDs before the device is added.
2019-02-07 11:26:50 -06: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
b91efa6c38 trivial: Cast to FuDevice from FuUdevDevice 2019-01-17 16:35:34 +00:00
Richard Hughes
e671c05771 trivial: Do not use AsProfile
The profiling data is of limited use, and better data can be obtained using
kcachegrind and massif. Additionally, the profile samples were the cause of the
small RSS growth over time, when in reality the data would only be shown when
the verbose switch is used at daemon startup.
2018-09-18 06:23:25 -05:00
Richard Hughes
ebae396d0a udev: Do not add devices after a small delay
Now devices can have multiple GUIDs and do not share platform IDs there is
really no point waiting to add the device.

This allows us to remove a whole lot of code for this now-unused functionality.
2018-09-09 16:24:30 +01:00
Richard Hughes
a76f12dbfa trivial: Use fu_udev_device_set_physical_id() in udev plugin 2018-09-09 16:24:30 +01:00
Richard Hughes
c125ec02ed Clarify what the platform ID actually is by renaming it
It wasn't hugely clear what the platform ID was actually meant to represent. In
some cases it was being used like a physical ID, in others it was a logical ID,
and in others it was both. In some cases it was even used as a sysfs path.

Clear up all the confusion by splitting the platform ID into two parts, an
optional *physical* ID to represent the electrical connection, and an optional
*logical* ID to disambiguate composite devices with the same physical ID.

Also create an explicit sysfs_path getter for FuUdevDevice to make this clear.

This allows WAIT_FOR_REPLUG to always work, rather than depending on the order
that the GUIDs were added, and that the kernel would always return the same
sysfs path (which it doesn't have to do, especially for hidraw devices).
2018-09-06 16:22:46 +01:00
Richard Hughes
2aa3360d46 trivial: Include appstream-glib.h in the main plugin header 2018-09-04 08:22:39 -05:00
Richard Hughes
ff704414f6 Use superclassed versions of FuDevice when calling udev_added() and usb_added()
The daemon creates a baseclass of either FuUsbDevice or FuUdevDevice when the
devices are added or coldplugged to match the quirk database and to find out
what plugin to run.

This is proxied to plugins, but they are given the GUsbDevice or GUdevDevice and
the FuDevice is just thrown away. Most plugins either use a FuUsbDevice or
superclassed version like FuNvmeDevice and so we re-create the FuDevice, re-probe
the hardware, re-query the quirk database and then return this to the daemon.

In some cases, plugins actually probe the hardware three times (!) by creating
a FuUsbDevice to get the quirks, so that the plugin knows what kind of
superclass to create, which then itself probes the hardware again.

Passing the temporary FuDevice to the plugins means that the simplest ones can
just fu_plugin_device_add() the passed in object, or create a superclass and
incorporate the actual GUsbDevice and all the GUIDs.

This breaks internal plugin API but speeds up startup substantially and deletes
a lot of code.
2018-09-04 08:22:39 -05:00
Richard Hughes
dd5b43f63b udev: Use the new FuUdevDevice abstraction 2018-08-26 19:42:28 +01:00
Richard Hughes
95227a919d trivial: Move gudev to the core plugin deps 2018-08-26 19:38:58 +01:00
Richard Hughes
02c90d8a03 Remove the unused Emacs indenting headers from all source files
Fixes https://github.com/hughsie/fwupd/issues/636
2018-08-09 12:48:04 +01:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Philip Withnall
8e2ca90509 udev: Fix a double-free bug
That GUdev function returns a const gchar*, not an allocated pointer, so
don’t try to autofree it. This would have caused a crash (I only
observed it as a compiler warning with
-Wincompatible-pointer-types-discards-qualifiers).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-30 13:44:41 +00:00
Richard Hughes
ca0bc0adf7 udev: Don't delimit the platform ID now it is hashed anyway 2017-11-27 18:07:53 +00:00
Richard Hughes
82c63d3d65 udev: Don't register for USB events to later ignore them 2017-11-27 18:07:53 +00:00
Richard Hughes
0de86eca3d udev: Do not match USB devices, even with a GUID set
Prevents a warning about PRODUCT not existing when the usb plugin is disabled.
2017-09-13 14:05:46 +01:00
Richard Hughes
c1c2fec6f5 Add optional icons to each device
This allows us to show the devices in a GUI with a nice icon. Some of the icon
mappings are not perfect and I'll be asking the GNOME designers for some
additions to the icon specification.

Custom vendor icons can also be specified, and /usr/share/fwupd/icons would be
a good place to put them. If vendor icons are used they should show a physical
device with the branding, rather than just the vendor logo.
2017-09-11 17:27:35 +01:00
Richard Hughes
ed34991bd8 Do not unlock devices when doing VerifyUpdate
We used to do this dance to avoid reading the Option ROM on hardware by default
(some faulty hardware would crash...) but now we're doing the verify update in
the daemon there's no need to split this into two steps.

Fixes: https://github.com/hughsie/fwupd/issues/149
2017-06-22 10:37:10 +01:00
Richard Hughes
fd381cc96e Add the ability to restrict the firmware installation to specific vendor IDs
This allows us to fix https://github.com/hughsie/lvfs-website/issues/4
2017-06-12 20:22:25 +01:00
Richard Hughes
e76ed8eb0d trivial: Generate more than just SHA1 OptionROM checksums 2017-06-07 08:02:41 +01:00
Richard Hughes
68cc00c7e9 Allow multiple checksums on devices and releases
Although we supported other hashes than SHA1 (which is now moderately unsafe)
we had to switch the metadata provider and daemon on some kind of flag day to
using SHA256. Since that's somewhat impractical, just allow multiple checksums
to be set on objects and just try to match whatever is given in preference
order.

This also means we can easily transition to other hash types in the future.

The removed API was never present in a tarball release, so not an API break.
2017-06-06 20:06:53 +01:00
Richard Hughes
48d23f7bb0 Fix a refcounting issue in the udev plugin
Objects are returned from the cache with transfer:none.

Hopefully fixes https://github.com/hughsie/fwupd/issues/86
2017-02-03 14:17:07 +00:00
Richard Hughes
04042a10e8 trivial: Fix a tiny memory leak in the Udev plugin
Also, fix some method prefixes to match the plugin name.
2016-12-16 14:03:08 +00:00
Richard Hughes
598a40d746 trivial: Use a delay when adding Udev devices
There might be a better plugin to claim these than the generic fallback.
2016-12-16 12:41:57 +00:00
Richard Hughes
561c457149 trivial: Use unique profiling IDs in plugins 2016-12-15 12:55:21 +00:00
Richard Hughes
4232185bec trivial: Remove some false-positive messages when using clang 2016-12-13 16:01:52 +00:00
Richard Hughes
cff38bcb3a Convert the providers to plugins to simplify code and for future features
This is a large commit that removes all the providers and turns them into
plugins. I think having both providers _and_ plugins was super confusing.

Plugins are loaded at runtime so you could in theory develop a new plugin
without putting it in the fwupd source tree, although there are no installed
headers or PC files as I'm not sure it's a good idea at this stage.

This commit moves all the per-provider docs, tests, notes, debug dumps and test
data to plugin-specific directories -- these also allows the plugin author to
"own" more of the source tree so we don't enforce fu- prefixes and the style
guide everywhere.

This allows us to run the same action on all the plugins in the future, so we
could have a prepare(FuPlugin, FuDevice) and cleanup(FuPlugin, FuDevice) run
on *all* plugins, so doing an update using one plugin would allow us to work
around hardware quirks in other plugins.

If I've broken your out-of-tree provider it's trivial to port to the new API
with sed and a fixed up build file. If you need help please let me know.
2016-12-12 12:31:23 +00:00