aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/include/proto/keyboard.h40
-rw-r--r--src/common/libalgo/hashtbl.c4
2 files changed, 41 insertions, 3 deletions
diff --git a/src/common/include/proto/keyboard.h b/src/common/include/proto/keyboard.h
index 044946d..8d9543f 100644
--- a/src/common/include/proto/keyboard.h
+++ b/src/common/include/proto/keyboard.h
@@ -14,7 +14,45 @@ typedef struct {
#define IOCTL_KBD_SET_LEDS 10
#define KBD_LED_SCROLLLOCK 1
-#define KBD_LED_NUMLOCK 1
+#define KBD_LED_NUMLOCK 2
#define KBD_LED_CAPSLOCK 4
+#define KBD_CODE_ESC 1
+#define KBD_CODE_RETURN 28
+#define KBD_CODE_BKSP 14
+#define KBD_CODE_UP 200
+#define KBD_CODE_DOWN 208
+#define KBD_CODE_LEFT 203
+#define KBD_CODE_RIGHT 205
+#define KBD_CODE_HOME 199
+#define KBD_CODE_END 207
+#define KBD_CODE_PGUP 201
+#define KBD_CODE_PGDOWN 209
+
+#define KBD_CODE_LSHIFT 42
+#define KBD_CODE_RSHIFT 54
+#define KBD_CODE_CAPSLOCK 58
+#define KBD_CODE_LCTRL 29
+#define KBD_CODE_RCTRL 157
+#define KBD_CODE_LALT 56
+#define KBD_CODE_RALT 184
+#define KBD_CODE_SUPER 219
+#define KBD_CODE_MENU 221
+#define KBD_CODE_TAB 15
+#define KBD_CODE_INS 210
+#define KBD_CODE_DEL 211
+
+#define KBD_CODE_F1 59
+#define KBD_CODE_F2 60
+#define KBD_CODE_F3 61
+#define KBD_CODE_F4 62
+#define KBD_CODE_F5 63
+#define KBD_CODE_F6 64
+#define KBD_CODE_F7 65
+#define KBD_CODE_F8 66
+#define KBD_CODE_F9 67
+#define KBD_CODE_F10 68
+#define KBD_CODE_F11 87
+#define KBD_CODE_F12 88
+
/* vim: set ts=4 sw=4 tw=0 noet :*/
diff --git a/src/common/libalgo/hashtbl.c b/src/common/libalgo/hashtbl.c
index f34c6d4..7192bd4 100644
--- a/src/common/libalgo/hashtbl.c
+++ b/src/common/libalgo/hashtbl.c
@@ -90,11 +90,11 @@ static void hashtbl_check_size(hashtbl_t *ht) {
}
bool hashtbl_add(hashtbl_t *ht, void* key, void* v) {
- size_t slot = SLOT_OF_HASH(ht->hf(key), ht->size);
-
hashtbl_item_t *i = (hashtbl_item_t*)malloc(sizeof(hashtbl_item_t));
if (i == 0) return false; // OOM
+ size_t slot = SLOT_OF_HASH(ht->hf(key), ht->size);
+
// make sure item is not already present
hashtbl_remove(ht, key);