platform-profile: Check for tainting when reading profiles

Check for tainting just before reading profiles, so warnings can be
thrown if we detect situations we don't want to support.
This commit is contained in:
Bastien Nocera 2021-08-23 13:16:44 +02:00
parent b02b1396c5
commit 9788313c74

View file

@ -29,6 +29,9 @@ struct _PpdDriverPlatformProfile
GFileMonitor *lapmode_mon;
GFileMonitor *acpi_platform_profile_mon;
guint acpi_platform_profile_changed_id;
gboolean can_taint;
gboolean tainted;
};
G_DEFINE_TYPE (PpdDriverPlatformProfile, ppd_driver_platform_profile, PPD_TYPE_DRIVER)
@ -174,6 +177,9 @@ update_acpi_platform_profile_state (PpdDriverPlatformProfile *self)
{
PpdProfile new_profile;
if (self->can_taint && !self->tainted)
self->tainted = ppd_utils_try_taint ();
new_profile = read_platform_profile ();
if (new_profile == PPD_PROFILE_UNSET ||
new_profile == self->acpi_platform_profile)
@ -291,6 +297,9 @@ ppd_driver_platform_profile_probe (PpdDriver *driver)
return self->probe_result;
}
/* Check for customisation that would invalidate our work */
self->can_taint = ppd_utils_can_taint ();
/* Lenovo-specific proximity sensor */
self->device = ppd_utils_find_device ("platform",
(GCompareFunc) find_dytc,