Subversion Repositories HelenOS

Rev

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

  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 Dvorak Simplified Keyboard layout.
  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] = '\'',
  60.     [KC_W] = ',',
  61.     [KC_E] = '.',
  62.     [KC_R] = 'p',
  63.     [KC_T] = 'y',
  64.     [KC_Y] = 'f',
  65.     [KC_U] = 'g',
  66.     [KC_I] = 'c',
  67.     [KC_O] = 'r',
  68.     [KC_P] = 'l',
  69.  
  70.     [KC_LBRACKET] = '/',
  71.     [KC_RBRACKET] = '=',
  72.  
  73.     [KC_A] = 'a',
  74.     [KC_S] = 'o',
  75.     [KC_D] = 'e',
  76.     [KC_F] = 'u',
  77.     [KC_G] = 'i',
  78.     [KC_H] = 'd',
  79.     [KC_J] = 'h',
  80.     [KC_K] = 't',
  81.     [KC_L] = 'n',
  82.  
  83.     [KC_SEMICOLON] = 's',
  84.     [KC_QUOTE] = '-',
  85.     [KC_BACKSLASH] = '\\',
  86.  
  87.     [KC_Z] = ';',
  88.     [KC_X] = 'q',
  89.     [KC_C] = 'j',
  90.     [KC_V] = 'k',
  91.     [KC_B] = 'x',
  92.     [KC_N] = 'b',
  93.     [KC_M] = 'm',
  94.  
  95.     [KC_COMMA] = 'w',
  96.     [KC_PERIOD] = 'v',
  97.     [KC_SLASH] = 'z',
  98.  
  99.     [KC_ENTER] = '\n'
  100. };
  101.  
  102. char layout_parse_ev(kbd_event_t *ev)
  103. {
  104.     if (ev->key >= sizeof(map_normal) / sizeof(int))
  105.         return 0;
  106.  
  107.     return map_normal[ev->key];
  108. }
  109.  
  110. /**
  111.  * @}
  112.  */
  113.