mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-28 04:47:52 +00:00
trivial: synapticsmst: only enable plugin if kernel support is present
This commit is contained in:
parent
8eaf6dbcd6
commit
f53e4a2d4b
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <smbios_c/smbios.h>
|
||||
#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<MAX_DP_AUX_NODES; i++) {
|
||||
if (kernel_support)
|
||||
break;
|
||||
kernel_support = g_file_test (synapticsmst_device_aux_node_to_string (i),
|
||||
G_FILE_TEST_EXISTS);
|
||||
}
|
||||
if (!kernel_support) {
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_INVALID_DATA,
|
||||
"MST firmware updating not supported, missing kernel support.");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_synaptics_add_device (FuPlugin *plugin,
|
||||
SynapticsMSTDevice *device,
|
||||
@ -86,9 +121,6 @@ fu_plugin_synapticsmst_enumerate (FuPlugin *plugin,
|
||||
g_autoptr(SynapticsMSTDevice) device = NULL;
|
||||
g_autoptr(FuDevice) dev = NULL;
|
||||
|
||||
if (!synapticsmst_common_check_supported_system (error))
|
||||
return FALSE;
|
||||
|
||||
for (i=0; i<MAX_DP_AUX_NODES; i++) {
|
||||
aux_node = synapticsmst_device_aux_node_to_string (i);
|
||||
dev = fu_plugin_cache_lookup (plugin, aux_node);
|
||||
@ -251,6 +283,10 @@ fu_plugin_startup (FuPlugin *plugin, GError **error)
|
||||
gboolean
|
||||
fu_plugin_coldplug (FuPlugin *plugin, GError **error)
|
||||
{
|
||||
/* verify that this is a supported system */
|
||||
if (!synapticsmst_common_check_supported_system (error))
|
||||
return FALSE;
|
||||
|
||||
/* look for host devices or already plugged in dock devices */
|
||||
if (!fu_plugin_synapticsmst_enumerate (plugin, error))
|
||||
g_debug ("SynapticsMST: Error enumerating.");
|
||||
|
@ -28,9 +28,9 @@
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <smbios_c/smbios.h>
|
||||
#include <glib-object.h>
|
||||
#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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user