Subversion Repositories HelenOS

Rev

Rev 3923 | Rev 4344 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3923 svoboda 1
/*
2
 * Copyright (c) 2009 Jiri Svoboda
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
 
29
/** @addtogroup kbd
30
 * @brief   US QWERTY leyout.
31
 * @{
32
 */
33
 
34
#include <kbd.h>
35
#include <kbd/kbd.h>
36
#include <kbd/keycode.h>
37
#include <layout.h>
38
 
39
static int map_normal[] = {
40
    [KC_BACKTICK] = '`',
41
 
42
    [KC_1] = '1',
43
    [KC_2] = '2',
44
    [KC_3] = '3',
45
    [KC_4] = '4',
46
    [KC_5] = '5',
47
    [KC_6] = '6',
48
    [KC_7] = '7',
49
    [KC_8] = '8',
50
    [KC_9] = '9',
51
    [KC_0] = '0',
52
 
53
    [KC_MINUS] = '-',
54
    [KC_EQUALS] = '=',
55
    [KC_BACKSPACE] = '\b',
56
 
57
    [KC_TAB] = '\t',
58
 
59
    [KC_Q] = 'q',
60
    [KC_W] = 'w',
61
    [KC_E] = 'e',
62
    [KC_R] = 'r',
63
    [KC_T] = 't',
64
    [KC_Y] = 'y',
65
    [KC_U] = 'u',
66
    [KC_I] = 'i',
67
    [KC_O] = 'o',
68
    [KC_P] = 'p',
69
 
70
    [KC_LBRACKET] = '[',
71
    [KC_RBRACKET] = ']',
72
 
73
    [KC_A] = 'a',
74
    [KC_S] = 's',
75
    [KC_D] = 'd',
76
    [KC_F] = 'f',
77
    [KC_G] = 'g',
78
    [KC_H] = 'h',
79
    [KC_J] = 'j',
80
    [KC_K] = 'k',
81
    [KC_L] = 'l',
82
 
83
    [KC_SEMICOLON] = ';',
84
    [KC_QUOTE] = '\'',
85
    [KC_BACKSLASH] = '\\',
86
    [KC_ENTER] = '\n',
87
 
88
    [KC_Z] = 'z',
89
    [KC_X] = 'x',
90
    [KC_C] = 'c',
91
    [KC_V] = 'v',
92
    [KC_B] = 'b',
93
    [KC_N] = 'n',
94
    [KC_M] = 'm',
95
 
96
    [KC_COMMA] = ',',
97
    [KC_PERIOD] = '.',
98
    [KC_SLASH] = '/',
99
 
100
    [KC_SPACE] = ' '
101
};
102
 
103
char layout_parse_ev(kbd_event_t *ev)
104
{
105
    if (ev->key >= sizeof(map_normal) / sizeof(int))
106
        return 0;
107
 
108
    return map_normal[ev->key];
109
}
110
 
111
/**
112
 * @}
113
 */