Skip to content

Commit

Permalink
input-wacom: Conditionally compile LED trigger brightness support
Browse files Browse the repository at this point in the history
This change is only for input-wacom to ensure that it continues to build
properly on older kernels which may not support trigger brightness.
  • Loading branch information
jigpu committed Nov 18, 2024
1 parent 1ec6ff9 commit 7b9c8e4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 4.18/wacom_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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 <linux/leds.h>
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
Expand Down

0 comments on commit 7b9c8e4

Please sign in to comment.