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)
