/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * * Copyright (C) 2018 Richard Hughes * * SPDX-License-Identifier: LGPL-2.1+ */ #include "config.h" #include "fu-plugin.h" #include "fu-plugin-vfuncs.h" #include "fu-wac-device.h" void fu_plugin_init (FuPlugin *plugin) { fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_REQUIRES_QUIRK, FU_QUIRKS_PLUGIN); } gboolean fu_plugin_usb_device_added (FuPlugin *plugin, GUsbDevice *usb_device, GError **error) { g_autoptr(FuWacDevice) device = NULL; g_autoptr(FuDeviceLocker) locker = NULL; device = fu_wac_device_new (usb_device); fu_device_set_quirks (FU_DEVICE (device), fu_plugin_get_quirks (plugin)); locker = fu_device_locker_new (device, error); if (locker == NULL) return FALSE; fu_plugin_device_add (plugin, FU_DEVICE (device)); return TRUE; } gboolean fu_plugin_update (FuPlugin *plugin, FuDevice *device, GBytes *blob_fw, FwupdInstallFlags flags, GError **error) { FuDevice *parent = fu_device_get_parent (device); g_autoptr(FuDeviceLocker) locker = NULL; locker = fu_device_locker_new (parent != NULL ? parent : device, error); if (locker == NULL) return FALSE; return fu_device_write_firmware (device, blob_fw, error); }