wacomhid: Use the parent device name for sub-modules

This commit is contained in:
Richard Hughes 2018-06-15 13:47:00 +01:00
parent 4910b244d1
commit d99190f626
3 changed files with 11 additions and 2 deletions

View File

@ -706,6 +706,7 @@ static gboolean
fu_wac_device_add_modules_bluetooth (FuWacDevice *self, GError **error)
{
GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self));
g_autofree gchar *name = NULL;
g_autofree gchar *version = NULL;
g_autoptr(FuWacModule) module = NULL;
guint8 buf[] = { [0] = FU_WAC_REPORT_ID_GET_FIRMWARE_VERSION_BLUETOOTH,
@ -720,9 +721,12 @@ fu_wac_device_add_modules_bluetooth (FuWacDevice *self, GError **error)
}
/* success */
name = g_strdup_printf ("%s [Legacy Bluetooth Module]",
fu_device_get_name (FU_DEVICE (self)));
version = g_strdup_printf ("%x.%x", (guint) buf[2], (guint) buf[1]);
module = fu_wac_module_bluetooth_new (usb_device);
fu_device_add_child (FU_DEVICE (self), FU_DEVICE (module));
fu_device_set_name (FU_DEVICE (module), name);
fu_device_set_version (FU_DEVICE (module), version);
return TRUE;
}
@ -779,6 +783,7 @@ fu_wac_device_add_modules (FuWacDevice *self, GError **error)
/* get versions of each submodule */
for (guint8 i = 0; i < buf[3]; i++) {
guint8 fw_type = buf[(i * 4) + 4] & ~0x80;
g_autofree gchar *name = NULL;
g_autofree gchar *version = NULL;
g_autoptr(FuWacModule) module = NULL;
@ -788,12 +793,18 @@ fu_wac_device_add_modules (FuWacDevice *self, GError **error)
switch (fw_type) {
case FU_WAC_MODULE_FW_TYPE_TOUCH:
module = fu_wac_module_touch_new (usb_device);
name = g_strdup_printf ("%s [Touch Module]",
fu_device_get_name (FU_DEVICE (self)));
fu_device_add_child (FU_DEVICE (self), FU_DEVICE (module));
fu_device_set_name (FU_DEVICE (module), name);
fu_device_set_version (FU_DEVICE (module), version);
break;
case FU_WAC_MODULE_FW_TYPE_BLUETOOTH:
module = fu_wac_module_bluetooth_new (usb_device);
name = g_strdup_printf ("%s [Bluetooth Module]",
fu_device_get_name (FU_DEVICE (self)));
fu_device_add_child (FU_DEVICE (self), FU_DEVICE (module));
fu_device_set_name (FU_DEVICE (module), name);
fu_device_set_version (FU_DEVICE (module), version);
break;
case FU_WAC_MODULE_FW_TYPE_MAIN:

View File

@ -170,7 +170,6 @@ static void
fu_wac_module_bluetooth_init (FuWacModuleBluetooth *self)
{
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
fu_device_set_name (FU_DEVICE (self), "Bluetooth Module");
}
static void

View File

@ -92,7 +92,6 @@ static void
fu_wac_module_touch_init (FuWacModuleTouch *self)
{
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
fu_device_set_name (FU_DEVICE (self), "Touch Module");
}
static void