4 * Open Hack'Ware BIOS generic keyboard management definitions.
6 * Copyright (c) 2005 Jocelyn Mayer
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License V2
10 * as published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #if !defined (__OHW_KBD_H__)
25 typedef struct kbd_t kbd_t
;
26 typedef struct keymap_t keymap_t
;
32 * Not used for now -+ | | |
33 * Locks ---------------+ | |
34 * Left modifiers ---------+ |
35 * Right modifiers -----------+
54 KBD_LCK_SCROLL
= 0x04,
66 KBD_TYPE_REGULAR
= 0 << 24,
67 KBD_TYPE_LMOD
= 1 << 24,
68 KBD_TYPE_RMOD
= 2 << 24,
69 KBD_TYPE_LOCK
= 3 << 24,
72 #define KBD_MOD_MAP(mod) \
73 KBD_SH_NONE, { (mod), (mod), (mod), (mod), (mod), (mod), (mod), (mod), \
74 (mod), (mod), (mod), (mod), (mod), (mod), (mod), (mod), \
75 (mod), (mod), (mod), (mod), (mod), (mod), (mod), (mod), \
76 (mod), (mod), (mod), (mod), (mod), (mod), (mod), (mod), }
77 #define KBD_MOD_MAP_LSHIFT KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_SHIFT)
78 #define KBD_MOD_MAP_RSHIFT KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_SHIFT << 8))
79 #define KBD_MOD_MAP_LCTRL KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_CTRL)
80 #define KBD_MOD_MAP_RCTRL KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_CTRL << 8))
81 #define KBD_MOD_MAP_LALT KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_ALT)
82 #define KBD_MOD_MAP_RALT KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_ALT << 8))
83 #define KBD_MOD_MAP_LCMD KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_CMD)
84 #define KBD_MOD_MAP_RCMD KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_CMD << 8))
85 #define KBD_MOD_MAP_LOPT KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_OPT)
86 #define KBD_MOD_MAP_ROPT KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_OPT << 8))
87 #define KBD_MOD_MAP_CAPS KBD_MOD_MAP(KBD_TYPE_LOCK | (KBD_LCK_CAPS << 16))
88 #define KBD_MOD_MAP_NUML KBD_MOD_MAP(KBD_TYPE_LOCK | (KBD_LCK_NUML << 16))
89 #define KBD_MOD_MAP_SCROLL KBD_MOD_MAP(KBD_TYPE_LOCK | (KBD_LCK_SCRL << 16))
90 #define KBD_MAP_NONE KBD_MOD_MAP(-1)
92 /* Keymap definition */
94 /* Set the lock which applies to this key (if any) */
96 /* Key translations */
100 void *kbd_new (int len
);
101 int kbd_set_keymap (kbd_t
*kbd
, int nb_keys
, keymap_t
*keymap
);
102 int kbd_translate_key (kbd_t
*kbd
, int keycode
, int up_down
);
104 #endif /* !defined (__OHW_KBD_H__) */