trivial: Provide a FuUdevDevice:probe()

Objects deriving from FuUdevDevice() like FuNvmeDevice typically want to do
FuDevice->FuUdevDevice->FuNvmeDevice rather than FuDevice->FuNvmeDevice.

This matches what FuUsbDevice does.
This commit is contained in:
Richard Hughes 2018-09-03 16:31:09 +01:00 committed by Mario Limonciello
parent 1263446b23
commit 13c9ffc322
2 changed files with 9 additions and 0 deletions

View File

@ -86,6 +86,7 @@ fu_udev_device_read_uint16 (const gchar *str)
static gboolean
fu_udev_device_probe (FuDevice *device, GError **error)
{
FuUdevDeviceClass *klass = FU_UDEV_DEVICE_GET_CLASS (device);
FuUdevDevice *self = FU_UDEV_DEVICE (device);
FuUdevDevicePrivate *priv = GET_PRIVATE (self);
const gchar *tmp;
@ -163,6 +164,12 @@ fu_udev_device_probe (FuDevice *device, GError **error)
fu_device_add_guid (device, devid);
}
/* subclassed */
if (klass->probe != NULL) {
if (!klass->probe (self, error))
return FALSE;
}
/* success */
return TRUE;
}

View File

@ -20,6 +20,8 @@ G_DECLARE_DERIVABLE_TYPE (FuUdevDevice, fu_udev_device, FU, UDEV_DEVICE, FuDevic
struct _FuUdevDeviceClass
{
FuDeviceClass parent_class;
gboolean (*probe) (FuUdevDevice *device,
GError **error);
gpointer __reserved[31];
};