File: keyboard.c

package info (click to toggle)
kernel-image-2.4.18-hppa 62.3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 156,012 kB
  • ctags: 448,723
  • sloc: ansic: 2,586,445; asm: 145,047; makefile: 8,574; sh: 3,097; perl: 2,578; yacc: 1,177; tcl: 577; lex: 352; awk: 251; lisp: 218; sed: 72
file content (101 lines) | stat: -rw-r--r-- 2,033 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
 *  WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
 *  ---------------------------------------------------------------
 *  This source file will be removed as soon as we have converted
 *  hp_psaux.c and hp_keyb.c to the input layer !
 *  
 */

/*
 *  linux/arch/parisc/kernel/keyboard.c
 *
 *  Alex deVries <adevries@thepuffingroup.com>
 *  Copyright (1999) The Puffin Group
 *  Mostly rewritten by Philipp Rumpf <prumpf@tux.org>
 *  Copyright 2000 Philipp Rumpf
 */

#include <linux/errno.h>
#include <linux/keyboard.h>
#include <asm/keyboard.h>
#include <linux/module.h>

static int def_setkeycode(unsigned int x, unsigned int y)
{
	return 0;
}

static int def_getkeycode(unsigned int x)
{
	return 0;
}

static int def_translate(unsigned char scancode, unsigned char *keycode,
	char raw)
{
	*keycode = scancode;

	return 1;
}

static char def_unexpected_up(unsigned char c)
{
	return 128;
}

static void def_leds(unsigned char leds)
{
}

static void def_init_hw(void)
{
}

static char def_sysrq_xlate[NR_KEYS];

#define DEFAULT_KEYB_OPS \
	setkeycode:	def_setkeycode,	\
	getkeycode:	def_getkeycode, \
	translate:	def_translate, \
	unexpected_up:	def_unexpected_up, \
	leds:		def_leds, \
	init_hw:	def_init_hw, \
	sysrq_key:	0xff, \
	sysrq_xlate:	def_sysrq_xlate,

static struct kbd_ops def_kbd_ops = {
	DEFAULT_KEYB_OPS
};

struct kbd_ops *kbd_ops = &def_kbd_ops;

void unregister_kbd_ops(void)
{
	struct kbd_ops new_kbd_ops = { DEFAULT_KEYB_OPS };
	register_kbd_ops(&new_kbd_ops);
}
EXPORT_SYMBOL(unregister_kbd_ops);

void register_kbd_ops(struct kbd_ops *ops)
{
	if(ops->setkeycode)
		kbd_ops->setkeycode = ops->setkeycode;
	
	if(ops->getkeycode)
		kbd_ops->getkeycode = ops->getkeycode;
	
	if(ops->translate)
		kbd_ops->translate = ops->translate;
	
	if(ops->unexpected_up)
		kbd_ops->unexpected_up = ops->unexpected_up;
	
	if(ops->leds)
		kbd_ops->leds = ops->leds;
	
	if(ops->init_hw)
		kbd_ops->init_hw = ops->init_hw;
	
	kbd_ops->sysrq_key = ops->sysrq_key;
	kbd_ops->sysrq_xlate = ops->sysrq_xlate;
}