Skip to content

Commit

Permalink
Fixup: Check for availability of resolution_multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
jigpu committed May 2, 2024
1 parent 11db99b commit c69f98a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 4.5/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2263,7 +2263,11 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field
}
else if (field->flags & HID_MAIN_ITEM_RELATIVE) {
// Emulate a legacy wheel click for every 120 units high-res travel
#ifdef WACOM_RESOLUTION_MULTIPLIER
int hires_value = value * 120 / usage->resolution_multiplier;
#else
int hires_value = value * 120;
#endif
int *ring_value;
int lowres_code;

Expand Down
16 changes: 16 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,22 @@ bool input_set_timestamp(struct input_dev *dev, ktime_t timestamp) { return true
AC_DEFINE([WACOM_INPUT_SET_TIMESTAMP], [], [kernel defines input_set_timestamp from v5.4+])
])

dnl Check if resolution_multiplier is a member of struct hid_usage. This
dnl should be available in Linux 5.0.0 and later.
AC_MSG_CHECKING(resolution_multiplier)
WACOM_LINUX_TRY_COMPILE([
#include <linux/hid.h>
__s8 probe_resolution_multiplier(struct hid_usage *usage) { return usage->resolution_multiplier; }
],[
],[
HAVE_RESOLUTION_MULTIPLIER=yes
AC_MSG_RESULT([yes])
AC_DEFINE([WACOM_RESOLUTION_MULTIPLIER], [], [kernel defines resolution_multiplier from v5.0+])
],[
HAVE_RESOLUTION_MULTIPLIER=no
AC_MSG_RESULT([no])
])



dnl Check which version of the driver we should compile
Expand Down

0 comments on commit c69f98a

Please sign in to comment.