Skip to content

Commit

Permalink
for-backport: Check for availability of resolution_multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
jigpu committed Jul 24, 2024
1 parent a224f54 commit dc0776a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 4.18/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2251,7 +2251,11 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field
value = wacom_offset_rotation(input, usage, value, 1, 2);
}
else if (field->flags & HID_MAIN_ITEM_RELATIVE) {
#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 @@ -240,6 +240,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 dc0776a

Please sign in to comment.