From: Benjamin Tissoires <benjamin.tissoi...@gmail.com>

RHEL 7.4 ships both the USB module and the HID version.
We need to use the HID version if we do not want users
to manually quirk their devices.

Compile both modules and make sure we install them
properly.

Note that on these distributions, wacom_w8001.ko is compiled
twice, but given the 2 files in 3.7 and 3.17 are identical,
it doesn't hurt much.

Signed-off-by: Benjamin Tissoires <benjamin.tissoi...@gmail.com>
---
 3.17/Makefile.in | 11 +++++++++--
 3.17/wacom_sys.c |  6 +++---
 3.17/wacom_wac.c |  8 ++++++++
 configure.ac     | 16 ++++++++++++++++
 4 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/3.17/Makefile.in b/3.17/Makefile.in
index 4359f255cc49..abebdaffb1e0 100644
--- a/3.17/Makefile.in
+++ b/3.17/Makefile.in
@@ -1,3 +1,10 @@
+RHEL7_RELEASE := @RHEL7_RELEASE@
+MODULE_NAME := wacom
+
+ifeq ($(RHEL7_RELEASE),4)
+MODULE_NAME := hid-wacom
+endif # RHEL7_RELEASE
+
 ############################ kernel specific compile 
###############################
 ifneq ($(KERNELRELEASE),)
 # We were called by kbuild
@@ -7,8 +14,8 @@ ifneq ($(KERNELRELEASE),)
 ifneq ($(CONFIG_HID_WACOM),y)
 WCM_VERSION := $(shell cd $(KBUILD_EXTMOD)/.. && ./git-version-gen)
 ccflags-y := -DWACOM_VERSION_SUFFIX=\"-$(WCM_VERSION)\" -Wall -Wextra 
-Wno-unused-parameter -Wno-missing-field-initializers $(EXTRA_CFLAGS)
-wacom-objs := wacom_wac.o wacom_sys.o
-obj-m += wacom.o
+$(MODULE_NAME)-objs := wacom_wac.o wacom_sys.o
+obj-m += $(MODULE_NAME).o
 obj-m += wacom_w8001.o
 else
 $(error You requested to build wacom with configure, but wacom is configured 
as built-in in your kernel config)
diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c
index 8fd0b786d50b..8b51b4641fc7 100644
--- a/3.17/wacom_sys.c
+++ b/3.17/wacom_sys.c
@@ -1150,7 +1150,7 @@ static void wacom_led_groups_release(void *data)
        wacom->led.groups = NULL;
 }
 
-static inline int devm_add_action_or_reset(struct device *dev,
+static inline int wac_devm_add_action_or_reset(struct device *dev,
                                           void (*action)(void *), void *data)
 {
        int ret;
@@ -1173,7 +1173,7 @@ static int wacom_led_groups_allocate(struct wacom *wacom, 
int count)
        if (!groups)
                return -ENOMEM;
 
-       error = devm_add_action_or_reset(&wacom->hdev->dev,
+       error = wac_devm_add_action_or_reset(&wacom->hdev->dev,
                                         wacom_led_groups_release,
                                         wacom);
        if (error)
@@ -1692,7 +1692,7 @@ static int wacom_initialize_remotes(struct wacom *wacom)
                remote->remotes[i].serial = 0;
        }
 
-       error = devm_add_action_or_reset(&wacom->hdev->dev,
+       error = wac_devm_add_action_or_reset(&wacom->hdev->dev,
                                         wacom_remotes_destroy, wacom);
        if (error)
                return error;
diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index 944f74d44b8d..92fb57a6a3fa 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -24,6 +24,14 @@
 #define KEY_ONSCREEN_KEYBOARD  0x278
 #endif
 
+#ifndef KEY_BUTTONCONFIG
+#define KEY_BUTTONCONFIG               0x240
+#endif
+
+#ifndef KEY_CONTROLPANEL
+#define KEY_CONTROLPANEL               0x243
+#endif
+
 /* resolution for penabled devices */
 #define WACOM_PL_RES           20
 #define WACOM_PENPRTN_RES      40
diff --git a/configure.ac b/configure.ac
index 33a12937d9fa..5aad03941a13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,16 @@ package and try again.])
 fi
 WCM_ENV_KERNEL="yes"
 
+dnl Check for RedHat entreprise Linux >= 7.4
+AC_MSG_CHECKING(RHEL7 minor release)
+RHEL7_RELEASE=[$(sed -n 's/^Red Hat Enterprise Linux .*release 7.\(.*\) 
.*$/\1/gp' "/etc/redhat-release" 2> /dev/null | head -n1)]
+dnl RHEL7_RELEASE=""
+if test "$RHEL7_RELEASE" = ""; then
+       RHEL7_RELEASE="0"
+elif test "$RHEL7_RELEASE" -gt "3"; then
+       RHEL7_RELEASE="4"
+fi
+AC_MSG_RESULT([$RHEL7_RELEASE])
 
 dnl Check which version of the driver we should compile
 AC_DEFUN([WCM_EXPLODE], [$(echo "$1" | awk '{split($[0],x,"[[^0-9]]"); 
printf("%03d%03d%03d\n",x[[1]],x[[2]],x[[3]]);}')])
@@ -126,12 +136,18 @@ else
        WCM_KERNEL_VER="4.5"
 fi
 
+dnl overwrite for RHEL distribution
+if test "$RHEL7_RELEASE" = "4"; then
+        WCM_KERNEL_VER="3.7 3.17"
+fi
+
 dnl Separate test output from file-generation output
 echo 
 
 WCM_SRC_SUBDIRS=". $WCM_KERNEL_VER"
 AC_SUBST(WCM_KERNEL_DIR)
 AC_SUBST(WCM_KERNEL_VER)
+AC_SUBST(RHEL7_RELEASE)
 AC_SUBST(MODUTS)
 
 AC_CONFIG_FILES([Makefile
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to