summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFireZ2016-01-27 22:08:36 +0800
committerFireZ2016-01-27 22:08:36 +0800
commitbb6593a27697aee5aea85376786d2b844ef1cde2 (patch)
tree8b4c8fcc9b9b904042333906e0dcbdaf02280ab8
downloadaur-bb6593a27697aee5aea85376786d2b844ef1cde2.tar.gz
init
-rw-r--r--.SRCINFO34
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD51
-rw-r--r--surfacepen3.patch187
4 files changed, 277 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..89c5a4885269
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,34 @@
+# Generated by mksrcinfo v8
+# Wed Jan 27 14:07:54 UTC 2016
+pkgbase = xf86-input-evdev-git-surfacepen3
+ pkgdesc = X.org evdev input driver - Git version (with the patch for Surface Pen 3)
+ pkgver = 2.10.0.1.r2.gd7e61a7
+ pkgrel = 1
+ url = http://cgit.freedesktop.org/xorg/driver/xf86-input-evdev/
+ arch = i686
+ arch = x86_64
+ groups = xorg
+ groups = xorg-drivers
+ license = custom
+ makedepends = xorg-server-devel
+ makedepends = resourceproto
+ makedepends = scrnsaverproto
+ makedepends = git
+ makedepends = libevdev
+ depends = glibc
+ depends = systemd-tools
+ depends = mtdev
+ provides = xf86-input-evdev=2.10.0.1.r2.gd7e61a7
+ provides = xf86-input-driver
+ conflicts = xorg-server<1.18.0
+ conflicts = X-ABI-XINPUT_VERSION<22
+ conflicts = xf86-input-evdev
+ options = !libtool
+ options = !makeflags
+ source = git://anongit.freedesktop.org/xorg/driver/xf86-input-evdev
+ source = surfacepen3.patch
+ md5sums = SKIP
+ md5sums = ddb5ab63cdb436b1fbc0f94b1f4ebb3c
+
+pkgname = xf86-input-evdev-git-surfacepen3
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..645663c33108
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*
+!PKGBUILD
+!surfacepen3.patch
+!.SRCINFO
+!.gitignore
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..870d15a9397a
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,51 @@
+# Maintainer: FireZ <firez199984@gmail.com>
+# Contributor: Det <nimetonmaili g-mail>
+# Based on Det's xf86-input-evdev-git
+
+# This package fix the buttons on the Surface Pen 3 (except the OneNote button which based on bluetooth)
+
+_pkgname=xf86-input-evdev
+pkgname=$_pkgname-git-surfacepen3
+pkgver=2.10.0.1.r2.gd7e61a7
+pkgrel=1
+pkgdesc="X.org evdev input driver - Git version (with the patch for Surface Pen 3)"
+arch=('i686' 'x86_64')
+url="http://cgit.freedesktop.org/xorg/driver/$_pkgname/"
+license=('custom')
+groups=('xorg' 'xorg-drivers')
+depends=('glibc' 'systemd-tools' 'mtdev')
+makedepends=('xorg-server-devel' 'resourceproto' 'scrnsaverproto' 'git' 'libevdev')
+provides=("$_pkgname=$pkgver" 'xf86-input-driver')
+conflicts=('xorg-server<1.18.0' 'X-ABI-XINPUT_VERSION<22' "$_pkgname")
+options=('!libtool' '!makeflags')
+source=("git://anongit.freedesktop.org/xorg/driver/$_pkgname"
+ 'surfacepen3.patch')
+md5sums=('SKIP'
+ 'ddb5ab63cdb436b1fbc0f94b1f4ebb3c')
+
+pkgver() {
+ cd $_pkgname
+
+ echo $(git describe --long | cut -d "-" -f4-5 | tr - .).r$(git rev-list HEAD --count).$(git describe --long | cut -d "-" -f6)
+}
+
+build() {
+ cd $_pkgname
+
+ patch -p1 < ${srcdir}/surfacepen3.patch
+
+ msg2 "Starting autogen.sh..."
+ ./autogen.sh --prefix=/usr
+
+ msg2 "Starting make..."
+ make
+}
+
+package() {
+ cd $_pkgname
+
+ msg2 "Starting make install..."
+ make DESTDIR="$pkgdir" install
+
+ install -Dm644 COPYING "$pkgdir/usr/share/licenses/$_pkgname/COPYING"
+}
diff --git a/surfacepen3.patch b/surfacepen3.patch
new file mode 100644
index 000000000000..0d44c57aa2a0
--- /dev/null
+++ b/surfacepen3.patch
@@ -0,0 +1,187 @@
+diff --git a/src/evdev.c b/src/evdev.c
+index 0fcb0bb..8a18104 100644
+--- a/src/evdev.c
++++ b/src/evdev.c
+@@ -92,7 +92,7 @@
+ /* Any of those triggers a proximity event */
+ static int proximity_bits[] = {
+ BTN_TOOL_PEN,
+- BTN_TOOL_RUBBER,
++// BTN_TOOL_RUBBER,
+ BTN_TOOL_BRUSH,
+ BTN_TOOL_PENCIL,
+ BTN_TOOL_AIRBRUSH,
+@@ -113,7 +113,7 @@ static void EvdevCloseDevice(InputInfoPtr pInfo);
+ static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms);
+ static void EvdevInitOneAxisLabel(EvdevPtr pEvdev, int mapped_axis,
+ const char **labels, int label_idx, Atom *atoms);
+-static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms);
++static void EvdevInitButtonLabels(InputInfoPtr pInfo, EvdevPtr pEvdev, int natoms, Atom *atoms);
+ static void EvdevInitProperty(DeviceIntPtr dev);
+ static int EvdevSetProperty(DeviceIntPtr dev, Atom atom,
+ XIPropertyValuePtr val, BOOL checkonly);
+@@ -580,7 +580,7 @@ EvdevProcessButtonEvent(InputInfoPtr pInfo, struct input_event *ev)
+ int value;
+ EvdevPtr pEvdev = pInfo->private;
+
+- button = EvdevUtilButtonEventToButtonNumber(pEvdev, ev->code);
++ button = EvdevUtilButtonEventToButtonNumber(pInfo, pEvdev, ev->code);
+
+ /* Get the signed value, earlier kernels had this as unsigned */
+ value = ev->value;
+@@ -814,7 +814,7 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
+ value = ev->value;
+
+ /* don't repeat mouse buttons */
+- if (ev->code >= BTN_MOUSE && ev->code < KEY_OK)
++ if (ev->code >= BTN_MISC && ev->code < KEY_OK)
+ if (value == 2)
+ return;
+
+@@ -822,6 +822,10 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
+ {
+ if (ev->code == proximity_bits[i])
+ {
++ if( libevdev_get_id_vendor(pEvdev->dev) == 0x1b96 ) {
++ xf86IDrvMsg(pInfo, X_WARNING, "Discarding code %x\n", ev->code);
++ }
++
+ EvdevProcessProximityEvent(pInfo, ev);
+ return;
+ }
+@@ -1750,7 +1754,7 @@ EvdevAddButtonClass(DeviceIntPtr device)
+ pEvdev = pInfo->private;
+
+ labels = malloc(pEvdev->num_buttons * sizeof(Atom));
+- EvdevInitButtonLabels(pEvdev, pEvdev->num_buttons, labels);
++ EvdevInitButtonLabels(pInfo, pEvdev, pEvdev->num_buttons, labels);
+
+ if (!InitButtonClassDeviceStruct(device, pEvdev->num_buttons, labels,
+ pEvdev->btnmap))
+@@ -2118,6 +2122,7 @@ EvdevProbe(InputInfoPtr pInfo)
+ {
+ int i, has_rel_axes, has_abs_axes, has_keys, num_buttons, has_scroll;
+ int has_lmr; /* left middle right */
++ int has_stylus;
+ int has_mt; /* multitouch */
+ int ignore_abs = 0, ignore_rel = 0;
+ EvdevPtr pEvdev = pInfo->private;
+@@ -2153,16 +2158,17 @@ EvdevProbe(InputInfoPtr pInfo)
+ has_keys = FALSE;
+ has_scroll = FALSE;
+ has_lmr = FALSE;
++ has_stylus = FALSE;
+ has_mt = FALSE;
+ num_buttons = 0;
+
+ /* count all buttons */
+- for (i = BTN_MISC; i < BTN_JOYSTICK; i++)
++ for (i = BTN_MISC; i < KEY_OK; i++)
+ {
+ int mapping = 0;
+ if (libevdev_has_event_code(pEvdev->dev, EV_KEY, i))
+ {
+- mapping = EvdevUtilButtonEventToButtonNumber(pEvdev, i);
++ mapping = EvdevUtilButtonEventToButtonNumber(pInfo, pEvdev, i);
+ if (mapping > num_buttons)
+ num_buttons = mapping;
+ }
+@@ -2172,6 +2178,19 @@ EvdevProbe(InputInfoPtr pInfo)
+ libevdev_has_event_code(pEvdev->dev, EV_KEY, BTN_MIDDLE) ||
+ libevdev_has_event_code(pEvdev->dev, EV_KEY, BTN_RIGHT);
+
++ // Alternate Stylus buttons
++ has_stylus = libevdev_has_event_code(pEvdev->dev, EV_KEY, BTN_TOUCH) ||
++ libevdev_has_event_code(pEvdev->dev, EV_KEY, BTN_STYLUS) ||
++ libevdev_has_event_code(pEvdev->dev, EV_KEY, BTN_STYLUS2) ||
++ libevdev_has_event_code(pEvdev->dev, EV_KEY, BTN_TOOL_PEN) ||
++ libevdev_has_event_code(pEvdev->dev, EV_KEY, BTN_TOOL_RUBBER);
++
++ has_lmr |= has_stylus;
++
++ if ( has_stylus ) {
++ xf86IDrvMsg(pInfo, X_PROBED, "Found tablet stylus buttons\n");
++ }
++
+ if (num_buttons)
+ {
+ pEvdev->flags |= EVDEV_BUTTON_EVENTS;
+@@ -2714,8 +2733,12 @@ _X_EXPORT XF86ModuleData evdevModuleData =
+ * returns 0 on non-button event.
+ */
+ unsigned int
+-EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code)
++EvdevUtilButtonEventToButtonNumber(InputInfoPtr pInfo, EvdevPtr pEvdev, int code)
+ {
++ if( libevdev_get_id_vendor(pEvdev->dev) == 0x1b96 ) {
++ xf86IDrvMsg(pInfo, X_WARNING, "Button event code %x.\n",code);
++ }
++
+ switch (code)
+ {
+ /* Mouse buttons */
+@@ -2736,8 +2759,15 @@ EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code)
+
+ /* Tablet stylus buttons */
+ case BTN_TOUCH ... BTN_STYLUS2:
++ xf86IDrvMsg(pInfo, X_WARNING, "Button event code matched - old code\n");
+ return 1 + code - BTN_TOUCH;
+
++ /* Alternate Tablet stylus buttons */
++ case BTN_TOOL_PEN:
++ case BTN_TOOL_RUBBER:
++ xf86IDrvMsg(pInfo, X_WARNING, "Button event code matched\n");
++ return 3;
++
+ /* The rest */
+ default:
+ /* Ignore */
+@@ -2775,7 +2805,7 @@ static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *ato
+ EvdevInitOneAxisLabel(pEvdev, pEvdev->abs_axis_map[axis], abs_labels, axis, atoms);
+ }
+
+-static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms)
++static void EvdevInitButtonLabels(InputInfoPtr pInfo, EvdevPtr pEvdev, int natoms, Atom *atoms)
+ {
+ Atom atom;
+ int button, bmap;
+@@ -2785,7 +2815,7 @@ static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms)
+ for (button = 0; button < natoms; button++)
+ atoms[button] = atom;
+
+- for (button = BTN_MISC; button < BTN_JOYSTICK; button++)
++ for (button = BTN_MISC; button < KEY_OK; button++)
+ {
+ int group = (button % 0x100)/16;
+ int idx = button - ((button/16) * 16);
+@@ -2801,7 +2831,7 @@ static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms)
+ continue;
+
+ /* Props are 0-indexed, button numbers start with 1 */
+- bmap = EvdevUtilButtonEventToButtonNumber(pEvdev, button) - 1;
++ bmap = EvdevUtilButtonEventToButtonNumber(pInfo, pEvdev, button) - 1;
+ atoms[bmap] = atom;
+ }
+
+@@ -2942,7 +2972,7 @@ EvdevInitProperty(DeviceIntPtr dev)
+ if ((pEvdev->num_buttons > 0) && (prop_btn_label = XIGetKnownProperty(BTN_LABEL_PROP)))
+ {
+ Atom atoms[EVDEV_MAXBUTTONS];
+- EvdevInitButtonLabels(pEvdev, EVDEV_MAXBUTTONS, atoms);
++ EvdevInitButtonLabels(pInfo, pEvdev, EVDEV_MAXBUTTONS, atoms);
+ rc = XIChangeDeviceProperty(dev, prop_btn_label, XA_ATOM, 32,
+ PropModeReplace, pEvdev->num_buttons, atoms, FALSE);
+ if (rc != Success)
+diff --git a/src/evdev.h b/src/evdev.h
+index 4d44d2b..1150a88 100644
+--- a/src/evdev.h
++++ b/src/evdev.h
+@@ -255,7 +255,7 @@ void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act)
+ void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
+ void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo);
+ void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo);
+-unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code);
++unsigned int EvdevUtilButtonEventToButtonNumber(InputInfoPtr pInfo, EvdevPtr pEvdev, int code);
+
+ /* Middle Button emulation */
+ int EvdevMBEmuTimer(InputInfoPtr);