From cc7c44312bf77a1699186233f2444cf9902e5750 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 14 Feb 2023 09:50:25 +0000 Subject: [PATCH] Correctly fall back to the compatible vendor when FDT vendor is missing Fixes https://github.com/fwupd/fwupd/issues/5530 --- libfwupdplugin/fu-hwids-fdt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libfwupdplugin/fu-hwids-fdt.c b/libfwupdplugin/fu-hwids-fdt.c index af25130ed..675da78ea 100644 --- a/libfwupdplugin/fu-hwids-fdt.c +++ b/libfwupdplugin/fu-hwids-fdt.c @@ -73,12 +73,14 @@ fu_hwids_fdt_setup(FuContext *ctx, FuHwids *self, GError **error) } /* fallback */ - if (g_strv_length(compatible) > 0) - fu_hwids_add_value(self, FU_HWIDS_KEY_MANUFACTURER, compatible[0]); + if (g_strv_length(compatible) > 0) { + g_auto(GStrv) compatible0 = g_strsplit(compatible[0], ",", -1); + fu_hwids_add_value(self, FU_HWIDS_KEY_MANUFACTURER, compatible0[0]); + if (g_strv_length(compatible0) > 1) + fu_hwids_add_value(self, FU_HWIDS_KEY_PRODUCT_NAME, compatible0[1]); + } if (g_strv_length(compatible) > 1) - fu_hwids_add_value(self, FU_HWIDS_KEY_PRODUCT_NAME, compatible[1]); - if (g_strv_length(compatible) > 2) - fu_hwids_add_value(self, FU_HWIDS_KEY_FAMILY, compatible[2]); + fu_hwids_add_value(self, FU_HWIDS_KEY_FAMILY, compatible[1]); if (fu_context_get_chassis_kind(ctx) == FU_SMBIOS_CHASSIS_KIND_UNKNOWN) { if (fu_fdt_image_get_attr_str(FU_FDT_IMAGE(fdt_img), "battery", NULL, NULL)) fu_context_set_chassis_kind(ctx, FU_SMBIOS_CHASSIS_KIND_PORTABLE); -- 2.39.5