synaptics-mst: Only probe devices that have opted-in

Fixes https://github.com/fwupd/fwupd/issues/3701
This commit is contained in:
Richard Hughes 2021-09-03 16:40:32 +01:00
parent d4fb04d6fc
commit 11bcf2677c
3 changed files with 26 additions and 5 deletions

View File

@ -31,6 +31,11 @@ _test_add_fake_devices_from_dir(FuPlugin *plugin, const gchar *path)
g_autoptr(GDir) dir = g_dir_open(path, 0, &error);
g_assert_no_error(error);
g_assert_nonnull(dir);
ret = fu_context_load_quirks(ctx, FU_QUIRKS_LOAD_FLAG_NO_CACHE, &error);
g_assert_no_error(error);
g_assert(ret);
while ((basename = g_dir_read_name(dir)) != NULL) {
g_autofree gchar *fn = g_build_filename(path, basename, NULL);
g_autoptr(FuUdevDevice) dev = NULL;
@ -69,6 +74,10 @@ fu_plugin_synaptics_mst_none_func(void)
g_autofree gchar *pluginfn = NULL;
g_autofree gchar *filename = NULL;
ret = fu_context_load_quirks(ctx, FU_QUIRKS_LOAD_FLAG_NO_CACHE, &error);
g_assert_no_error(error);
g_assert(ret);
g_signal_connect(plugin, "device-added", G_CALLBACK(_plugin_device_added_cb), &devices);
pluginfn = g_test_build_filename(G_TEST_BUILT,
"libfu_plugin_synaptics_mst." G_MODULE_SUFFIX,
@ -107,6 +116,10 @@ fu_plugin_synaptics_mst_tb16_func(void)
g_autofree gchar *pluginfn = NULL;
g_autofree gchar *filename = NULL;
ret = fu_context_load_quirks(ctx, FU_QUIRKS_LOAD_FLAG_NO_CACHE, &error);
g_assert_no_error(error);
g_assert(ret);
g_signal_connect(plugin, "device-added", G_CALLBACK(_plugin_device_added_cb), &devices);
pluginfn = g_test_build_filename(G_TEST_BUILT,
"libfu_plugin_synaptics_mst." G_MODULE_SUFFIX,

View File

@ -1394,6 +1394,14 @@ fu_synaptics_mst_device_rescan(FuDevice *device, GError **error)
self->board_id);
fu_device_add_instance_id(FU_DEVICE(self), dock_id2);
}
} else {
/* devices are explicit opt-in */
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"ignoring %s device with no SynapticsMstDeviceKind quirk",
guid0);
return FALSE;
}
/* detect chip family */

View File

@ -40,15 +40,15 @@ Name = Dell Rugged Platform
SynapticsMstDeviceKind = system
# ThinkPad Workstation Dock
[MST-tesla-vmm2322-513]
[MST-513]
ParentGuid = USB\VID_17EF&PID_305A
SynapticsMstDeviceKind = dock
# ThinkPad Thunderbolt 3 Workstation Dock
[MST-panamera-vmm5322-595]
[MST-595]
ParentGuid = TBT-01081720
SynapticsMstDeviceKind = dock
[MST-596]
Name = ThinkPad USB-C Dock Gen2
[MST-596]
Name = ThinkPad USB-C Dock Gen2
SynapticsMstDeviceKind = dock