Commit Graph

99 Commits

Author SHA1 Message Date
Richard Hughes
4655e028a6 Copy more properties when doing FuUdevDevice->incorporate
We're supposed to be copying any private data derived during ->probe()
so we can create a superclass with the same attributes.
2022-06-14 21:01:57 +01:00
Richard Hughes
fc2da47b69 Remove fu_strtoull_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
9d33c29e92 Split out the string helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
b3f69c1c47 scsi: Use the SCSI target to correctly set the physical ID
We don't want to include the SCSI LUN in the physical ID, as this is a
logical concept not relating to the hardware device.

Use the UDev devtype to find the 'correct' parent.
2022-06-11 11:06:01 +01:00
Richard Hughes
165ce50614 Revert "Speed up daemon startup by 650ms"
This reverts commit a7642a7b7e.

I forgot that we need the TYPE, DRIVER and most importantly subsystem
for PossiblePlugin quirk matches. We need something more subtle.
2022-06-08 07:56:45 +01:00
Richard Hughes
d6fd08e3a5 Remove some deprecated API 2022-06-03 13:47:11 -05:00
Richard Hughes
0cbcac93cd Rename fu_udev_device_ioctl_full() as we broke ABI 2022-06-03 13:47:11 -05:00
Richard Hughes
029d2895bd Rename fu_udev_device_pread_full() as we broke ABI 2022-06-03 13:47:11 -05:00
Richard Hughes
a7642a7b7e Speed up daemon startup by 650ms
Reading properties from drm_dp_aux1 and drm_dp_aux2 took 700ms, and
we're never going to match any GUIDs as the vendor and model IDs are
both unset.
2022-06-01 15:50:13 +01:00
Richard Hughes
5031ea2c6b trivial: Fix introspection warning when building docs 2022-05-06 08:38:01 +01:00
Richard Hughes
2fcdf352df Retry the device ioctl for EAGAIN 2022-04-29 15:01:32 +01:00
Richard Hughes
c1ff3e67af trivial: Fix a small memory leak when getting the udev parent 2022-03-25 21:12:53 +00:00
Richard Hughes
c4ca026294 Allow devices to build instance IDs more easily
Provide a device instance builder that allows plugins to easily
create multiple instance IDs based on parent attributes.

Also fix a lot of the instance ID orders, so that we add more generic
IDs first, and more specific IDs after.
2022-03-03 09:13:29 +00:00
Richard Hughes
e3583793ed trivial: Fix two potential critical warnings when finding devices 2022-02-24 17:07:32 +00:00
Richard Hughes
bd02edcc43 trivial: Add missing API wrapper for future functionality 2022-02-21 18:57:20 +00:00
Richard Hughes
308e03a6f4 Sanitize the instance ID parts more carefully
The only users of `SERIO\FWID` and `I2C\NAME` are already 'safe' and
the device GUIDs should all be unchanged.

There are no current users of the `MTD\NAME` instance IDs, and these
are the ones that may be more unpredictable and in need of sanity.
2022-02-18 08:23:39 +00:00
Richard Hughes
c71ca76235 Add a plugin to set GPIOs for the duration of an update 2022-02-16 14:01:07 +00:00
Richard Hughes
2e99055d1e trivial: Add some more annotations for language bindings 2022-01-03 22:46:23 +00:00
Richard Hughes
736a56ccee Use the UDev devtype for quirk matching 2021-12-30 16:35:04 +00:00
Richard Hughes
60d266cbc6 Add support for UF2 devices
A UF2 device exposes a VFAT block device (sometimes called a Mass
Storage Device) which has a virtual file called `INFO_UF2.TXT` where
metadata can be read. It may also have a the current firmware exported
as a file called `CURRENT.UF2` which is in a 512 byte-block UF2 format.

Writing any file to the MSD will cause the firmware to be written.
Sometimes the device will restart and the volume will be unmounted
and then mounted again. In some cases the volume may not “come back”
until the user manually puts the device back in programming mode.

Match the block devices using the VID*PID, UUID or label, and then
create a UF2 device which can be used to flash firmware.

Note: We only read metadata from allow-listed IDs to avoid causing
regressions on non-UF2 volumes. To get the UUID and label you can
use commands like:

    udisksctl info -b /dev/sda1
2021-12-21 10:06:18 +00:00
Richard Hughes
36d7077f65 Add a new plugin to handle MTD devices 2021-11-05 20:01:51 +00:00
Richard Hughes
ed419416d5 Allow setting the FuUdevDevice bind-id at runtime 2021-11-05 15:00:10 +00:00
Richard Hughes
02222a58c8 trivial: Add FU_UDEV_DEVICE_FLAG_OPEN_SYNC for future code 2021-11-05 08:01:25 +00:00
Richard Hughes
0fb2ef3aae trivial: Add fu_udev_device_seek() for future code 2021-11-05 08:01:25 +00:00
Richard Hughes
fe180cbf5d trivial: Add fu_udev_device_get_sysfs_attr_uint64() for future code 2021-11-05 08:01:25 +00:00
Richard Hughes
bd43647554 Add fu_usb_device_new_with_context() helpers
This means the context is set at construction time, which is much less
fragile than setting the context manually.
2021-10-15 15:59:34 +01:00
Richard Hughes
852a6dbdc2 redfish: Handle EPERM when testing devices with a IPMI device
Fixes https://github.com/fwupd/fwupd/issues/3849
2021-10-12 19:12:57 -05:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
f42b44e427 Remove some deprecated API 2021-08-06 19:49:53 +01:00
Richard Hughes
6288886d35 trivial: Fix up an introspection tag added recently 2021-06-28 19:45:19 +01:00
Peter Marheine
6281467a6b Add a fu_udev_device_get_children_with_subsystem function
This works like fu_udev_device_get_siblings_with_subsystem but returns child
devices of self rather than siblings.
2021-06-28 10:09:52 +01:00
Richard Hughes
9a2e10c639 trivial: Export the matching fu_udev_device_set_dev() 2021-06-24 14:22:08 +01:00
Richard Hughes
a2682eeed9 Add a device flag to ignore the serial number
On some devices the serial number is junk, or not set. On some Wacom
hardware reading the serial LangID puts the device into Android mode...
2021-06-18 14:03:54 +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
99f40fa7a7 Add a FuI2cDevice to abstract I²C devices 2021-05-18 14:29:28 +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
5523ac46e3 trivial: Fix introspection markup for a new symbol 2021-04-20 15:09:58 +01:00
Richard Hughes
d42bd85059 trivial: Do not use the deprecated allow-none introspection argument
It's been deprecated since 2014... oops.

https://blogs.gnome.org/desrt/2014/05/27/allow-none-is-dead-long-live-nullable/
2021-04-19 14:46:42 +01:00
Peter Marheine
da9a07ba8f FuUdevDevice: add get_siblings_with_subsystem function
This function returns a list of sibling devices that have a chosen subsystem,
allowing callers to perform a limited walk of the device tree to locate related
devices.
2021-04-15 06:53:06 +01:00
Norbert Kamiński
76e19930a8 fwupd port for BSD distros
Signed-off-by: Norbert Kamiński <norbert.kaminski@3mdeb.com>
2021-03-19 17:05:09 +00:00
Richard Hughes
2d84386034 Remove unused, unsafe and deprecated functions from libfwupdplugin
Keeping *internal* API and ABI compatibility makes working with an already
complex codebase more mentally demanding than it needs to be.

Remember: plugins should be in-tree and upstream! If your out of tree plugin
stops working then it should be upstream.

The public-facing libfwupd will remain API and ABI stable for obvious reasons.
2021-03-09 15:47:56 +00:00
Richard Hughes
bf3732f994 pixart: Use the bluetooth UUID to set the logical ID
This means you can have more than one device attached to the same controller.
2021-03-03 15:36:42 +00:00
Richard Hughes
0b6c67a3e3 trivial: Set the GError when calling ioctl() on an un-opened device
I've not yet worked out the real bug, but it was unexpected to crash the daemon
when open failed, rather than for a critical misuse of the API.
2021-02-25 16:21:56 +00:00
Richard Hughes
253e6e4f17 Add a backend ID to the device
This is typically a Linux sysfs path or USB platform ID and is used in a
different way to the physical ID. The physical ID is only set for some devices
after setup() and depends on the subsystem list, and this would not be defined
for devices that do not match a plugin.

This also fixes an regression where the FuDeviceList fails to match the new
FuUdevDevice device in fu_device_list_get_by_guids_removed() and instead
silently gets 'fixed up' only if FWUPD_DEVICE_FLAG_NO_GUID_MATCHING is not set.

This also allows us to move the various backends device caches to FuBackend as
we now have a suitable ID that is for just the backend to use.
2021-02-24 16:49:42 +00:00
Richard Hughes
2e1245728f Call the superclass directly from subclassed devices
This allows a device subclass to call the parent method after doing an initial
action, or even deliberately not call the *generic* parent method at all.

It also simplifies the plugins; you no longer have to remember what the plugin
is deriving from and accidentally clobber the wrong superclass method.
2021-02-18 16:18:34 +00:00
Ricardo Cañuelo
a92026476b Fix ioctl error checking
fu_udev_device_ioctl() interprets the return value of ioctl() as the
error cause and generates a misleading error message (permission
denied).
Fix it to use errno for error checking and reporting.
2021-02-15 16:39:00 +01: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