From 7b9c8e4549a575d33d709b9b8a1fcc683b0bc3f3 Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Mon, 18 Nov 2024 10:58:48 -0800 Subject: [PATCH] input-wacom: Conditionally compile LED trigger brightness support This change is only for input-wacom to ensure that it continues to build properly on older kernels which may not support trigger brightness. --- 4.18/wacom_sys.c | 2 ++ configure.ac | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/4.18/wacom_sys.c b/4.18/wacom_sys.c index 6282dde7..8cf5710c 100644 --- a/4.18/wacom_sys.c +++ b/4.18/wacom_sys.c @@ -1400,8 +1400,10 @@ static int wacom_led_register_one(struct device *dev, struct wacom *wacom, if (!read_only) { led->trigger.name = name; +#ifdef WACOM_TRIGGER_BRIGHTNESS if (id == wacom->led.groups[group].select) led->trigger.brightness = wacom_leds_brightness_get(led); +#endif error = devm_led_trigger_register(dev, &led->trigger); if (error) { hid_err(wacom->hdev, diff --git a/configure.ac b/configure.ac index e4c74ba3..5aacf265 100644 --- a/configure.ac +++ b/configure.ac @@ -256,6 +256,22 @@ int test(struct hid_usage *usage) { return usage->resolution_multiplier; } AC_MSG_RESULT([no]) ]) +dnl Check if LED triggers define brightness. This should be in Linux +dnl 6.10 and later. +AC_MSG_CHECKING(trigger brightness) +WACOM_LINUX_TRY_COMPILE([ +#include +int test(struct led_trigger *trigger) { return trigger->brightness; } +],[ +],[ + HAVE_TRIGGER_BRIGHTNESS=yes + AC_MSG_RESULT([yes]) + AC_DEFINE([WACOM_TRIGGER_BRIGHTNESS], [], [kernel defines trigger brightness from v6.10+]) +],[ + HAVE_TRIGGER_BRIGHTNESS=no + AC_MSG_RESULT([no]) +]) + dnl Check which version of the driver we should compile