Changeset c072a29 in mainline for uspace/srv/hid/input/ctl/apple.c


Ignore:
Timestamp:
2014-09-15T15:57:32Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5c79fb5
Parents:
662ebc8
Message:

use the PAUSE / BREAK key to activate the kernel console in compositor (F15 on some strange keyboards)
this avoids issues with stuck modifier keys and other surprises
it is also unlikely that any client applications would like to use these keys

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/ctl/apple.c

    r662ebc8 rc072a29  
    5252};
    5353
    54 #define KBD_KEY_RELEASE         0x80
    55 
    56 static kbd_dev_t *kbd_dev;
    57 
    58 static int scanmap[];
    59 
    60 static int apple_ctl_init(kbd_dev_t *kdev)
    61 {
    62         kbd_dev = kdev;
    63         return 0;
    64 }
    65 
    66 static void apple_ctl_parse(sysarg_t scancode)
    67 {
    68         kbd_event_type_t type;
    69         unsigned int key;
    70 
    71         if (scancode >= 0x100)
    72                 return;
    73 
    74         if (scancode & KBD_KEY_RELEASE) {
    75                 scancode &= ~KBD_KEY_RELEASE;
    76                 type = KEY_RELEASE;
    77         } else {
    78                 type = KEY_PRESS;
    79         }
    80 
    81         key = scanmap[scancode];
    82         if (key != 0)
    83                 kbd_push_event(kbd_dev, type, key);
    84 }
    85 
    86 static void apple_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
    87 {
    88         (void) mods;
    89 }
    90 
    91 static int scanmap[] = {
     54#define KBD_KEY_RELEASE  0x80
     55
     56static unsigned int scanmap[] = {
    9257        [0x00] = KC_A,
    9358        [0x01] = KC_S,
     
    195160        [0x67] = KC_F11,
    196161        [0x68] = 0,
    197         [0x69] = 0,
     162        [0x69] = KC_SYSREQ,
    198163        [0x6a] = 0,
    199164        [0x6b] = KC_SCROLL_LOCK,
     
    203168        [0x6f] = KC_F12,
    204169        [0x70] = 0,
    205         [0x71] = 0,
     170        [0x71] = KC_PAUSE,
    206171        [0x72] = KC_INSERT,
    207172        [0x73] = KC_HOME,
     
    220185};
    221186
     187static kbd_dev_t *kbd_dev;
     188
     189static int apple_ctl_init(kbd_dev_t *kdev)
     190{
     191        kbd_dev = kdev;
     192        return 0;
     193}
     194
     195static void apple_ctl_parse(sysarg_t scancode)
     196{
     197        kbd_event_type_t type;
     198       
     199        if (scancode & KBD_KEY_RELEASE) {
     200                scancode &= ~KBD_KEY_RELEASE;
     201                type = KEY_RELEASE;
     202        } else
     203                type = KEY_PRESS;
     204       
     205        if (scancode >= sizeof(scanmap) / sizeof(unsigned int))
     206                return;
     207       
     208        unsigned int key = scanmap[scancode];
     209        if (key != 0)
     210                kbd_push_event(kbd_dev, type, key);
     211}
     212
     213static void apple_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
     214{
     215        (void) mods;
     216}
     217
    222218/** @}
    223219 */
Note: See TracChangeset for help on using the changeset viewer.