fwupd/plugins/synapticsmst/fu-synapticsmst-common.c
Richard Hughes d350b2ecd7 synapticsmst: Partially rewrite the plugin (Fixes #1105)
This removes the 'two-layer' FuDevice and FuSyanpticsmstDevice model, where
a complicated plugin cache was used to add and remove devices to the daemon.

By making FuSynapticsmstDevice derive from FuDevice rather than GObject we can
also use a lot of the helper functionality like the other plugins, for instance
->prepare_firmware().

The `drm_dp_aux_dev` devices do not emit uevents on unplug/re-plug and so all
devices of `drm` class are watched and the actual DP AUX devices rescanned after
a small delay. When the AUX devices emit changes from the kernel this workaround
can be removed.

Also drop force power support for MST controllers in the Dell plugin. Overall
this has just led to more problems than it's helped.

 * Monitor flickers when turned on
 * Crashing graphics drivers from time to time
 * Fragile logic that doesn't always represent the device state
2019-08-28 08:50:15 -05:00

45 lines
1.1 KiB
C

/*
* Copyright (C) 2016 Mario Limonciello <mario.limonciello@dell.com>
* Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include "fu-synapticsmst-common.h"
const gchar *
fu_synapticsmst_mode_to_string (FuSynapticsmstMode mode)
{
if (mode == FU_SYNAPTICSMST_MODE_DIRECT)
return "DIRECT";
if (mode == FU_SYNAPTICSMST_MODE_REMOTE)
return "REMOTE";
return NULL;
}
const gchar *
fu_synapticsmst_family_to_string (FuSynapticsmstFamily family)
{
if (family == FU_SYNAPTICSMST_FAMILY_TESLA)
return "tesla";
if (family == FU_SYNAPTICSMST_FAMILY_LEAF)
return "leaf";
if (family == FU_SYNAPTICSMST_FAMILY_PANAMERA)
return "panamera";
return NULL;
}
FuSynapticsmstFamily
fu_synapticsmst_family_from_chip_id (guint16 chip_id)
{
if (chip_id >= 0x5000 && chip_id < 0x6000)
return FU_SYNAPTICSMST_FAMILY_PANAMERA;
if (chip_id >= 0x3000 && chip_id < 0x4000)
return FU_SYNAPTICSMST_FAMILY_LEAF;
if (chip_id >= 0x2000 && chip_id < 0x3000)
return FU_SYNAPTICSMST_FAMILY_TESLA;
return FU_SYNAPTICSMST_FAMILY_UNKNOWN;
}