Coverage Report

Created: 2026-09-14 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/fwupd/libfwupdplugin/fu-hwids-kenv.c
Line
Count
Source
1
/*
2
 * Copyright 2021 Richard Hughes <richard@hughsie.com>
3
 *
4
 * SPDX-License-Identifier: LGPL-2.1-or-later
5
 */
6
7
#define G_LOG_DOMAIN "FuContext"
8
9
#include "config.h"
10
11
#include "fu-hwids-private.h"
12
13
gboolean
14
fu_hwids_kenv_setup(FuContext *ctx, FuHwids *self, GError **error)
15
0
{
16
#ifdef HAVE_KENV_H
17
  struct {
18
    const gchar *hwid;
19
    const gchar *key;
20
  } map[] = {{FU_HWIDS_KEY_BASEBOARD_MANUFACTURER, "smbios.planar.maker"},
21
       {FU_HWIDS_KEY_BASEBOARD_PRODUCT, "smbios.planar.product"},
22
       {FU_HWIDS_KEY_BIOS_VENDOR, "smbios.bios.vendor"},
23
       {FU_HWIDS_KEY_BIOS_VERSION, "smbios.bios.version"},
24
       {FU_HWIDS_KEY_BIOS_RELEASE_DATE, "smbios.bios.reldate"},
25
       {FU_HWIDS_KEY_FAMILY, "smbios.system.family"},
26
       {FU_HWIDS_KEY_MANUFACTURER, "smbios.system.maker"},
27
       {FU_HWIDS_KEY_PRODUCT_NAME, "smbios.system.product"},
28
       {FU_HWIDS_KEY_PRODUCT_SKU, "smbios.system.sku"},
29
       {NULL, NULL}};
30
  for (guint i = 0; map[i].key != NULL; i++) {
31
    g_autoptr(GError) error_local = NULL;
32
    g_autofree gchar *value = fu_kenv_get_string(map[i].key, &error_local);
33
    if (value == NULL) {
34
      g_debug("ignoring: %s", error_local->message);
35
      continue;
36
    }
37
    fu_hwids_add_value(self, map[i].hwid, value);
38
  }
39
#endif
40
41
  /* success */
42
0
  return TRUE;
43
0
}