fwupd/plugins/optionrom/fu-plugin-optionrom.c
Richard Hughes c15c7835be Rename and modernize the udev plugin
The new plugin is called `optionrom` as this is the only type of image that it
parses for verification only. FuUdevDevice is also the generic parent already.
2019-10-09 14:59:54 +01:00

38 lines
885 B
C

/*
* Copyright (C) 2015-2016 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include "fu-plugin-vfuncs.h"
#include "fu-optionrom-device.h"
void
fu_plugin_init (FuPlugin *plugin)
{
fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
fu_plugin_add_udev_subsystem (plugin, "pci");
fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_CONFLICTS, "udev");
}
gboolean
fu_plugin_udev_device_added (FuPlugin *plugin, FuUdevDevice *device, GError **error)
{
g_autoptr(FuOptionromDevice) dev = NULL;
g_autoptr(FuDeviceLocker) locker = NULL;
/* interesting device? */
if (g_strcmp0 (fu_udev_device_get_subsystem (device), "pci") != 0)
return TRUE;
dev = fu_optionrom_device_new (device);
locker = fu_device_locker_new (dev, error);
if (locker == NULL)
return FALSE;
fu_plugin_device_add (plugin, FU_DEVICE (dev));
return TRUE;
}