aboutsummaryrefslogtreecommitdiff
path: root/maps
diff options
context:
space:
mode:
authorGuillermo Ramos2011-09-16 19:38:44 +0200
committerGuillermo Ramos2011-09-16 19:38:44 +0200
commit74ed96bd35757bc4446c6f42ac48ae09638b5e72 (patch)
treeea2f46b1690203f000e8d68daf7f3c77dba1790a /maps
parent5f78bdac09842192ad1cae0f0e516e9020619ac7 (diff)
downloadevspy-74ed96bd35757bc4446c6f42ac48ae09638b5e72.tar.gz
One file for each keyboard layout. Shift implemented on spanish layout
Diffstat (limited to 'maps')
-rw-r--r--maps/map_en.h58
-rw-r--r--maps/map_es.h58
-rw-r--r--maps/maps.h45
3 files changed, 161 insertions, 0 deletions
diff --git a/maps/map_en.h b/maps/map_en.h
new file mode 100644
index 0000000..14c377e
--- /dev/null
+++ b/maps/map_en.h
@@ -0,0 +1,58 @@
+/*
+ * ## ENGLISH KEYBOARD LAYOUT ## *
+ *
+ */
+
+#ifndef __MAP_EN
+#define __MAP_EN
+
+static void init_shiftmap(void)
+{
+ init_shiftmap_global();
+ EVS_SHIFT(KEY_1, "!");
+ EVS_SHIFT(KEY_2, "\"");
+ EVS_SHIFT(KEY_4, "$");
+ EVS_SHIFT(KEY_5, "%");
+ EVS_SHIFT(KEY_6, "&");
+ EVS_SHIFT(KEY_7, "/");
+ EVS_SHIFT(KEY_8, "(");
+ EVS_SHIFT(KEY_9, ")");
+ EVS_SHIFT(KEY_0, "=");
+ EVS_SHIFT(KEY_MINUS, "?");
+ EVS_SHIFT(KEY_EQUAL, "?"); // TODO change to '¿'
+ EVS_SHIFT(KEY_LEFTBRACE, "^");
+ EVS_SHIFT(KEY_RIGHTBRACE, "*");
+ EVS_SHIFT(KEY_SEMICOLON, "N"); // TODO change to 'Ñ'
+// EVS_SHIFT(KEY_GRAVE, "Ç"); // TODO enable
+ EVS_SHIFT(KEY_COMMA, ";");
+ EVS_SHIFT(KEY_DOT, ":");
+ EVS_SHIFT(KEY_SLASH, "_");
+ EVS_SHIFT(KEY_102ND, ">");
+}
+static char map[] = {
+ '.', '.', '1', '2', '3', //0 // 1:ESC
+ '4', '5', '6', '7', '8', //5
+ '9', '0', '\'', '!', '\b', //10 // 13:¡ (NOASCII) 14:BACKSPACE
+ '.', 'q', 'w', 'e', 'r', //15 // 15:TAB
+ 't', 'y', 'u', 'i', 'o', //20
+ 'p', '`', '+', '\n', '.', //25 // 29:LCTRL
+ 'a', 's', 'd', 'f', 'g', //30
+ 'h', 'j', 'k', 'l', 'n', //35 // 39:ñ (NOASCII)
+ '\'', '.', '.', 'c', 'z', //40 // 42:LMAYUS 43:ç (NOASCII)
+ 'x', 'c', 'v', 'b', 'n', //45
+ 'm', ',', '.', '-', '.', //50 // 52:. 54:RMAYUS
+ '*', '.', ' ', '.', '.', //55 // 56:ALT 58:BLKMAYUS 59-68:F1-F10
+ '.', '.', '.', '.', '.', //60
+ '.', '.', '.', '.', '.', //65
+ '.', '7', '8', '9', '-', //70
+ '4', '5', '6', '+', '1', //75
+ '2', '3', '.', '.', '.', //80
+ '.', '<', '.', '.', '.', //85
+ '.', '.', '.', '.', '.', //90
+ '.', '\n', '.', '/', '.', //95 // 97:RCTRL
+ '.', '.', '.', '.', '.', //100 // 100:ALTGR 103:up_arrow
+ '.', '.', '.', '.', '.', //105 // 105:l_arrow 106:r_arrow 108:dwn_arrow
+};
+
+
+#endif // __MAP_EN
diff --git a/maps/map_es.h b/maps/map_es.h
new file mode 100644
index 0000000..0be1c84
--- /dev/null
+++ b/maps/map_es.h
@@ -0,0 +1,58 @@
+/*
+ * ## SPANISH KEYBOARD LAYOUT ## *
+ *
+ */
+
+#ifndef __MAP_ES
+#define __MAP_ES
+
+static void init_shiftmap(void)
+{
+ init_shiftmap_global();
+ EVS_SHIFT(KEY_1, "!");
+ EVS_SHIFT(KEY_2, "\"");
+ EVS_SHIFT(KEY_4, "$");
+ EVS_SHIFT(KEY_5, "%");
+ EVS_SHIFT(KEY_6, "&");
+ EVS_SHIFT(KEY_7, "/");
+ EVS_SHIFT(KEY_8, "(");
+ EVS_SHIFT(KEY_9, ")");
+ EVS_SHIFT(KEY_0, "=");
+ EVS_SHIFT(KEY_MINUS, "?");
+ EVS_SHIFT(KEY_EQUAL, "?"); // TODO change to '¿'
+ EVS_SHIFT(KEY_LEFTBRACE, "^");
+ EVS_SHIFT(KEY_RIGHTBRACE, "*");
+ EVS_SHIFT(KEY_SEMICOLON, "N"); // TODO change to 'Ñ'
+// EVS_SHIFT(KEY_GRAVE, "Ç"); // TODO enable
+ EVS_SHIFT(KEY_COMMA, ";");
+ EVS_SHIFT(KEY_DOT, ":");
+ EVS_SHIFT(KEY_SLASH, "_");
+ EVS_SHIFT(KEY_102ND, ">");
+}
+static char map[] = {
+ '.', '.', '1', '2', '3', //0 // 1:ESC
+ '4', '5', '6', '7', '8', //5
+ '9', '0', '\'', '!', '\b', //10 // 13:¡ (NOASCII) 14:BACKSPACE
+ '.', 'q', 'w', 'e', 'r', //15 // 15:TAB
+ 't', 'y', 'u', 'i', 'o', //20
+ 'p', '`', '+', '\n', '.', //25 // 29:LCTRL
+ 'a', 's', 'd', 'f', 'g', //30
+ 'h', 'j', 'k', 'l', 'n', //35 // 39:ñ (NOASCII)
+ '\'', '.', '.', 'c', 'z', //40 // 42:LMAYUS 43:ç (NOASCII)
+ 'x', 'c', 'v', 'b', 'n', //45
+ 'm', ',', '.', '-', '.', //50 // 52:. 54:RMAYUS
+ '*', '.', ' ', '.', '.', //55 // 56:ALT 58:BLKMAYUS 59-68:F1-F10
+ '.', '.', '.', '.', '.', //60
+ '.', '.', '.', '.', '.', //65
+ '.', '7', '8', '9', '-', //70
+ '4', '5', '6', '+', '1', //75
+ '2', '3', '.', '.', '.', //80
+ '.', '<', '.', '.', '.', //85
+ '.', '.', '.', '.', '.', //90
+ '.', '\n', '.', '/', '.', //95 // 97:RCTRL
+ '.', '.', '.', '.', '.', //100 // 100:ALTGR 103:up_arrow
+ '.', '.', '.', '.', '.', //105 // 105:l_arrow 106:r_arrow 108:dwn_arrow
+};
+
+
+#endif // __MAP_ES
diff --git a/maps/maps.h b/maps/maps.h
new file mode 100644
index 0000000..399d3df
--- /dev/null
+++ b/maps/maps.h
@@ -0,0 +1,45 @@
+/*
+ * ## KEYBOARD LAYOUT MAPS ##
+ *
+ * Each map is an array where the content of each position is the key value
+ * associated with the event code (index). An special/unknown key is represented
+ * as a dot ('.'). The dot key itself has its own macro (KEY_DOT).
+ *
+ * By the moment, evspy does not support non-ascii characters.
+ *
+ * Select your map with EVS_MAP macro in evspy-core.h
+ */
+
+#ifndef __EVS_MAPS
+#define __EVS_MAPS
+
+#include <linux/input.h>
+#include "../khashmap/khashmap.h"
+
+#define EVS_SHIFT(KEY, VALUE) khm_insert(shm, (KEY), (VALUE))
+
+static struct khashmap *shm;
+
+static inline void exit_map(void)
+{
+ khm_destroy(shm);
+}
+
+static inline void init_shiftmap_global(void)
+{
+ shm = khm_create();
+}
+
+#define EVS_KLAY_EN 0
+#define EVS_KLAY_ES 1
+
+// Load the map associated with the given keyboard layout
+#ifndef EVS_KLAY
+#include "map_es.h" // default layout
+#elif EVS_KLAY == EVS_KLAY_EN
+#include "map_en.h"
+#elif EVS_KLAY == EVS_KLAY_ES
+#include "map_es.h"
+#endif // EVS_KLAY
+
+#endif // __EVS_MAPS