Blob Blame History Raw
From 685850060f1cef064a90e02191d4732f275c7179 Mon Sep 17 00:00:00 2001
From: Jason Gerecke <killertofu@gmail.com>
Date: Tue, 26 Dec 2017 14:21:17 -0800
Subject: [PATCH] Allocate 4 buttons for stylus devices (Pro Pen 3D)

The Pro Pen 3D includes a third stylus button, reported from the kernel
as BTN_STYLUS3. Support for this event was added earlier, but the number
of buttons allocated was not updated. This meant that although the X
driver would properly set the button flag bit to indicate that a button
should be sent, a userspace event wouldn't actually be sent. This commit
increases the number of buttons allocated, causing the third button to
emit X11 button number 8 when pressed. This button can also be configured
through xsetwacom now that the driver allocates the correct number.

Fixes: 4a96a58f26 ("Add support for kernel's new BTN_STYLUS3 event")
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
---
 src/wcmUSB.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 9190fbe..1e4dc51 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -167,7 +167,7 @@ static unsigned short padkey_codes [] = {
 /* Fixed mapped stylus and mouse buttons */
 
 #define WCM_USB_MAX_MOUSE_BUTTONS 5
-#define WCM_USB_MAX_STYLUS_BUTTONS 3
+#define WCM_USB_MAX_STYLUS_BUTTONS 4
 
 static unsigned short mouse_codes [] = {
 	BTN_LEFT, BTN_MIDDLE, BTN_RIGHT, BTN_BACK, BTN_FORWARD,
@@ -480,7 +480,7 @@ static Bool usbWcmInit(InputInfoPtr pInfo, char* id, size_t id_len, float *versi
 	/* nbuttons tracks maximum buttons on all tools (stylus/mouse).
 	 *
 	 * Mouse support left, middle, right, side, and extra side button.
-	 * Stylus support tip and 2 stlyus buttons.
+	 * Stylus support tip and 3 stylus buttons.
 	 */
 	if (ISBITSET (common->wcmKeys, BTN_TOOL_MOUSE))
 		usbdata->nbuttons = WCM_USB_MAX_MOUSE_BUTTONS;
-- 
2.14.3