summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/pc386/console/kbd_parser.c
blob: ad5a068948d3a97f66b93f76fc8246f48f2cbb62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 *  The contents of this file were formerly in console.c which
 *  had the following copyright notice:
 *
 *  (C) Copyright 1997
 *  NavIST Group - Real-Time Distributed Systems and Industrial Automation
 *  http://pandora.ist.utl.pt
 *  Instituto Superior Tecnico * Lisboa * PORTUGAL
 *
 *  The original code and subsequent modifications are:
 *
 *  COPYRIGHT (c) 1989-2011.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 */

#include <rtems.h>
#include <rtems/keyboard.h>
#include <rtems/mw_uid.h>

/* adds a kbd message to the queue */
static void kbd_parser( void *ptr, unsigned short keycode, unsigned long mods )
{
  struct MW_UID_MESSAGE m;
  struct kbd_struct * kbd = (struct kbd_struct *)ptr;

  m.type = MV_UID_KBD;
  m.m.kbd.code       = keycode;
  m.m.kbd.modifiers  = kbd->ledflagstate;
  m.m.kbd.mode       = kbd->kbdmode;
  /*  printk( "kbd: msg: keycode=%X, mod=%X\n", keycode, mods );  */

  uid_send_message( &m );
}

void register_kbd_msg_queue( char *q_name, int port )
{
  kbd_set_driver_handler( kbd_parser );
}

void unregister_kbd_msg_queue( int port )
{
   kbd_set_driver_handler( NULL );
}