Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions recipes/evdev/patches/evcnt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff -Naur orig/evdev/input.c v0.4.7/evdev/input.c
--- orig/evdev/input.c 2015-06-11 13:56:43.483891914 -0500
+++ v0.4.7/evdev/input.c 2015-06-11 13:57:29.079529095 -0500
@@ -24,6 +24,8 @@
#include <linux/input.h>
#endif

+#define EV_CNT (EV_MAX+1)
+
#define MAX_NAME_SIZE 256

extern char* EV_NAME[EV_CNT];
@@ -190,7 +192,7 @@
absinfo.maximum,
absinfo.fuzz,
absinfo.flat,
- absinfo.resolution);
+ 0);

evlong = PyLong_FromLong(ev_code);
absitem = Py_BuildValue("(OO)", evlong, py_absinfo);
57 changes: 57 additions & 0 deletions recipes/evdev/patches/evdev-permissions.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
diff -Naur orig/evdev/util.py v0.4.7/evdev/util.py
--- orig/evdev/util.py 2015-06-12 16:31:46.532994729 -0500
+++ v0.4.7/evdev/util.py 2015-06-12 16:32:59.489933840 -0500
@@ -3,15 +3,53 @@
import os
import stat
import glob
+import subprocess

from evdev import ecodes
from evdev.events import event_factory


+su = False
+
+
+def get_su_binary():
+ global su
+ if su is not False:
+ return su
+
+ su_files = ['/sbin/su', '/system/bin/su', '/system/xbin/su', '/data/local/xbin/su',
+ '/data/local/bin/su', '/system/sd/xbin/su', '/system/bin/failsafe/su',
+ '/data/local/su']
+ su = None
+
+ for fn in su_files:
+ if os.path.exists(fn):
+ try:
+ cmd = [fn, '-c', 'id']
+ output = subprocess.check_output(cmd)
+ except Exception:
+ pass
+ else:
+ if 'uid=0' in output:
+ su = fn
+ break
+
+ return su
+
+
+def fix_permissions(nodes):
+ su = get_su_binary()
+ if su:
+ cmd = 'chmod 666 ' + ' '.join(nodes)
+ print cmd
+ subprocess.check_call(['su', '-c', cmd])
+
+
def list_devices(input_device_dir='/dev/input'):
'''List readable character devices in ``input_device_dir``.'''

fns = glob.glob('{}/event*'.format(input_device_dir))
+ fix_permissions(fns)
fns = list(filter(is_device, fns))

return fns
12 changes: 12 additions & 0 deletions recipes/evdev/patches/include-dir.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -Naur orig/setup.py v0.4.7/setup.py
--- orig/setup.py 2015-06-11 14:16:31.315765908 -0500
+++ v0.4.7/setup.py 2015-06-11 14:17:05.800263536 -0500
@@ -64,7 +64,7 @@

#-----------------------------------------------------------------------------
def create_ecodes():
- header = '/usr/include/linux/input.h'
+ header = '##INCLUDE_DIR##/usr/include/linux/input.h'

if not os.path.isfile(header):
msg = '''\
20 changes: 20 additions & 0 deletions recipes/evdev/patches/keycnt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff -Naur orig/evdev/genecodes.py v0.4.7/evdev/genecodes.py
--- orig/evdev/genecodes.py 2015-06-12 11:18:39.460538902 -0500
+++ v0.4.7/evdev/genecodes.py 2015-06-12 11:20:49.004337615 -0500
@@ -17,6 +17,8 @@
#include <linux/input.h>
#endif

+#define KEY_CNT (KEY_MAX+1)
+
/* Automatically generated by evdev.genecodes */
/* Generated on %s */

@@ -88,6 +88,7 @@
macro = regex.search(line)
if macro:
yield ' PyModule_AddIntMacro(m, %s);' % macro.group(1)
+ yield ' PyModule_AddIntMacro(m, KEY_CNT);'

uname = list(os.uname()); del uname[1]
uname = ' '.join(uname)
Loading