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., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
22
#if !defined (__OHW_KBD_H__)
24
typedef struct kbd_t kbd_t;
25
typedef struct keymap_t keymap_t;
31
* Not used for now -+ | | |
32
* Locks ---------------+ | |
33
* Left modifiers ---------+ |
34
* Right modifiers -----------+
37
const keymap_t *keymap;
38
const char **sequences;
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,
70
KBD_TYPE_SEQUENCE = 4 << 24,
73
#define KBD_SEQUENCE(sequence) (KBD_TYPE_SEQUENCE | (sequence))
75
#define KBD_MOD_MAP(mod) \
76
KBD_SH_NONE, { (mod), (mod), (mod), (mod), (mod), (mod), (mod), (mod), \
77
(mod), (mod), (mod), (mod), (mod), (mod), (mod), (mod), \
78
(mod), (mod), (mod), (mod), (mod), (mod), (mod), (mod), \
79
(mod), (mod), (mod), (mod), (mod), (mod), (mod), (mod), }
80
#define KBD_MOD_MAP_LSHIFT KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_SHIFT)
81
#define KBD_MOD_MAP_RSHIFT KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_SHIFT << 8))
82
#define KBD_MOD_MAP_LCTRL KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_CTRL)
83
#define KBD_MOD_MAP_RCTRL KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_CTRL << 8))
84
#define KBD_MOD_MAP_LALT KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_ALT)
85
#define KBD_MOD_MAP_RALT KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_ALT << 8))
86
#define KBD_MOD_MAP_LCMD KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_CMD)
87
#define KBD_MOD_MAP_RCMD KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_CMD << 8))
88
#define KBD_MOD_MAP_LOPT KBD_MOD_MAP(KBD_TYPE_LMOD | KBD_MOD_OPT)
89
#define KBD_MOD_MAP_ROPT KBD_MOD_MAP(KBD_TYPE_RMOD | (KBD_MOD_OPT << 8))
90
#define KBD_MOD_MAP_CAPS KBD_MOD_MAP(KBD_TYPE_LOCK | (KBD_LCK_CAPS << 16))
91
#define KBD_MOD_MAP_NUML KBD_MOD_MAP(KBD_TYPE_LOCK | (KBD_LCK_NUML << 16))
92
#define KBD_MOD_MAP_SCROLL KBD_MOD_MAP(KBD_TYPE_LOCK | (KBD_LCK_SCRL << 16))
93
#define KBD_MAP_NONE KBD_MOD_MAP(-1)
95
/* Keymap definition */
97
/* Set the lock which applies to this key (if any) */
99
/* Key translations */
103
void *kbd_new (int len);
104
int kbd_set_keymap (kbd_t *kbd, int nb_keys, const keymap_t *keymap,
105
const char **sequences);
106
int kbd_translate_key (kbd_t *kbd, int keycode, int up_down, char *sequence);
108
#endif /* !defined (__OHW_KBD_H__) */