From 9788313c746594f1c2644d9c4d799ec2f720f500 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 23 Aug 2021 13:16:44 +0200 Subject: [PATCH] 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. --- src/ppd-driver-platform-profile.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ppd-driver-platform-profile.c b/src/ppd-driver-platform-profile.c index 8111251..79820a3 100644 --- a/src/ppd-driver-platform-profile.c +++ b/src/ppd-driver-platform-profile.c @@ -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,