fwupd/plugins/nvme/fu-plugin-nvme.c
Mario Limonciello 00fbfd7084 nvme: Drop need of --force flag to update
It's been test to flash succesfully on at least one device now.
2018-09-04 18:02:09 +01:00

50 lines
1.1 KiB
C

/*
* Copyright (C) 2018 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include "fu-plugin-vfuncs.h"
#include "fu-nvme-device.h"
gboolean
fu_plugin_udev_device_added (FuPlugin *plugin, FuUdevDevice *device, GError **error)
{
g_autoptr(FuNvmeDevice) dev = NULL;
g_autoptr(FuDeviceLocker) locker = NULL;
/* interesting device? */
if (g_strcmp0 (fu_udev_device_get_subsystem (device), "nvme") != 0)
return TRUE;
dev = fu_nvme_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;
}
void
fu_plugin_init (FuPlugin *plugin)
{
fu_plugin_add_udev_subsystem (plugin, "nvme");
}
gboolean
fu_plugin_update (FuPlugin *plugin,
FuDevice *device,
GBytes *blob_fw,
FwupdInstallFlags flags,
GError **error)
{
g_autoptr(FuDeviceLocker) locker = NULL;
locker = fu_device_locker_new (device, error);
if (locker == NULL)
return FALSE;
return fu_device_write_firmware (device, blob_fw, error);
}