From f53e4a2d4b793838d661e1cb76b9fc237c8e21b8 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 16 Jan 2017 15:37:11 -0600 Subject: [PATCH] trivial: synapticsmst: only enable plugin if kernel support is present --- plugins/synapticsmst/fu-plugin-synapticsmst.c | 42 +++++++++++++++++-- plugins/synapticsmst/synapticsmst-common.c | 19 +-------- plugins/synapticsmst/synapticsmst-common.h | 2 - 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/plugins/synapticsmst/fu-plugin-synapticsmst.c b/plugins/synapticsmst/fu-plugin-synapticsmst.c index b01f1dc3c..e700a42b9 100644 --- a/plugins/synapticsmst/fu-plugin-synapticsmst.c +++ b/plugins/synapticsmst/fu-plugin-synapticsmst.c @@ -21,6 +21,7 @@ */ #include "config.h" +#include #include "synapticsmst-device.h" #include "synapticsmst-common.h" #include "fu-plugin-dell.h" @@ -29,6 +30,40 @@ #define SYNAPTICS_FLASH_MODE_DELAY 2 +static gboolean +synapticsmst_common_check_supported_system (GError **error) +{ + gint i; + guint8 dell_supported = 0; + gboolean kernel_support = FALSE; + struct smbios_struct *de_table; + + de_table = smbios_get_next_struct_by_type (0, 0xDE); + smbios_struct_get_data (de_table, &(dell_supported), 0x00, sizeof(guint8)); + if (dell_supported != 0xDE) { + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_INVALID_DATA, + "MST firmware updating not supported by OEM (%x)", + dell_supported); + return FALSE; + } + for (i=0; i #include #include -#include #include #include "synapticsmst-common.h" +#include "synapticsmst-device.h" #define UNIT_SIZE 32 #define MAX_WAIT_TIME 3 /* unit : second */ @@ -399,20 +399,3 @@ synapticsmst_common_disable_remote_control (void) synapticsmst_common_config_connection (tmp_layer, g_RAD); return rc; } - -gboolean synapticsmst_common_check_supported_system (GError **error) -{ - guint8 dell_supported = 0; - struct smbios_struct *de_table; - de_table = smbios_get_next_struct_by_type (0, 0xDE); - smbios_struct_get_data (de_table, &(dell_supported), 0x00, sizeof(guint8)); - if (dell_supported != 0xDE) { - g_set_error (error, - G_IO_ERROR, - G_IO_ERROR_INVALID_DATA, - "SynapticsMST: firmware updating not supported. (%x)", - dell_supported); - return FALSE; - } - return TRUE; -} diff --git a/plugins/synapticsmst/synapticsmst-common.h b/plugins/synapticsmst/synapticsmst-common.h index 6fa8bf507..18c4278a6 100644 --- a/plugins/synapticsmst/synapticsmst-common.h +++ b/plugins/synapticsmst/synapticsmst-common.h @@ -107,6 +107,4 @@ guchar synapticsmst_common_enable_remote_control (void); guchar synapticsmst_common_disable_remote_control (void); -gboolean synapticsmst_common_check_supported_system (GError **error); - #endif /* __SYNAPTICSMST_COMMON_H */