From aa95f30390dd5f3da3820db03a79fec34c810ac3 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 15 Mar 2021 13:02:05 +0000 Subject: [PATCH] Allow reading the PciBcrAddr quirk from flashrom devices --- plugins/flashrom/fu-flashrom-device.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/flashrom/fu-flashrom-device.c b/plugins/flashrom/fu-flashrom-device.c index af4f757ba..c991c5748 100644 --- a/plugins/flashrom/fu-flashrom-device.c +++ b/plugins/flashrom/fu-flashrom-device.c @@ -30,9 +30,29 @@ fu_flashrom_device_init (FuFlashromDevice *self) fu_device_add_icon (FU_DEVICE (self), "computer"); } +static gboolean +fu_flashrom_device_set_quirk_kv (FuDevice *device, + const gchar *key, + const gchar *value, + GError **error) +{ + if (g_strcmp0 (key, "PciBcrAddr") == 0) { + guint64 tmp = fu_common_strtoull (value); + fu_device_set_metadata_integer (device, "PciBcrAddr", tmp); + return TRUE; + } + g_set_error_literal (error, + G_IO_ERROR, + G_IO_ERROR_NOT_SUPPORTED, + "no supported"); + return FALSE; +} + static void fu_flashrom_device_class_init (FuFlashromDeviceClass *klass) { + FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass); + klass_device->set_quirk_kv = fu_flashrom_device_set_quirk_kv; } FuDevice *