mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-16 21:14:38 +00:00

This pivots the data storage so that the group is used as the preconditon and the key name is used as the parameter to change. This allows a more natural data flow, where a new device needs one new group and a few few keys, rather than multiple groups, each with one key. This also allows us to remove the key globbing when matching the version format which is often a source of confusion. Whilst changing all the quirk files, change the key prefixes to be more familiar to Windows users (e.g. Hwid -> Smbios, and FuUsbDevice -> DeviceInstanceId) who have to use the same IDs in Windows Update. This also allows us to pre-match the desired plugin, rather than calling the probe() function on each plugin.
38 lines
867 B
C
38 lines
867 B
C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
|
*
|
|
* Copyright (C) 2017 Richard Hughes <richard@hughsie.com>
|
|
*
|
|
* SPDX-License-Identifier: LGPL-2.1+
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include "fu-plugin.h"
|
|
#include "fu-plugin-vfuncs.h"
|
|
|
|
#include "fu-nitrokey-device.h"
|
|
#include "fu-nitrokey-common.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(FuDeviceLocker) locker = NULL;
|
|
g_autoptr(FuNitrokeyDevice) device = NULL;
|
|
|
|
/* open the device */
|
|
device = fu_nitrokey_device_new (usb_device);
|
|
locker = fu_device_locker_new (device, error);
|
|
if (locker == NULL)
|
|
return FALSE;
|
|
|
|
/* success */
|
|
fu_plugin_device_add (plugin, FU_DEVICE (device));
|
|
return TRUE;
|
|
}
|