Commit Graph

24 Commits

Author SHA1 Message Date
Mario Limonciello
eb8b38f158 trivial: storage: Update minimum Dell component ID length to 6
Dell storage team confirmed that nothing shorter than 6 will ever
be used and so this heuristic can be stronger.
2019-02-08 16:06:14 +00:00
Richard Hughes
6b78d64987 Add fwupd_guid_from_string() to drop dep on uuid
This also allows us to write mixed-endian structures and adds tests. As part of
this commit we've also changed the API of something that's not yet been in any
tarball release, so no pitchforks please.
2019-02-06 14:48:04 +00:00
Richard Hughes
1bc432316a Defer the InstanceID->GUID hashing until after setup
This allows hardware from OEMs to *not* match generic firmware supplied by the
device manufacturer. The idea being, that the OEM will supply firmware that
will actually work on the device.

Based on a patch from Mario Limonciello, many thanks.
2019-02-06 08:02:16 +00:00
Richard Hughes
b8c30b8732 Do not use efivar just to print a mixed endian GUID 2019-02-04 15:19:57 +00:00
Richard Hughes
65c81921b6 Add fu_device_add_instance_id() and prefer explicit conversion 2019-02-04 15:19:57 +00:00
Mario Limonciello
8efc5a3633 nvme: Add an extra check for Dell plugins to avoid false positives
Component IDs should always be ASCII characters.
None have been reported yet, but this should still help to prevent them.
2019-02-04 10:39:20 +00:00
Mario Limonciello
b05a918431 trivial: Move GUID testing into fu-common-guid
This allows other plugins to use this part of the routine.
2019-02-04 10:39:20 +00:00
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
4a68fd60dc nvme: Add the needs-shutdown quirk to Phison NVMe drives
Affected drives should have a prominent statement in the update description,
possibly even the first line so it shows up by default in the updates panel.
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
Richard Hughes
d5f0da15ab nvme: Support FGUID to get the SKU GUID 2019-01-16 13:14:50 +00:00
Richard Hughes
a9d81cfb10 nvme: Support FWUG to get the write block size 2019-01-16 13:14:50 +00:00
Richard Hughes
1eaf71c91b nvme: Add trivial comment to clarify address bitshifting 2019-01-16 13:14:50 +00:00
Richard Hughes
fa8b7aab0a nvme: Check the return code of the admin passthru ioctl
This meant we reported firmware update success when the image format or offset
was incorrect.
2019-01-15 16:26:30 +00:00
Richard Hughes
a3d5712b9f Allow setting the version format from a quirk entry 2018-10-11 07:54:01 +01:00
Richard Hughes
05cbb7245c Don't use AppStream-glib for version helpers
Refactor the imported version format code now we now longer need to stick to
the API mistakes of libappstream-glib.
2018-10-11 07:54:01 +01:00
Mario Limonciello
55ab100334 trivial: nvme: Allow quirking the NVME write block size 2018-10-02 14:30:02 -05:00
Richard Hughes
19ba35c844 nvme: Initialize the buffer before reading the contents
Fixes a complaint from valgrind.
2018-09-19 18:17:38 +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
4cfe6b7002 nvme: Convert known version formats to semvers 2018-09-04 20:37:17 +01:00
Richard Hughes
cfc1768bf0 nvme: Always require a reboot after applying firmware
Although we can apply the firmware at runtime, the new firmware isn't going to
be running until the PCIe device has been re-enumerated.
2018-09-04 18:02:09 +01: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
1263446b23 trivial: Add a 'setup' vfunc that is used after open()
The setup() is the counterpart to probe(), the difference being the former needs
the device open and the latter does not.

This allows objects that derive from FuDevice, and use FuDeviceLocker to use
open() and close() without worrying about the performance implications of
probing the hardware, i.e. open() now simply opens a file or device.
2018-09-03 19:56:26 -05:00
Richard Hughes
cdb01590e0 nvme: Add a new plugin to update NVMe hardware 2018-08-26 19:42:28 +01:00