Home | History | Annotate | Line # | Download | only in dev
      1 /* $NetBSD: vnckbdmap.c,v 1.2 2011/12/30 12:14:44 jmcneill Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1999,2001,2011 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Lennart Augustsson (lennart (at) augustsson.net) at
      9  * Carlstedt Research & Technology.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions and the following disclaimer.
     16  * 2. Redistributions in binary form must reproduce the above copyright
     17  *    notice, this list of conditions and the following disclaimer in the
     18  *    documentation and/or other materials provided with the distribution.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30  * POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 #include <sys/cdefs.h>
     34 __KERNEL_RCSID(0, "$NetBSD: vnckbdmap.c,v 1.2 2011/12/30 12:14:44 jmcneill Exp $");
     35 
     36 #include <sys/types.h>
     37 #include <dev/wscons/wsksymdef.h>
     38 #include <dev/wscons/wsksymvar.h>
     39 
     40 #define KC(n)		KS_KEYCODE(n)
     41 
     42 static const keysym_t vnckbd_keydesc_us[] = {
     43 /*  pos      command		normal		shifted */
     44 
     45     /* X11 TTY function keys */
     46     KC(0xf08),			KS_BackSpace,
     47     KC(0xf09),			KS_Tab,
     48     KC(0xf0a),			KS_Linefeed,
     49     KC(0xf0b),			KS_Clear,
     50     KC(0xf0d),			KS_Return,
     51     KC(0xf13),			KS_Pause,
     52     KC(0xf14),			KS_Hold_Screen,
     53 //  KC(0xf15),			KS_SysReq,
     54     KC(0xf1b),	KS_Cmd_Debugger, KS_Escape,
     55     KC(0xfff),			KS_Delete,
     56 
     57     /* X11 cursor control & motion */
     58     KC(0xf50),			KS_Home,
     59     KC(0xf51),			KS_Left,
     60     KC(0xf52),			KS_Up,
     61     KC(0xf53),			KS_Right,
     62     KC(0xf54),			KS_Down,
     63     KC(0xf55),	KS_Cmd_ScrollFastUp, KS_Prior,
     64     KC(0xf56),	KS_Cmd_ScrollFastDown, KS_Next,
     65     KC(0xf57),			KS_End,
     66 //  KC(0xf58),			KS_Begin,
     67 
     68     /* X11 misc functions */
     69     KC(0xf60),			KS_Select,
     70     KC(0xf61),			KS_Print_Screen,
     71     KC(0xf62),			KS_Execute,
     72     KC(0xf63),			KS_Insert,
     73     KC(0xf65),			KS_Undo,
     74     KC(0xf66),			KS_Again,
     75     KC(0xf67),			KS_Menu,
     76     KC(0xf68),			KS_Find,
     77 //  KC(0xf69),			KS_Cancel,
     78     KC(0xf6a),			KS_Help,
     79 //  KC(0xf6b),			KS_Break,
     80     KC(0xf7e),			KS_Mode_switch,
     81     KC(0xf7f),			KS_Num_Lock,
     82 
     83     /* X11 keypad functions */
     84     /* ... */
     85 
     86     /* X11 auxiliary functions */
     87     KC(0xfbe),	KS_Cmd_Screen0,	KS_F1,
     88     KC(0xfbf),	KS_Cmd_Screen1,	KS_F2,
     89     KC(0xfc0),	KS_Cmd_Screen2,	KS_F3,
     90     KC(0xfc1),	KS_Cmd_Screen3,	KS_F4,
     91     KC(0xfc2),	KS_Cmd_Screen4,	KS_F5,
     92     KC(0xfc3),	KS_Cmd_Screen5,	KS_F6,
     93     KC(0xfc4),	KS_Cmd_Screen6,	KS_F7,
     94     KC(0xfc5),	KS_Cmd_Screen7,	KS_F8,
     95     KC(0xfc6),	KS_Cmd_Screen8,	KS_F9,
     96     KC(0xfc7),	KS_Cmd_Screen9,	KS_F10,
     97     KC(0xfc8),			KS_F11,
     98     KC(0xfc9),			KS_F12,
     99     KC(0xfca),			KS_F13,
    100     KC(0xfcb),			KS_F14,
    101     KC(0xfcc),			KS_F15,
    102     KC(0xfcd),			KS_F16,
    103     KC(0xfce),			KS_F17,
    104     KC(0xfcf),			KS_F18,
    105     KC(0xfd0),			KS_F19,
    106     KC(0xfd1),			KS_F20,
    107     /* ... F21 - F35 */
    108 
    109     /* X11 modifiers */
    110     KC(0xfe1),			KS_Shift_L,
    111     KC(0xfe2),			KS_Shift_R,
    112     KC(0xfe3),	KS_Cmd1,	KS_Control_L,
    113     KC(0xfe4),			KS_Control_R,
    114     KC(0xfe5),			KS_Caps_Lock,
    115     KC(0xfe6),			KS_Shift_Lock,
    116     KC(0xfe7),	KS_Cmd2,	KS_Meta_L,
    117     KC(0xfe8),			KS_Meta_R,
    118     KC(0xfe9),			KS_Alt_L,
    119     KC(0xfea),			KS_Alt_R,
    120 //  KC(0xfeb),			KS_Super_L,
    121 //  KC(0xfec),			KS_Super_R,
    122 //  KC(0xfed),			KS_Hyper_L,
    123 //  KC(0xfee),			KS_Hyper_R,
    124 
    125     /* Latin 1 */
    126     KC(0x20),			KS_space,
    127     KC(0x21),			KS_exclam,
    128     KC(0x22),			KS_quotedbl,
    129     KC(0x23),			KS_numbersign,
    130     KC(0x24),			KS_dollar,
    131     KC(0x25),			KS_percent,
    132     KC(0x26),			KS_ampersand,
    133     KC(0x27),			KS_apostrophe,
    134     KC(0x28),			KS_parenleft,
    135     KC(0x29),			KS_parenright,
    136     KC(0x2a),			KS_asterisk,
    137     KC(0x2b),			KS_plus,
    138     KC(0x2c),			KS_comma,
    139     KC(0x2d),			KS_minus,
    140     KC(0x2e),			KS_period,
    141     KC(0x2f),			KS_slash,
    142     KC(0x30), 			KS_0,
    143     KC(0x31),  			KS_1,
    144     KC(0x32),  			KS_2,
    145     KC(0x33),  			KS_3,
    146     KC(0x34),  			KS_4,
    147     KC(0x35),  			KS_5,
    148     KC(0x36),  			KS_6,
    149     KC(0x37),  			KS_7,
    150     KC(0x38),  			KS_8,
    151     KC(0x39), 			KS_9,
    152     KC(0x3a),			KS_colon,
    153     KC(0x3b),			KS_semicolon,
    154     KC(0x3c),			KS_less,
    155     KC(0x3d),			KS_equal,
    156     KC(0x3e),			KS_greater,
    157     KC(0x3f),			KS_question,
    158     KC(0x40),			KS_at,
    159     KC(0x41),			KS_A,
    160     KC(0x42),			KS_B,
    161     KC(0x43),			KS_C,
    162     KC(0x44),			KS_D,
    163     KC(0x45),			KS_E,
    164     KC(0x46),			KS_F,
    165     KC(0x47),			KS_G,
    166     KC(0x48),			KS_H,
    167     KC(0x49),			KS_I,
    168     KC(0x4a),			KS_J,
    169     KC(0x4b),			KS_K,
    170     KC(0x4c),			KS_L,
    171     KC(0x4d),			KS_M,
    172     KC(0x4e),			KS_N,
    173     KC(0x4f),			KS_O,
    174     KC(0x50),			KS_P,
    175     KC(0x51),			KS_Q,
    176     KC(0x52),			KS_R,
    177     KC(0x53),			KS_S,
    178     KC(0x54),			KS_T,
    179     KC(0x55),			KS_U,
    180     KC(0x56),			KS_V,
    181     KC(0x57),			KS_W,
    182     KC(0x58),			KS_X,
    183     KC(0x59),			KS_Y,
    184     KC(0x5a),			KS_Z,
    185     KC(0x5b),			KS_bracketleft,
    186     KC(0x5c),			KS_backslash,
    187     KC(0x5d),			KS_bracketright,
    188     KC(0x5e),			KS_asciicircum,
    189     KC(0x5f),			KS_underscore,
    190     KC(0x60),			KS_grave,
    191     KC(0x61), 			KS_a,
    192     KC(0x62), 			KS_b,
    193     KC(0x63), 			KS_c,
    194     KC(0x64), 			KS_d,
    195     KC(0x65), 			KS_e,
    196     KC(0x66), 			KS_f,
    197     KC(0x67), 			KS_g,
    198     KC(0x68), 			KS_h,
    199     KC(0x69), 			KS_i,
    200     KC(0x6a), 			KS_j,
    201     KC(0x6b), 			KS_k,
    202     KC(0x6c), 			KS_l,
    203     KC(0x6d), 			KS_m,
    204     KC(0x6e), 			KS_n,
    205     KC(0x6f), 			KS_o,
    206     KC(0x70), 			KS_p,
    207     KC(0x71), 			KS_q,
    208     KC(0x72), 			KS_r,
    209     KC(0x73), 			KS_s,
    210     KC(0x74), 			KS_t,
    211     KC(0x75), 			KS_u,
    212     KC(0x76), 			KS_v,
    213     KC(0x77), 			KS_w,
    214     KC(0x78), 			KS_x,
    215     KC(0x79), 			KS_y,
    216     KC(0x7a), 			KS_z,
    217     KC(0x7b),			KS_braceleft,
    218     KC(0x7c),			KS_bar,
    219     KC(0x7d),			KS_braceright,
    220     KC(0x7e),			KS_asciitilde,
    221     KC(0x7f),			KS_Delete,
    222 /* TODO:
    223     KC(0xa0),			KS_nobreakspace,
    224     KC(0xa1),			KS_exclamdown,
    225     KC(0xa2),			KS_cent,
    226     KC(0xa3),			KS_sterling,
    227     ...
    228  */
    229 
    230 };
    231 
    232 #define KBD_MAP(name, base, map) \
    233 			{ name, base, sizeof(map)/sizeof(keysym_t), map }
    234 
    235 const struct wscons_keydesc vnckbd_keydesctab[] = {
    236 	KBD_MAP(KB_US,			0,	vnckbd_keydesc_us),
    237 	{0, 0, 0, 0}
    238 };
    239 
    240 #undef KBD_MAP
    241 #undef KC
    242