unifying: Show the hardware version when the hardware provides this

This commit is contained in:
Richard Hughes 2017-06-28 14:19:11 +01:00
parent 55e6d9a74f
commit b1af7496b1
3 changed files with 25 additions and 0 deletions

View File

@ -58,6 +58,7 @@ lu_device_peripheral_fetch_firmware_info (LuDevice *device, GError **error)
return FALSE;
}
entity_count = msg->data[0];
g_debug ("firmware entity count is %u", entity_count);
/* get firmware, bootloader, hardware versions */
for (guint8 i = 0; i < entity_count; i++) {
@ -100,6 +101,8 @@ lu_device_peripheral_fetch_firmware_info (LuDevice *device, GError **error)
self->cached_fw_entity = i;
} else if (msg->data[0] == 1) {
lu_device_set_version_bl (device, version);
} else if (msg->data[0] == 2) {
lu_device_set_version_hw (device, version);
}
}

View File

@ -43,6 +43,7 @@ typedef struct
gchar *vendor;
gchar *version_bl;
gchar *version_fw;
gchar *version_hw;
GPtrArray *guids;
LuDeviceFlags flags;
guint8 hidpp_id;
@ -184,6 +185,8 @@ lu_device_to_string (LuDevice *device)
g_string_append_printf (str, "version-bootloader:\t%s\n", priv->version_bl);
if (priv->version_fw != NULL)
g_string_append_printf (str, "version-firmware:\t%s\n", priv->version_fw);
if (priv->version_hw != NULL)
g_string_append_printf (str, "version-hardware:\t%s\n", priv->version_hw);
for (guint i = 0; i < priv->guids->len; i++) {
const gchar *guid = g_ptr_array_index (priv->guids, i);
g_string_append_printf (str, "guid:\t\t\t%s\n", guid);
@ -819,6 +822,21 @@ lu_device_set_version_fw (LuDevice *device, const gchar *version_fw)
priv->version_fw = g_strdup (version_fw);
}
const gchar *
lu_device_get_version_hw (LuDevice *device)
{
LuDevicePrivate *priv = GET_PRIVATE (device);
return priv->version_hw;
}
void
lu_device_set_version_hw (LuDevice *device, const gchar *version_hw)
{
LuDevicePrivate *priv = GET_PRIVATE (device);
g_free (priv->version_hw);
priv->version_hw = g_strdup (version_hw);
}
GPtrArray *
lu_device_get_guids (LuDevice *device)
{
@ -1293,6 +1311,7 @@ lu_device_finalize (GObject *object)
g_free (priv->product);
g_free (priv->vendor);
g_free (priv->version_fw);
g_free (priv->version_hw);
g_free (priv->version_bl);
G_OBJECT_CLASS (lu_device_parent_class)->finalize (object);

View File

@ -152,6 +152,9 @@ void lu_device_set_version_bl (LuDevice *device,
const gchar *lu_device_get_version_fw (LuDevice *device);
void lu_device_set_version_fw (LuDevice *device,
const gchar *version_fw);
const gchar *lu_device_get_version_hw (LuDevice *device);
void lu_device_set_version_hw (LuDevice *device,
const gchar *version_hw);
GPtrArray *lu_device_get_guids (LuDevice *device);
void lu_device_add_guid (LuDevice *device,
const gchar *guid);