Subversion Repositories HelenOS

Rev

Rev 4055 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (c) 2006 Jakub Jermar
  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 genarch
  30.  * @{
  31.  */
  32. /**
  33.  * @file
  34.  * @brief Scan codes for Sun keyboards.
  35.  */
  36.  
  37. #include <genarch/kbrd/scanc.h>
  38. #include <typedefs.h>
  39. #include <string.h>
  40.  
  41. /** Primary meaning of scancodes. */
  42. wchar_t sc_primary_map[SCANCODES] = {
  43.     [0x00] = U_SPECIAL,
  44.     [0x01] = U_SPECIAL,
  45.     [0x02] = U_SPECIAL,
  46.     [0x03] = U_SPECIAL,
  47.     [0x04] = U_SPECIAL,
  48.     [0x05] = U_SPECIAL,      /* F1 */
  49.     [0x06] = U_SPECIAL,      /* F2 */
  50.     [0x07] = U_SPECIAL,      /* F10 */
  51.     [0x08] = U_SPECIAL,      /* F3 */
  52.     [0x09] = U_SPECIAL,      /* F11 */
  53.     [0x0a] = U_SPECIAL,      /* F4 */
  54.     [0x0b] = U_SPECIAL,      /* F12 */
  55.     [0x0c] = U_SPECIAL,      /* F5 */
  56.     [0x0d] = U_SPECIAL,      /* Right Alt */
  57.     [0x0e] = U_SPECIAL,      /* F6 */
  58.     [0x0f] = U_SPECIAL,
  59.     [0x10] = U_SPECIAL,      /* F7 */
  60.     [0x11] = U_SPECIAL,      /* F8 */
  61.     [0x12] = U_SPECIAL,      /* F9 */
  62.     [0x13] = U_SPECIAL,      /* Left Alt */
  63.     [0x14] = U_UP_ARROW,     /* Up Arrow */
  64.     [0x15] = U_SPECIAL,      /* Pause */
  65.     [0x16] = U_SPECIAL,
  66.     [0x17] = U_SPECIAL,      /* Scroll Lock */
  67.     [0x18] = U_LEFT_ARROW,   /* Left Arrow */
  68.     [0x19] = U_SPECIAL,
  69.     [0x1a] = U_SPECIAL,
  70.     [0x1b] = U_DOWN_ARROW,   /* Down Arrow */
  71.     [0x1c] = U_RIGHT_ARROW,  /* Right Arrow */
  72.     [0x1d] = U_ESCAPE,       /* Esc */
  73.     [0x1e] = '1',
  74.     [0x1f] = '2',
  75.     [0x20] = '3',
  76.     [0x21] = '4',
  77.     [0x22] = '5',
  78.     [0x23] = '6',
  79.     [0x24] = '7',
  80.     [0x25] = '8',
  81.     [0x26] = '9',
  82.     [0x27] = '0',
  83.     [0x28] = '-',
  84.     [0x29] = '=',
  85.     [0x2a] = '`',
  86.     [0x2b] = '\b',           /* Backspace */
  87.     [0x2c] = U_SPECIAL,      /* Insert */
  88.     [0x2d] = U_SPECIAL,
  89.     [0x2e] = '/',            /* Numpad / */
  90.     [0x2f] = '*',            /* Numpad * */
  91.     [0x30] = U_SPECIAL,
  92.     [0x31] = U_SPECIAL,
  93.     [0x32] = '.',            /* Numpad . */
  94.     [0x33] = U_SPECIAL,
  95.     [0x34] = U_HOME_ARROW,   /* Home */
  96.     [0x35] = '\t',           /* Tab */
  97.     [0x36] = 'q',
  98.     [0x37] = 'w',
  99.     [0x38] = 'e',
  100.     [0x39] = 'r',
  101.     [0x3a] = 't',
  102.     [0x3b] = 'y',
  103.     [0x3c] = 'u',
  104.     [0x3d] = 'i',
  105.     [0x3e] = 'o',
  106.     [0x3f] = 'p',
  107.     [0x40] = '[',
  108.     [0x41] = ']',
  109.     [0x42] = U_DELETE,       /* Delete */
  110.     [0x43] = U_SPECIAL,
  111.     [0x44] = '7',            /* Numpad 7 */
  112.     [0x45] = '8',            /* Numpad 8 */
  113.     [0x46] = '9',            /* Numpad 9 */
  114.     [0x47] = '-',            /* Numpad - */
  115.     [0x48] = U_SPECIAL,
  116.     [0x49] = U_SPECIAL,
  117.     [0x4a] = U_END_ARROW,    /* End */
  118.     [0x4b] = U_SPECIAL,
  119.     [0x4c] = U_SPECIAL,      /* Control */
  120.     [0x4d] = 'a',
  121.     [0x4e] = 's',
  122.     [0x4f] = 'd',
  123.     [0x50] = 'f',
  124.     [0x51] = 'g',
  125.     [0x52] = 'h',
  126.     [0x53] = 'j',
  127.     [0x54] = 'k',
  128.     [0x55] = 'l',
  129.     [0x56] = ';',
  130.     [0x57] = '\'',
  131.     [0x58] = '\\',
  132.     [0x59] = '\n',           /* Enter */
  133.     [0x5a] = '\n',           /* Numpad Enter */
  134.     [0x5b] = '4',            /* Numpad 4 */
  135.     [0x5c] = '5',            /* Numpad 5 */
  136.     [0x5d] = '6',            /* Numpad 6 */
  137.     [0x5e] = '0',            /* Numpad 0 */
  138.     [0x5f] = U_SPECIAL,
  139.     [0x60] = U_PAGE_UP,      /* Page Up */
  140.     [0x61] = U_SPECIAL,
  141.     [0x62] = U_SPECIAL,      /* NumLock */
  142.     [0x63] = U_SPECIAL,      /* Left Shift */
  143.     [0x64] = 'z',
  144.     [0x65] = 'x',
  145.     [0x66] = 'c',
  146.     [0x67] = 'v',
  147.     [0x68] = 'b',
  148.     [0x69] = 'n',
  149.     [0x6a] = 'm',
  150.     [0x6b] = ',',
  151.     [0x6c] = '.',
  152.     [0x6d] = '/',
  153.     [0x6e] = U_SPECIAL,      /* Right Shift */
  154.     [0x6f] = U_SPECIAL,
  155.     [0x70] = '1',            /* Numpad 1 */
  156.     [0x71] = '2',            /* Numpad 2 */
  157.     [0x72] = '3',            /* Numpad 3 */
  158.     [0x73] = U_SPECIAL,
  159.     [0x74] = U_SPECIAL,
  160.     [0x75] = U_SPECIAL,
  161.     [0x76] = U_SPECIAL,
  162.     [0x77] = U_SPECIAL,      /* CapsLock */
  163.     [0x78] = U_SPECIAL,
  164.     [0x79] = ' ',
  165.     [0x7a] = U_SPECIAL,
  166.     [0x7b] = U_PAGE_DOWN,    /* Page Down */
  167.     [0x7c] = U_SPECIAL,
  168.     [0x7d] = '+',            /* Numpad + */
  169.     [0x7e] = U_SPECIAL,
  170.     [0x7f] = U_SPECIAL
  171. };
  172.  
  173. /** Secondary meaning of scancodes. */
  174. wchar_t sc_secondary_map[SCANCODES] = {
  175.     [0x00] = U_SPECIAL,
  176.     [0x01] = U_SPECIAL,
  177.     [0x02] = U_SPECIAL,
  178.     [0x03] = U_SPECIAL,
  179.     [0x04] = U_SPECIAL,
  180.     [0x05] = U_SPECIAL,      /* F1 */
  181.     [0x06] = U_SPECIAL,      /* F2 */
  182.     [0x07] = U_SPECIAL,      /* F10 */
  183.     [0x08] = U_SPECIAL,      /* F3 */
  184.     [0x09] = U_SPECIAL,      /* F11 */
  185.     [0x0a] = U_SPECIAL,      /* F4 */
  186.     [0x0b] = U_SPECIAL,      /* F12 */
  187.     [0x0c] = U_SPECIAL,      /* F5 */
  188.     [0x0d] = U_SPECIAL,      /* Right Alt */
  189.     [0x0e] = U_SPECIAL,      /* F6 */
  190.     [0x0f] = U_SPECIAL,
  191.     [0x10] = U_SPECIAL,      /* F7 */
  192.     [0x11] = U_SPECIAL,      /* F8 */
  193.     [0x12] = U_SPECIAL,      /* F9 */
  194.     [0x13] = U_SPECIAL,      /* Left Alt */
  195.     [0x14] = U_UP_ARROW,     /* Up Arrow */
  196.     [0x15] = U_SPECIAL,      /* Pause */
  197.     [0x16] = U_SPECIAL,
  198.     [0x17] = U_SPECIAL,      /* Scroll Lock */
  199.     [0x18] = U_LEFT_ARROW,   /* Left Arrow */
  200.     [0x19] = U_SPECIAL,
  201.     [0x1a] = U_SPECIAL,
  202.     [0x1b] = U_DOWN_ARROW,   /* Down Arrow */
  203.     [0x1c] = U_RIGHT_ARROW,  /* Right Arrow */
  204.     [0x1d] = U_ESCAPE,       /* Esc */
  205.     [0x1e] = '!',
  206.     [0x1f] = '@',
  207.     [0x20] = '#',
  208.     [0x21] = '$',
  209.     [0x22] = '%',
  210.     [0x23] = '^',
  211.     [0x24] = '&',
  212.     [0x25] = '*',
  213.     [0x26] = '(',
  214.     [0x27] = ')',
  215.     [0x28] = '_',
  216.     [0x29] = '+',
  217.     [0x2a] = '~',
  218.     [0x2b] = '\b',           /* Backspace */
  219.     [0x2c] = U_SPECIAL,      /* Insert */
  220.     [0x2d] = U_SPECIAL,
  221.     [0x2e] = '/',            /* Numpad / */
  222.     [0x2f] = '*',            /* Numpad * */
  223.     [0x30] = U_SPECIAL,
  224.     [0x31] = U_SPECIAL,
  225.     [0x32] = '.',            /* Numpad . */
  226.     [0x33] = U_SPECIAL,
  227.     [0x34] = U_HOME_ARROW,   /* Home */
  228.     [0x35] = '\t',           /* Tab */
  229.     [0x36] = 'Q',
  230.     [0x37] = 'W',
  231.     [0x38] = 'E',
  232.     [0x39] = 'R',
  233.     [0x3a] = 'T',
  234.     [0x3b] = 'Y',
  235.     [0x3c] = 'U',
  236.     [0x3d] = 'I',
  237.     [0x3e] = 'O',
  238.     [0x3f] = 'P',
  239.     [0x40] = '{',
  240.     [0x41] = '}',
  241.     [0x42] = U_DELETE,       /* Delete */
  242.     [0x43] = U_SPECIAL,
  243.     [0x44] = '7',            /* Numpad 7 */
  244.     [0x45] = '8',            /* Numpad 8 */
  245.     [0x46] = '9',            /* Numpad 9 */
  246.     [0x47] = '-',            /* Numpad - */
  247.     [0x48] = U_SPECIAL,
  248.     [0x49] = U_SPECIAL,
  249.     [0x4a] = U_END_ARROW,    /* End */
  250.     [0x4b] = U_SPECIAL,
  251.     [0x4c] = U_SPECIAL,      /* Control */
  252.     [0x4d] = 'A',
  253.     [0x4e] = 'S',
  254.     [0x4f] = 'D',
  255.     [0x50] = 'F',
  256.     [0x51] = 'G',
  257.     [0x52] = 'H',
  258.     [0x53] = 'J',
  259.     [0x54] = 'K',
  260.     [0x55] = 'L',
  261.     [0x56] = ':',
  262.     [0x57] = '"',
  263.     [0x58] = '|',
  264.     [0x59] = '\n',           /* Enter */
  265.     [0x5a] = '\n',           /* Numpad Enter */
  266.     [0x5b] = '4',            /* Numpad 4 */
  267.     [0x5c] = '5',            /* Numpad 5 */
  268.     [0x5d] = '6',            /* Numpad 6 */
  269.     [0x5e] = '0',            /* Numpad 0 */
  270.     [0x5f] = U_SPECIAL,
  271.     [0x60] = U_PAGE_UP,      /* Page Up */
  272.     [0x61] = U_SPECIAL,
  273.     [0x62] = U_SPECIAL,      /* NumLock */
  274.     [0x63] = U_SPECIAL,      /* Left Shift */
  275.     [0x64] = 'Z',
  276.     [0x65] = 'X',
  277.     [0x66] = 'C',
  278.     [0x67] = 'V',
  279.     [0x68] = 'B',
  280.     [0x69] = 'N',
  281.     [0x6a] = 'M',
  282.     [0x6b] = '<',
  283.     [0x6c] = '>',
  284.     [0x6d] = '?',
  285.     [0x6e] = U_SPECIAL,      /* Right Shift */
  286.     [0x6f] = U_SPECIAL,
  287.     [0x70] = '1',            /* Numpad 1 */
  288.     [0x71] = '2',            /* Numpad 2 */
  289.     [0x72] = '3',            /* Numpad 3 */
  290.     [0x73] = U_SPECIAL,
  291.     [0x74] = U_SPECIAL,
  292.     [0x75] = U_SPECIAL,
  293.     [0x76] = U_SPECIAL,
  294.     [0x77] = U_SPECIAL,      /* CapsLock */
  295.     [0x78] = U_SPECIAL,
  296.     [0x79] = ' ',
  297.     [0x7a] = U_SPECIAL,
  298.     [0x7b] = U_PAGE_DOWN,    /* Page Down */
  299.     [0x7c] = U_SPECIAL,
  300.     [0x7d] = '+',            /* Numpad + */
  301.     [0x7e] = U_SPECIAL,
  302.     [0x7f] = U_SPECIAL
  303. };
  304.  
  305. /** @}
  306.  */
  307.