From c909ab3f3c80444b4f5488f81153347dc7e95fdd Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 12 Feb 2019 08:42:41 +0000 Subject: [PATCH] unifying: Fix regression when recovering from failed flash The unifying version numbers are of the form 'RQR24.00_B0000' which means we have to force the plugin to 'plain' version format to avoid stripping out the non-semver chars. Fixes https://github.com/hughsie/fwupd/issues/1018 --- plugins/unifying/fu-plugin-unifying.c | 16 ++++++++++++---- src/fu-device.c | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/plugins/unifying/fu-plugin-unifying.c b/plugins/unifying/fu-plugin-unifying.c index 58af46f35..d8b4d56fe 100644 --- a/plugins/unifying/fu-plugin-unifying.c +++ b/plugins/unifying/fu-plugin-unifying.c @@ -88,12 +88,16 @@ fu_plugin_udev_device_added (FuPlugin *plugin, FuUdevDevice *device, GError **er /* runtime */ if (fu_device_has_custom_flag (FU_DEVICE (device), "is-receiver")) { - dev = g_object_new (FU_TYPE_UNIFYING_RUNTIME, NULL); + dev = g_object_new (FU_TYPE_UNIFYING_RUNTIME, + "version-format", FU_VERSION_FORMAT_PLAIN, + NULL); fu_device_incorporate (dev, FU_DEVICE (device)); } else { /* create device so we can run ->probe() and add UFY GUIDs */ - dev = g_object_new (FU_TYPE_UNIFYING_PERIPHERAL, NULL); + dev = g_object_new (FU_TYPE_UNIFYING_PERIPHERAL, + "version-format", FU_VERSION_FORMAT_PLAIN, + NULL); fu_device_incorporate (dev, FU_DEVICE (device)); if (!fu_device_probe (dev, error)) return FALSE; @@ -131,10 +135,14 @@ fu_plugin_usb_device_added (FuPlugin *plugin, FuUsbDevice *device, GError **erro return TRUE; } if (fu_device_has_custom_flag (FU_DEVICE (device), "is-nordic")) { - dev = g_object_new (FU_TYPE_UNIFYING_BOOTLOADER_NORDIC, NULL); + dev = g_object_new (FU_TYPE_UNIFYING_BOOTLOADER_NORDIC, + "version-format", FU_VERSION_FORMAT_PLAIN, + NULL); fu_device_incorporate (dev, FU_DEVICE (device)); } else if (fu_device_has_custom_flag (FU_DEVICE (device), "is-texas")) { - dev = g_object_new (FU_TYPE_UNIFYING_BOOTLOADER_TEXAS, NULL); + dev = g_object_new (FU_TYPE_UNIFYING_BOOTLOADER_TEXAS, + "version-format", FU_VERSION_FORMAT_PLAIN, + NULL); fu_device_incorporate (dev, FU_DEVICE (device)); g_usleep (200*1000); } diff --git a/src/fu-device.c b/src/fu-device.c index 7b62fb26a..a6a1b2dd9 100644 --- a/src/fu-device.c +++ b/src/fu-device.c @@ -63,6 +63,7 @@ enum { PROP_PHYSICAL_ID, PROP_LOGICAL_ID, PROP_QUIRKS, + PROP_VERSION_FORMAT, PROP_LAST }; @@ -82,6 +83,9 @@ fu_device_get_property (GObject *object, guint prop_id, case PROP_PROGRESS: g_value_set_uint (value, priv->progress); break; + case PROP_VERSION_FORMAT: + g_value_set_uint (value, priv->version_format); + break; case PROP_PHYSICAL_ID: g_value_set_string (value, fu_device_get_physical_id (self)); break; @@ -109,6 +113,9 @@ fu_device_set_property (GObject *object, guint prop_id, case PROP_PROGRESS: fu_device_set_progress (self, g_value_get_uint (value)); break; + case PROP_VERSION_FORMAT: + fu_device_set_version_format (self, g_value_get_uint (value)); + break; case PROP_PHYSICAL_ID: fu_device_set_physical_id (self, g_value_get_string (value)); break; @@ -2196,6 +2203,14 @@ fu_device_class_init (FuDeviceClass *klass) G_PARAM_STATIC_NAME); g_object_class_install_property (object_class, PROP_PROGRESS, pspec); + pspec = g_param_spec_uint ("version-format", NULL, NULL, + FU_VERSION_FORMAT_UNKNOWN, + FU_VERSION_FORMAT_LAST, + FU_VERSION_FORMAT_UNKNOWN, + G_PARAM_READWRITE | + G_PARAM_STATIC_NAME); + g_object_class_install_property (object_class, PROP_VERSION_FORMAT, pspec); + pspec = g_param_spec_object ("quirks", NULL, NULL, FU_TYPE_QUIRKS, G_PARAM_READWRITE |