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
This commit is contained in:
Richard Hughes 2019-02-12 08:42:41 +00:00
parent 5fe32fe0a0
commit c909ab3f3c
2 changed files with 27 additions and 4 deletions

View File

@ -88,12 +88,16 @@ fu_plugin_udev_device_added (FuPlugin *plugin, FuUdevDevice *device, GError **er
/* runtime */ /* runtime */
if (fu_device_has_custom_flag (FU_DEVICE (device), "is-receiver")) { 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)); fu_device_incorporate (dev, FU_DEVICE (device));
} else { } else {
/* create device so we can run ->probe() and add UFY GUIDs */ /* 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)); fu_device_incorporate (dev, FU_DEVICE (device));
if (!fu_device_probe (dev, error)) if (!fu_device_probe (dev, error))
return FALSE; return FALSE;
@ -131,10 +135,14 @@ fu_plugin_usb_device_added (FuPlugin *plugin, FuUsbDevice *device, GError **erro
return TRUE; return TRUE;
} }
if (fu_device_has_custom_flag (FU_DEVICE (device), "is-nordic")) { 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)); fu_device_incorporate (dev, FU_DEVICE (device));
} else if (fu_device_has_custom_flag (FU_DEVICE (device), "is-texas")) { } 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)); fu_device_incorporate (dev, FU_DEVICE (device));
g_usleep (200*1000); g_usleep (200*1000);
} }

View File

@ -63,6 +63,7 @@ enum {
PROP_PHYSICAL_ID, PROP_PHYSICAL_ID,
PROP_LOGICAL_ID, PROP_LOGICAL_ID,
PROP_QUIRKS, PROP_QUIRKS,
PROP_VERSION_FORMAT,
PROP_LAST PROP_LAST
}; };
@ -82,6 +83,9 @@ fu_device_get_property (GObject *object, guint prop_id,
case PROP_PROGRESS: case PROP_PROGRESS:
g_value_set_uint (value, priv->progress); g_value_set_uint (value, priv->progress);
break; break;
case PROP_VERSION_FORMAT:
g_value_set_uint (value, priv->version_format);
break;
case PROP_PHYSICAL_ID: case PROP_PHYSICAL_ID:
g_value_set_string (value, fu_device_get_physical_id (self)); g_value_set_string (value, fu_device_get_physical_id (self));
break; break;
@ -109,6 +113,9 @@ fu_device_set_property (GObject *object, guint prop_id,
case PROP_PROGRESS: case PROP_PROGRESS:
fu_device_set_progress (self, g_value_get_uint (value)); fu_device_set_progress (self, g_value_get_uint (value));
break; break;
case PROP_VERSION_FORMAT:
fu_device_set_version_format (self, g_value_get_uint (value));
break;
case PROP_PHYSICAL_ID: case PROP_PHYSICAL_ID:
fu_device_set_physical_id (self, g_value_get_string (value)); fu_device_set_physical_id (self, g_value_get_string (value));
break; break;
@ -2196,6 +2203,14 @@ fu_device_class_init (FuDeviceClass *klass)
G_PARAM_STATIC_NAME); G_PARAM_STATIC_NAME);
g_object_class_install_property (object_class, PROP_PROGRESS, pspec); 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, pspec = g_param_spec_object ("quirks", NULL, NULL,
FU_TYPE_QUIRKS, FU_TYPE_QUIRKS,
G_PARAM_READWRITE | G_PARAM_READWRITE |