Commit a6c61c35 authored by Russell King's avatar Russell King

[ARM] Remove old 26-bit ARM keyboard drivers

Also remove mouse_ps2.c which was never referenced from the Makefile.
parent 0b6583d7
......@@ -2,22 +2,6 @@
# Makefile for the acorn character device drivers.
#
obj-arc := keyb_arc.o defkeymap-acorn.o
obj-$(CONFIG_ARCH_ACORN) += i2c.o pcf8583.o
obj-$(CONFIG_L7200_KEYB) += defkeymap-l7200.o keyb_l7200.o
obj-y += $(obj-$(MACHINE))
$(obj)/defkeymap-acorn.o: $(obj)/defkeymap-acorn.c
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
# GENERATE_KEYMAP := 1
ifdef GENERATE_KEYMAP
$(obj)/defkeymap-acorn.c: $(obj)/%.c: $(src)/%.map
loadkeys --mktable $< > $@
endif
/* Do not edit this file! It was automatically generated by */
/* loadkeys --mktable defkeymap.map > defkeymap.c */
#include <linux/types.h>
#include <linux/keyboard.h>
#include <linux/kd.h>
u_short plain_map[NR_KEYS] = {
0xf01b, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf200, 0xf209, 0xf205,
0xf060, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037,
0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf0a3, 0xf07f, 0xf115,
0xf114, 0xf118, 0xf208, 0xf30d, 0xf30c, 0xf314, 0xf009, 0xfb71,
0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f,
0xfb70, 0xf05b, 0xf05d, 0xf05c, 0xf116, 0xf117, 0xf119, 0xf307,
0xf308, 0xf309, 0xf30b, 0xf702, 0xfb61, 0xfb73, 0xfb64, 0xfb66,
0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf201,
0xf304, 0xf305, 0xf306, 0xf30a, 0xf700, 0xf200, 0xfb7a, 0xfb78,
0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f,
0xf700, 0xf603, 0xf301, 0xf302, 0xf303, 0xf207, 0xf703, 0xf020,
0xf701, 0xf702, 0xf601, 0xf600, 0xf602, 0xf300, 0xf310, 0xf30e,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
u_short shift_map[NR_KEYS] = {
0xf01b, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
0xf111, 0xf112, 0xf113, 0xf10a, 0xf10b, 0xf200, 0xf203, 0xf205,
0xf07e, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026,
0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf0a4, 0xf07f, 0xf115,
0xf114, 0xf20b, 0xf208, 0xf30d, 0xf30c, 0xf314, 0xf009, 0xfb51,
0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f,
0xfb50, 0xf07b, 0xf07d, 0xf07c, 0xf116, 0xf117, 0xf20a, 0xf307,
0xf308, 0xf309, 0xf30b, 0xf702, 0xfb41, 0xfb53, 0xfb44, 0xfb46,
0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf201,
0xf304, 0xf305, 0xf306, 0xf30a, 0xf700, 0xf200, 0xfb5a, 0xfb58,
0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f,
0xf700, 0xf603, 0xf301, 0xf302, 0xf303, 0xf207, 0xf703, 0xf020,
0xf701, 0xf702, 0xf601, 0xf600, 0xf602, 0xf300, 0xf310, 0xf30e,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
u_short altgr_map[NR_KEYS] = {
0xf200, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512,
0xf513, 0xf514, 0xf515, 0xf516, 0xf517, 0xf200, 0xf202, 0xf205,
0xf200, 0xf200, 0xf040, 0xf200, 0xf024, 0xf200, 0xf200, 0xf07b,
0xf05b, 0xf05d, 0xf07d, 0xf05c, 0xf200, 0xf200, 0xf200, 0xf115,
0xf114, 0xf118, 0xf208, 0xf30d, 0xf30c, 0xf314, 0xf200, 0xfb71,
0xfb77, 0xf918, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f,
0xfb70, 0xf200, 0xf07e, 0xf200, 0xf116, 0xf117, 0xf119, 0xf911,
0xf912, 0xf913, 0xf30b, 0xf702, 0xf914, 0xfb73, 0xf917, 0xf919,
0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf200, 0xf200, 0xf201,
0xf90e, 0xf90f, 0xf910, 0xf30a, 0xf700, 0xf200, 0xfb7a, 0xfb78,
0xf916, 0xfb76, 0xf915, 0xfb6e, 0xfb6d, 0xf200, 0xf200, 0xf200,
0xf700, 0xf603, 0xf90b, 0xf90c, 0xf90d, 0xf207, 0xf703, 0xf200,
0xf701, 0xf702, 0xf601, 0xf600, 0xf602, 0xf90a, 0xf310, 0xf30e,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
u_short ctrl_map[NR_KEYS] = {
0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf200, 0xf204, 0xf205,
0xf200, 0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f,
0xf07f, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf200, 0xf008, 0xf115,
0xf114, 0xf118, 0xf208, 0xf30d, 0xf30c, 0xf314, 0xf200, 0xf011,
0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f,
0xf010, 0xf01b, 0xf01d, 0xf01c, 0xf116, 0xf117, 0xf119, 0xf307,
0xf308, 0xf309, 0xf30b, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006,
0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf007, 0xf201,
0xf304, 0xf305, 0xf306, 0xf30a, 0xf700, 0xf200, 0xf01a, 0xf018,
0xf003, 0xf016, 0xf002, 0xf00e, 0xf00d, 0xf200, 0xf20e, 0xf07f,
0xf700, 0xf603, 0xf301, 0xf302, 0xf303, 0xf207, 0xf703, 0xf000,
0xf701, 0xf702, 0xf601, 0xf600, 0xf602, 0xf300, 0xf310, 0xf30e,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
u_short shift_ctrl_map[NR_KEYS] = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf209, 0xf205,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf200, 0xf200, 0xf115,
0xf114, 0xf118, 0xf208, 0xf30d, 0xf30c, 0xf314, 0xf200, 0xf011,
0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f,
0xf010, 0xf200, 0xf200, 0xf200, 0xf116, 0xf117, 0xf119, 0xf307,
0xf308, 0xf309, 0xf30b, 0xf702, 0xf001, 0xf013, 0xf004, 0xf006,
0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf201,
0xf304, 0xf305, 0xf306, 0xf30a, 0xf700, 0xf200, 0xf01a, 0xf018,
0xf003, 0xf016, 0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf200,
0xf700, 0xf603, 0xf301, 0xf302, 0xf303, 0xf207, 0xf703, 0xf200,
0xf701, 0xf702, 0xf601, 0xf600, 0xf602, 0xf300, 0xf310, 0xf30e,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
u_short alt_map[NR_KEYS] = {
0xf81b, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506,
0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf200, 0xf209, 0xf205,
0xf860, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837,
0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf8a3, 0xf87f, 0xf115,
0xf114, 0xf118, 0xf208, 0xf30d, 0xf30c, 0xf314, 0xf809, 0xf871,
0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f,
0xf870, 0xf85b, 0xf85d, 0xf85c, 0xf116, 0xf117, 0xf119, 0xf907,
0xf908, 0xf909, 0xf30b, 0xf702, 0xf861, 0xf873, 0xf864, 0xf866,
0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf80d,
0xf904, 0xf905, 0xf906, 0xf30a, 0xf700, 0xf200, 0xf87a, 0xf878,
0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f,
0xf700, 0xf603, 0xf901, 0xf902, 0xf903, 0xf207, 0xf703, 0xf820,
0xf701, 0xf702, 0xf210, 0xf600, 0xf211, 0xf900, 0xf310, 0xf30e,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
u_short ctrl_alt_map[NR_KEYS] = {
0xf200, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506,
0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf200, 0xf209, 0xf205,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf115,
0xf114, 0xf118, 0xf208, 0xf30d, 0xf30c, 0xf314, 0xf200, 0xf811,
0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, 0xf80f,
0xf810, 0xf200, 0xf200, 0xf200, 0xf20c, 0xf117, 0xf119, 0xf307,
0xf308, 0xf309, 0xf30b, 0xf702, 0xf801, 0xf813, 0xf804, 0xf806,
0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf201,
0xf304, 0xf305, 0xf306, 0xf30a, 0xf700, 0xf200, 0xf81a, 0xf818,
0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf200,
0xf700, 0xf603, 0xf301, 0xf302, 0xf303, 0xf207, 0xf703, 0xf200,
0xf701, 0xf702, 0xf601, 0xf600, 0xf602, 0xf300, 0xf20c, 0xf30e,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
ushort *key_maps[MAX_NR_KEYMAPS] = {
plain_map, shift_map, altgr_map, 0,
ctrl_map, shift_ctrl_map, 0, 0,
alt_map, 0, 0, 0,
ctrl_alt_map, 0
};
unsigned int keymap_count = 7;
/*
* Philosophy: most people do not define more strings, but they who do
* often want quite a lot of string space. So, we statically allocate
* the default and allocate dynamically in chunks of 512 bytes.
*/
char func_buf[] = {
'\033', '[', '[', 'A', 0,
'\033', '[', '[', 'B', 0,
'\033', '[', '[', 'C', 0,
'\033', '[', '[', 'D', 0,
'\033', '[', '[', 'E', 0,
'\033', '[', '1', '7', '~', 0,
'\033', '[', '1', '8', '~', 0,
'\033', '[', '1', '9', '~', 0,
'\033', '[', '2', '0', '~', 0,
'\033', '[', '2', '1', '~', 0,
'\033', '[', '2', '3', '~', 0,
'\033', '[', '2', '4', '~', 0,
'\033', '[', '2', '5', '~', 0,
'\033', '[', '2', '6', '~', 0,
'\033', '[', '2', '8', '~', 0,
'\033', '[', '2', '9', '~', 0,
'\033', '[', '3', '1', '~', 0,
'\033', '[', '3', '2', '~', 0,
'\033', '[', '3', '3', '~', 0,
'\033', '[', '3', '4', '~', 0,
'\033', '[', '1', '~', 0,
'\033', '[', '2', '~', 0,
'\033', '[', '3', '~', 0,
'\033', '[', '4', '~', 0,
'\033', '[', '5', '~', 0,
'\033', '[', '6', '~', 0,
'\033', '[', 'M', 0,
'\033', '[', 'P', 0,
};
char *funcbufptr = func_buf;
int funcbufsize = sizeof(func_buf);
int funcbufleft = 0; /* space left */
char *func_table[MAX_NR_FUNC] = {
func_buf + 0,
func_buf + 5,
func_buf + 10,
func_buf + 15,
func_buf + 20,
func_buf + 25,
func_buf + 31,
func_buf + 37,
func_buf + 43,
func_buf + 49,
func_buf + 55,
func_buf + 61,
func_buf + 67,
func_buf + 73,
func_buf + 79,
func_buf + 85,
func_buf + 91,
func_buf + 97,
func_buf + 103,
func_buf + 109,
func_buf + 115,
func_buf + 120,
func_buf + 125,
func_buf + 130,
func_buf + 135,
func_buf + 140,
func_buf + 145,
0,
0,
func_buf + 149,
0,
};
struct kbdiacr accent_table[MAX_DIACR] = {
{'`', 'A', '\300'}, {'`', 'a', '\340'},
{'\'', 'A', '\301'}, {'\'', 'a', '\341'},
{'^', 'A', '\302'}, {'^', 'a', '\342'},
{'~', 'A', '\303'}, {'~', 'a', '\343'},
{'"', 'A', '\304'}, {'"', 'a', '\344'},
{'O', 'A', '\305'}, {'o', 'a', '\345'},
{'0', 'A', '\305'}, {'0', 'a', '\345'},
{'A', 'A', '\305'}, {'a', 'a', '\345'},
{'A', 'E', '\306'}, {'a', 'e', '\346'},
{',', 'C', '\307'}, {',', 'c', '\347'},
{'`', 'E', '\310'}, {'`', 'e', '\350'},
{'\'', 'E', '\311'}, {'\'', 'e', '\351'},
{'^', 'E', '\312'}, {'^', 'e', '\352'},
{'"', 'E', '\313'}, {'"', 'e', '\353'},
{'`', 'I', '\314'}, {'`', 'i', '\354'},
{'\'', 'I', '\315'}, {'\'', 'i', '\355'},
{'^', 'I', '\316'}, {'^', 'i', '\356'},
{'"', 'I', '\317'}, {'"', 'i', '\357'},
{'-', 'D', '\320'}, {'-', 'd', '\360'},
{'~', 'N', '\321'}, {'~', 'n', '\361'},
{'`', 'O', '\322'}, {'`', 'o', '\362'},
{'\'', 'O', '\323'}, {'\'', 'o', '\363'},
{'^', 'O', '\324'}, {'^', 'o', '\364'},
{'~', 'O', '\325'}, {'~', 'o', '\365'},
{'"', 'O', '\326'}, {'"', 'o', '\366'},
{'/', 'O', '\330'}, {'/', 'o', '\370'},
{'`', 'U', '\331'}, {'`', 'u', '\371'},
{'\'', 'U', '\332'}, {'\'', 'u', '\372'},
{'^', 'U', '\333'}, {'^', 'u', '\373'},
{'"', 'U', '\334'}, {'"', 'u', '\374'},
{'\'', 'Y', '\335'}, {'\'', 'y', '\375'},
{'T', 'H', '\336'}, {'t', 'h', '\376'},
{'s', 's', '\337'}, {'"', 'y', '\377'},
{'s', 'z', '\337'}, {'i', 'j', '\377'},
};
unsigned int accent_table_size = 68;
# Default kernel keymap for Acorn machines. This uses 7 modifier combinations.
keymaps 0-2,4-5,8,12
# Change the above line into
# keymaps 0-2,4-6,8,12
# in case you want the entries
# altgr control keycode 52 = Boot
# altgr control keycode 102 = Boot
# below.
#
# In fact AltGr is used very little, and one more keymap can
# be saved by mapping AltGr to Alt (and adapting a few entries):
# keycode 96 = Alt
#
keycode 0 = Escape
shift keycode 0 = Escape
alt keycode 0 = Meta_Escape
keycode 1 = F1 F11 Console_13
control keycode 1 = F1
alt keycode 1 = Console_1
control alt keycode 1 = Console_1
keycode 2 = F2 F12 Console_14
control keycode 2 = F2
alt keycode 2 = Console_2
control alt keycode 2 = Console_2
keycode 3 = F3 F13 Console_15
control keycode 3 = F3
alt keycode 3 = Console_3
control alt keycode 3 = Console_3
keycode 4 = F4 F14 Console_16
control keycode 4 = F4
alt keycode 4 = Console_4
control alt keycode 4 = Console_4
keycode 5 = F5 F15 Console_17
control keycode 5 = F5
alt keycode 5 = Console_5
control alt keycode 5 = Console_5
keycode 6 = F6 F16 Console_18
control keycode 6 = F6
alt keycode 6 = Console_6
control alt keycode 6 = Console_6
keycode 7 = F7 F17 Console_19
control keycode 7 = F7
alt keycode 7 = Console_7
control alt keycode 7 = Console_7
keycode 8 = F8 F18 Console_20
control keycode 8 = F8
alt keycode 8 = Console_8
control alt keycode 8 = Console_8
keycode 9 = F9 F19 Console_21
control keycode 9 = F9
alt keycode 9 = Console_9
control alt keycode 9 = Console_9
keycode 10 = F10 F20 Console_22
control keycode 10 = F10
alt keycode 10 = Console_10
control alt keycode 10 = Console_10
keycode 11 = F11 F11 Console_23
control keycode 11 = F11
alt keycode 11 = Console_11
control alt keycode 11 = Console_11
keycode 12 = F12 F12 Console_24
control keycode 12 = F12
alt keycode 12 = Console_12
control alt keycode 12 = Console_12
keycode 13 =
keycode 14 = Scroll_Lock
shift keycode 14 = Show_Memory
altgr keycode 14 = Show_Registers
control keycode 14 = Show_State
alt keycode 14 = Scroll_Lock
keycode 15 = Break
keycode 16 = grave asciitilde
alt keycode 16 = Meta_grave
keycode 17 = one exclam
alt keycode 17 = Meta_one
keycode 18 = two at at
control keycode 18 = nul
alt keycode 18 = Meta_two
keycode 19 = three numbersign
control keycode 19 = Escape
alt keycode 19 = Meta_three
keycode 20 = four dollar dollar
control keycode 20 = Control_backslash
alt keycode 20 = Meta_four
keycode 21 = five percent
control keycode 21 = Control_bracketright
alt keycode 21 = Meta_five
keycode 22 = six asciicircum
control keycode 22 = Control_asciicircum
alt keycode 22 = Meta_six
keycode 23 = seven ampersand braceleft
control keycode 23 = Control_underscore
alt keycode 23 = Meta_seven
keycode 24 = eight asterisk bracketleft
control keycode 24 = Delete
alt keycode 24 = Meta_eight
keycode 25 = nine parenleft bracketright
alt keycode 25 = Meta_nine
keycode 26 = zero parenright braceright
alt keycode 26 = Meta_zero
keycode 27 = minus underscore backslash
control keycode 27 = Control_underscore
shift control keycode 27 = Control_underscore
alt keycode 27 = Meta_minus
keycode 28 = equal plus
alt keycode 28 = Meta_equal
keycode 29 = sterling currency
alt keycode 29 = 0x08a3
keycode 30 = Delete Delete
control keycode 30 = BackSpace
alt keycode 30 = Meta_Delete
keycode 31 = Insert
keycode 32 = Find
keycode 33 = Prior
shift keycode 33 = Scroll_Backward
keycode 34 = Num_Lock
keycode 35 = KP_Divide
keycode 36 = KP_Multiply
keycode 37 = 0x0314
keycode 38 = Tab Tab
alt keycode 38 = Meta_Tab
keycode 39 = q
keycode 40 = w
keycode 41 = e
altgr keycode 41 = Hex_E
keycode 42 = r
keycode 43 = t
keycode 44 = y
keycode 45 = u
keycode 46 = i
keycode 47 = o
keycode 48 = p
keycode 49 = bracketleft braceleft
control keycode 49 = Escape
alt keycode 49 = Meta_bracketleft
keycode 50 = bracketright braceright asciitilde
control keycode 50 = Control_bracketright
alt keycode 50 = Meta_bracketright
keycode 51 = backslash bar
control keycode 51 = Control_backslash
alt keycode 51 = Meta_backslash
keycode 52 = Remove
# altgr control keycode 52 = Boot
control alt keycode 52 = Boot
keycode 53 = Select
keycode 54 = Next
shift keycode 54 = Scroll_Forward
keycode 55 = KP_7
altgr keycode 55 = Hex_7
alt keycode 55 = Ascii_7
keycode 56 = KP_8
altgr keycode 56 = Hex_8
alt keycode 56 = Ascii_8
keycode 57 = KP_9
altgr keycode 57 = Hex_9
alt keycode 57 = Ascii_9
keycode 58 = KP_Subtract
keycode 59 = Control
keycode 60 = a
altgr keycode 60 = Hex_A
keycode 61 = s
keycode 62 = d
altgr keycode 62 = Hex_D
keycode 63 = f
altgr keycode 63 = Hex_F
keycode 64 = g
keycode 65 = h
keycode 66 = j
keycode 67 = k
keycode 68 = l
keycode 69 = semicolon colon
alt keycode 69 = Meta_semicolon
keycode 70 = apostrophe quotedbl
control keycode 70 = Control_g
alt keycode 70 = Meta_apostrophe
keycode 71 = Return
alt keycode 71 = Meta_Control_m
keycode 72 = KP_4
altgr keycode 72 = Hex_4
alt keycode 72 = Ascii_4
keycode 73 = KP_5
altgr keycode 73 = Hex_5
alt keycode 73 = Ascii_5
keycode 74 = KP_6
altgr keycode 74 = Hex_6
alt keycode 74 = Ascii_6
keycode 75 = KP_Add
keycode 76 = Shift
keycode 77 =
keycode 78 = z
keycode 79 = x
keycode 80 = c
altgr keycode 80 = Hex_C
keycode 81 = v
keycode 82 = b
altgr keycode 82 = Hex_B
keycode 83 = n
keycode 84 = m
keycode 85 = comma less
alt keycode 85 = Meta_comma
keycode 86 = period greater
control keycode 86 = Compose
alt keycode 86 = Meta_period
keycode 87 = slash question
control keycode 87 = Delete
alt keycode 87 = Meta_slash
keycode 88 = Shift
keycode 89 = Up
keycode 90 = KP_1
altgr keycode 90 = Hex_1
alt keycode 90 = Ascii_1
keycode 91 = KP_2
altgr keycode 91 = Hex_2
alt keycode 91 = Ascii_2
keycode 92 = KP_3
altgr keycode 92 = Hex_3
alt keycode 92 = Ascii_3
keycode 93 = Caps_Lock
keycode 94 = Alt
keycode 95 = space space
control keycode 95 = nul
alt keycode 95 = Meta_space
keycode 96 = AltGr
keycode 97 = Control
keycode 98 = Left
alt keycode 98 = Decr_Console
keycode 99 = Down
keycode 100 = Right
alt keycode 100 = Incr_Console
keycode 101 = KP_0
altgr keycode 101 = Hex_0
alt keycode 101 = Ascii_0
keycode 102 = KP_Period
# altgr control keycode 102 = Boot
control alt keycode 102 = Boot
keycode 103 = KP_Enter
keycode 104 =
keycode 105 =
keycode 106 =
keycode 107 =
keycode 108 =
keycode 109 =
keycode 110 =
keycode 111 =
keycode 112 =
keycode 113 =
keycode 114 =
keycode 115 =
keycode 116 =
keycode 117 =
keycode 118 =
keycode 119 =
keycode 120 =
keycode 121 =
keycode 122 =
keycode 123 =
keycode 124 =
keycode 125 =
keycode 126 =
keycode 127 =
string F1 = "\033[[A"
string F2 = "\033[[B"
string F3 = "\033[[C"
string F4 = "\033[[D"
string F5 = "\033[[E"
string F6 = "\033[17~"
string F7 = "\033[18~"
string F8 = "\033[19~"
string F9 = "\033[20~"
string F10 = "\033[21~"
string F11 = "\033[23~"
string F12 = "\033[24~"
string F13 = "\033[25~"
string F14 = "\033[26~"
string F15 = "\033[28~"
string F16 = "\033[29~"
string F17 = "\033[31~"
string F18 = "\033[32~"
string F19 = "\033[33~"
string F20 = "\033[34~"
string Find = "\033[1~"
string Insert = "\033[2~"
string Remove = "\033[3~"
string Select = "\033[4~"
string Prior = "\033[5~"
string Next = "\033[6~"
string Macro = "\033[M"
string Pause = "\033[P"
compose '`' 'A' to ''
compose '`' 'a' to ''
compose '\'' 'A' to ''
compose '\'' 'a' to ''
compose '^' 'A' to ''
compose '^' 'a' to ''
compose '~' 'A' to ''
compose '~' 'a' to ''
compose '"' 'A' to ''
compose '"' 'a' to ''
compose 'O' 'A' to ''
compose 'o' 'a' to ''
compose '0' 'A' to ''
compose '0' 'a' to ''
compose 'A' 'A' to ''
compose 'a' 'a' to ''
compose 'A' 'E' to ''
compose 'a' 'e' to ''
compose ',' 'C' to ''
compose ',' 'c' to ''
compose '`' 'E' to ''
compose '`' 'e' to ''
compose '\'' 'E' to ''
compose '\'' 'e' to ''
compose '^' 'E' to ''
compose '^' 'e' to ''
compose '"' 'E' to ''
compose '"' 'e' to ''
compose '`' 'I' to ''
compose '`' 'i' to ''
compose '\'' 'I' to ''
compose '\'' 'i' to ''
compose '^' 'I' to ''
compose '^' 'i' to ''
compose '"' 'I' to ''
compose '"' 'i' to ''
compose '-' 'D' to ''
compose '-' 'd' to ''
compose '~' 'N' to ''
compose '~' 'n' to ''
compose '`' 'O' to ''
compose '`' 'o' to ''
compose '\'' 'O' to ''
compose '\'' 'o' to ''
compose '^' 'O' to ''
compose '^' 'o' to ''
compose '~' 'O' to ''
compose '~' 'o' to ''
compose '"' 'O' to ''
compose '"' 'o' to ''
compose '/' 'O' to ''
compose '/' 'o' to ''
compose '`' 'U' to ''
compose '`' 'u' to ''
compose '\'' 'U' to ''
compose '\'' 'u' to ''
compose '^' 'U' to ''
compose '^' 'u' to ''
compose '"' 'U' to ''
compose '"' 'u' to ''
compose '\'' 'Y' to ''
compose '\'' 'y' to ''
compose 'T' 'H' to ''
compose 't' 'h' to ''
compose 's' 's' to ''
compose '"' 'y' to ''
compose 's' 'z' to ''
compose 'i' 'j' to ''
/*
* linux/drivers/acorn/char/keyb_arc.c
*
* Copyright (C) 2000 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Acorn keyboard driver for ARM Linux.
*
* The Acorn keyboard appears to have a ***very*** buggy reset protocol -
* every reset behaves differently. We try to get round this by attempting
* a few things...
*/
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/ptrace.h>
#include <linux/signal.h>
#include <linux/timer.h>
#include <linux/random.h>
#include <linux/ctype.h>
#include <linux/init.h>
#include <linux/kbd_ll.h>
#include <linux/kbd_kern.h>
#include <linux/delay.h>
#include <asm/bitops.h>
#include <asm/keyboard.h>
#include <asm/irq.h>
#include <asm/hardware.h>
#include <asm/hardware/ioc.h>
#include "../../char/busmouse.h"
extern struct tasklet_struct keyboard_tasklet;
extern void kbd_reset_kdown(void);
#define VERSION 108
#define KBD_REPORT_ERR
#define KBD_REPORT_UNKN
#include <asm/io.h>
#include <asm/system.h>
static char kbd_txval[4];
static unsigned char kbd_txhead, kbd_txtail;
#define KBD_INCTXPTR(ptr) ((ptr) = ((ptr) + 1) & 3)
static int kbd_id = -1;
static DECLARE_WAIT_QUEUE_HEAD(kbd_waitq);
#ifdef CONFIG_KBDMOUSE
static int mousedev;
#endif
/*
* Protocol codes to send the keyboard.
*/
#define HRST 0xff /* reset keyboard */
#define RAK1 0xfe /* reset response */
#define RAK2 0xfd /* reset response */
#define BACK 0x3f /* Ack for first keyboard pair */
#define SMAK 0x33 /* Last data byte ack (key scanning + mouse movement scanning) */
#define MACK 0x32 /* Last data byte ack (mouse movement scanning) */
#define SACK 0x31 /* Last data byte ack (key scanning) */
#define NACK 0x30 /* Last data byte ack (no scanning, mouse data) */
#define RQMP 0x22 /* Request mouse data */
#define PRST 0x21 /* nothing */
#define RQID 0x20 /* Request ID */
#define UP_FLAG 1
#ifdef CONFIG_MAGIC_SYSRQ
unsigned char a5kkbd_sysrq_xlate[] =
{
27, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
'`', '1', '2', '3', '4', '5', '6', '7',
'8', '9', '0', '-', '=', '', 127, 0,
0, 0, 0, '/', '*', '#', 9, 'q',
'w', 'e', 'r', 't', 'y', 'u', 'i', 'o',
'p', '[', ']', '\\', 22, 23, 25, '7',
'8', '9', '-', 0, 'a', 's', 'd', 'f',
'g', 'h', 'j', 'k', 'l', ';', '\'', 13,
'4', '5', '6', '+', 0, 0, 'z', 'x',
'c', 'v', 'b', 'n', 'm', ',', '.', '/',
0, 0, '1', '2', '3', 0, 0, ' ',
0, 0, 0, 0, 0, '0', '.', 10,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
#endif
/*
* This array converts the scancode that we get from the keyboard to the
* real rows/columns on the A5000 keyboard. This might be keyboard specific...
*
* It is these values that we use to maintain the key down array. That way, we
* should pick up on the ghost key presses (which is what happens when you press
* three keys, and the keyboard thinks you have pressed four!)
*
* Row 8 (0x80+c) is actually a column with one key per row. It is isolated from
* the other keys, and can't cause these problems (its used for shift, ctrl, alt etc).
*
* Illegal scancodes are denoted by an 0xff (in other words, we don't know about
* them, and can't process them for ghosts). This does however, cause problems with
* autorepeat processing...
*/
static unsigned char scancode_2_colrow[256] = {
0x01, 0x42, 0x32, 0x33, 0x43, 0x56, 0x5a, 0x6c, 0x7c, 0x5c, 0x5b, 0x6b, 0x7b, 0x84, 0x70, 0x60,
0x11, 0x51, 0x62, 0x63, 0x44, 0x54, 0x55, 0x45, 0x46, 0x4a, 0x3c, 0x4b, 0x59, 0x49, 0x69, 0x79,
0x83, 0x40, 0x30, 0x3b, 0x39, 0x38, 0x31, 0x61, 0x72, 0x73, 0x64, 0x74, 0x75, 0x65, 0x66, 0x6a,
0x1c, 0x2c, 0x7a, 0x36, 0x48, 0x68, 0x78, 0x20, 0x2b, 0x29, 0x28, 0x81, 0x71, 0x22, 0x23, 0x34,
0x24, 0x25, 0x35, 0x26, 0x3a, 0x0c, 0x2a, 0x76, 0x10, 0x1b, 0x19, 0x18, 0x82, 0xff, 0x21, 0x12,
0x13, 0x14, 0x04, 0x05, 0x15, 0x16, 0x1a, 0x0a, 0x85, 0x77, 0x00, 0x0b, 0x09, 0x02, 0x80, 0x03,
0x87, 0x86, 0x06, 0x17, 0x27, 0x07, 0x37, 0x08, 0xff,
};
#define BITS_PER_SHORT (8*sizeof(unsigned short))
static unsigned short ghost_down[128/BITS_PER_SHORT];
static void a5kkbd_key(unsigned int keycode, unsigned int up_flag)
{
unsigned int real_keycode;
if (keycode > 0x72) {
#ifdef KBD_REPORT_UNKN
printk ("kbd: unknown scancode 0x%04x\n", keycode);
#endif
return;
}
if (keycode >= 0x70) {
#ifdef CONFIG_KBDMOUSE
if (mousedev >= 0)
switch (keycode) {
case 0x70: /* Left mouse button */
busmouse_add_buttons(mousedev, 4, up_flag ? 4 : 0);
break;
case 0x71: /* Middle mouse button */
busmouse_add_buttons(mousedev, 2, up_flag ? 2 : 0);
break;
case 0x72:/* Right mouse button */
busmouse_add_buttons(mousedev, 1, up_flag ? 1 : 0);
break;
}
#endif
return;
}
/*
* We have to work out if we accept this key press as a real key, or
* if it is a ghost. IE. If you press three keys, the keyboard will think
* that you've pressed a fourth: (@ = key down, # = ghost)
*
* 0 1 2 3 4 5 6 7
* | | | | | | | |
* 0-+-+-+-+-+-+-+-+-
* | | | | | | | |
* 1-+-@-+-+-+-@-+-+-
* | | | | | | | |
* 2-+-+-+-+-+-+-+-+-
* | | | | | | | |
* 3-+-@-+-+-+-#-+-+-
* | | | | | | | |
*
* This is what happens when you have a matrix keyboard...
*/
real_keycode = scancode_2_colrow[keycode];
if ((real_keycode & 0x80) == 0) {
int rr, kc = (real_keycode >> 4) & 7;
int cc;
unsigned short res, kdownkc;
kdownkc = ghost_down[kc] | (1 << (real_keycode & 15));
for (rr = 0; rr < 128/BITS_PER_SHORT; rr++)
if (rr != kc && (res = ghost_down[rr] & kdownkc)) {
/*
* we have found a second row with at least one key pressed in the
* same column.
*/
for (cc = 0; res; res >>= 1)
cc += (res & 1);
if (cc > 1)
return; /* ignore it */
}
if (up_flag)
clear_bit (real_keycode, ghost_down);
else
set_bit (real_keycode, ghost_down);
}
handle_scancode(keycode, !up_flag);
}
static inline void a5kkbd_sendbyte(unsigned char val)
{
kbd_txval[kbd_txhead] = val;
KBD_INCTXPTR(kbd_txhead);
enable_irq(IRQ_KEYBOARDTX);
}
static inline void a5kkbd_reset(void)
{
int i;
for (i = 0; i < NR_SCANCODES/BITS_PER_SHORT; i++)
ghost_down[i] = 0;
kbd_reset_kdown();
}
void a5kkbd_leds(unsigned char leds)
{
leds = ((leds & (1<<VC_SCROLLOCK))?4:0) | ((leds & (1<<VC_NUMLOCK))?2:0) |
((leds & (1<<VC_CAPSLOCK))?1:0);
a5kkbd_sendbyte(leds);
}
/* Keyboard states:
* 0 initial reset condition, receive HRST, send RRAK1
* 1 Sent RAK1, wait for RAK1, send RRAK2
* 2 Sent RAK2, wait for RAK2, send SMAK or RQID
* 3 Sent RQID, expect KBID, send SMAK
* 4 Sent SMAK, wait for anything
* 5 Wait for second keyboard nibble for key pressed
* 6 Wait for second keyboard nibble for key released
* 7 Wait for second part of mouse data
*
* This function returns 1 when we successfully enter the IDLE state
* (and hence need to do some keyboard processing).
*/
#define KBD_INITRST 0
#define KBD_RAK1 1
#define KBD_RAK2 2
#define KBD_ID 3
#define KBD_IDLE 4
#define KBD_KEYDOWN 5
#define KBD_KEYUP 6
#define KBD_MOUSE 7
static int handle_rawcode(unsigned int keyval)
{
static signed char kbd_mousedx = 0;
signed char kbd_mousedy;
static unsigned char kbd_state = KBD_INITRST;
static unsigned char kbd_keyhigh = 0;
if (keyval == HRST && kbd_state != KBD_INITRST && kbd_state != KBD_ID) {
a5kkbd_sendbyte (HRST);
a5kkbd_reset ();
kbd_state = KBD_INITRST;
} else switch(kbd_state) {
case KBD_INITRST: /* hard reset - sent HRST */
if (keyval == HRST) {
a5kkbd_sendbyte (RAK1);
kbd_state = KBD_RAK1;
} else if (keyval == RAK1) {
/* Some A5000 keyboards are very fussy and don't follow Acorn's
* specs - this appears to fix them, but them it might stop
* them from being initialised.
* fix by Philip Blundell
*/
printk(KERN_DEBUG "keyboard sent early RAK1 -- ignored\n");
} else
goto kbd_wontreset;
break;
case KBD_RAK1: /* sent RAK1 - expect RAK1 and send RAK2 */
if (keyval == RAK1) {
a5kkbd_sendbyte (RAK2);
kbd_state = KBD_RAK2;
} else
goto kbd_wontreset;
break;
case KBD_RAK2: /* Sent RAK2 - expect RAK2 and send either RQID or SMAK */
if (keyval == RAK2) {
if (kbd_id == -1) {
a5kkbd_sendbyte (NACK);
a5kkbd_sendbyte (RQID);
kbd_state = KBD_ID;
} else {
a5kkbd_sendbyte (SMAK);
kbd_state = KBD_IDLE;
}
} else
goto kbd_wontreset;
break;
case KBD_ID: /* Sent RQID - expect KBID */
if (keyval == HRST) {
kbd_id = -2;
a5kkbd_reset ();
a5kkbd_sendbyte (HRST);
kbd_state = KBD_INITRST;
wake_up (&kbd_waitq);
} else if ((keyval & 0xc0) == 0x80) {
kbd_id = keyval & 0x3f;
a5kkbd_sendbyte (SMAK);
kbd_state = KBD_IDLE;
wake_up (&kbd_waitq);
}
break;
case KBD_IDLE: /* Send SMAK, ready for any reply */
switch (keyval & 0xf0) {
default: /* 0x00 - 0x7f */
kbd_mousedx = keyval & 0x40 ? keyval|0x80 : keyval;
kbd_state = KBD_MOUSE;
a5kkbd_sendbyte (BACK);
break;
case 0x80:
case 0x90:
case 0xa0:
case 0xb0:
if (kbd_id == -1)
kbd_id = keyval & 0x3f;
break;
case 0xc0:
kbd_keyhigh = keyval;
kbd_state = KBD_KEYDOWN;
a5kkbd_sendbyte (BACK);
break;
case 0xd0:
kbd_keyhigh = keyval;
kbd_state = KBD_KEYUP;
a5kkbd_sendbyte (BACK);
break;
case 0xe0:
case 0xf0:
goto kbd_error;
}
break;
case KBD_KEYDOWN:
if ((keyval & 0xf0) != 0xc0)
goto kbd_error;
else {
kbd_state = KBD_IDLE;
a5kkbd_sendbyte (SMAK);
if (((kbd_keyhigh ^ keyval) & 0xf0) == 0)
a5kkbd_key ((keyval & 0x0f) | ((kbd_keyhigh << 4) & 0xf0), 0);
}
break;
case KBD_KEYUP:
if ((keyval & 0xf0) != 0xd0)
goto kbd_error;
else {
kbd_state = KBD_IDLE;
a5kkbd_sendbyte (SMAK);
if (((kbd_keyhigh ^ keyval) & 0xf0) == 0)
a5kkbd_key ((keyval & 0x0f) | ((kbd_keyhigh << 4) & 0xf0), UP_FLAG);
}
break;
case KBD_MOUSE:
if (keyval & 0x80)
goto kbd_error;
else {
kbd_state = KBD_IDLE;
a5kkbd_sendbyte (SMAK);
kbd_mousedy = (char)(keyval & 0x40 ? keyval | 0x80 : keyval);
#ifdef CONFIG_KBDMOUSE
if (mousedev >= 0)
busmouse_add_movement(mousedev, (int)kbd_mousedx, (int)kbd_mousedy);
#endif
}
}
return kbd_state == KBD_IDLE ? 1 : 0;
kbd_wontreset:
#ifdef KBD_REPORT_ERR
printk ("kbd: keyboard won't reset (kbdstate %d, keyval %02X)\n",
kbd_state, keyval);
#endif
mdelay(1);
ioc_readb(IOC_KARTRX);
a5kkbd_sendbyte (HRST);
kbd_state = KBD_INITRST;
return 0;
kbd_error:
#ifdef KBD_REPORT_ERR
printk ("kbd: keyboard out of sync - resetting\n");
#endif
a5kkbd_sendbyte (HRST);
kbd_state = KBD_INITRST;
return 0;
}
static void a5kkbd_rx(int irq, void *dev_id, struct pt_regs *regs)
{
if (handle_rawcode(ioc_readb(IOC_KARTRX)))
tasklet_schedule(&keyboard_tasklet);
}
static void a5kkbd_tx(int irq, void *dev_id, struct pt_regs *regs)
{
ioc_writeb (kbd_txval[kbd_txtail], IOC_KARTTX);
KBD_INCTXPTR(kbd_txtail);
if (kbd_txtail == kbd_txhead)
disable_irq(irq);
}
#ifdef CONFIG_KBDMOUSE
static struct busmouse a5kkbd_mouse = {
6, "kbdmouse", NULL, NULL, NULL, 7
};
#endif
void __init a5kkbd_init_hw (void)
{
if (request_irq (IRQ_KEYBOARDTX, a5kkbd_tx, 0, "keyboard", NULL) != 0)
panic("Could not allocate keyboard transmit IRQ!");
(void)ioc_readb(IOC_KARTRX);
if (request_irq (IRQ_KEYBOARDRX, a5kkbd_rx, 0, "keyboard", NULL) != 0)
panic("Could not allocate keyboard receive IRQ!");
a5kkbd_sendbyte (HRST); /* send HRST (expect HRST) */
/* wait 1s for keyboard to initialise */
interruptible_sleep_on_timeout(&kbd_waitq, HZ);
#ifdef CONFIG_KBDMOUSE
mousedev = register_busmouse(&a5kkbd_mouse);
if (mousedev < 0)
printk(KERN_ERR "Unable to register mouse driver\n");
#endif
printk (KERN_INFO "Keyboard driver v%d.%02d. (", VERSION/100, VERSION%100);
if (kbd_id != -1)
printk ("id=%d ", kbd_id);
printk ("English)\n");
}
/*
* Driver for PS/2 mouse on IOMD interface
*/
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/ptrace.h>
#include <linux/signal.h>
#include <linux/timer.h>
#include <linux/random.h>
#include <linux/ctype.h>
#include <linux/kbd_ll.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/miscdevice.h>
#include <asm/bitops.h>
#include <asm/irq.h>
#include <asm/hardware.h>
#include <asm/io.h>
#include <asm/hardware/iomd.h>
#include <asm/system.h>
#include <asm/uaccess.h>
/*
* PS/2 Auxiliary Device
*/
static struct aux_queue *queue; /* Mouse data buffer. */
static int aux_count = 0;
/* used when we send commands to the mouse that expect an ACK. */
static unsigned char mouse_reply_expected = 0;
#define MAX_RETRIES 60 /* some aux operations take long time*/
/*
* Mouse Commands
*/
#define AUX_SET_RES 0xE8 /* Set resolution */
#define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */
#define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */
#define AUX_GET_SCALE 0xE9 /* Get scaling factor */
#define AUX_SET_STREAM 0xEA /* Set stream mode */
#define AUX_SET_SAMPLE 0xF3 /* Set sample rate */
#define AUX_ENABLE_DEV 0xF4 /* Enable aux device */
#define AUX_DISABLE_DEV 0xF5 /* Disable aux device */
#define AUX_RESET 0xFF /* Reset aux device */
#define AUX_ACK 0xFA /* Command byte ACK. */
#define AUX_BUF_SIZE 2048 /* This might be better divisible by
three to make overruns stay in sync
but then the read function would
need a lock etc - ick */
struct aux_queue {
unsigned long head;
unsigned long tail;
wait_queue_head_t proc_list;
struct fasync_struct *fasync;
unsigned char buf[AUX_BUF_SIZE];
};
/*
* Send a byte to the mouse.
*/
static void aux_write_dev(int val)
{
while (!(iomd_readb(IOMD_MSECTL) & 0x80));
iomd_writeb(val, IOMD_MSEDAT);
}
/*
* Send a byte to the mouse & handle returned ack
*/
static void aux_write_ack(int val)
{
while (!(iomd_readb(IOMD_MSECTL) & 0x80));
iomd_writeb(val, IOMD_MSEDAT);
/* we expect an ACK in response. */
mouse_reply_expected++;
}
static unsigned char get_from_queue(void)
{
unsigned char result;
result = queue->buf[queue->tail];
queue->tail = (queue->tail + 1) & (AUX_BUF_SIZE-1);
return result;
}
static void psaux_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
int val = iomd_readb(IOMD_MSEDAT);
if (mouse_reply_expected) {
if (val == AUX_ACK) {
mouse_reply_expected--;
return;
}
mouse_reply_expected = 0;
}
add_mouse_randomness(val);
if (aux_count) {
int head = queue->head;
queue->buf[head] = val;
head = (head + 1) & (AUX_BUF_SIZE-1);
if (head != queue->tail) {
queue->head = head;
kill_fasync(&queue->fasync, SIGIO, POLL_IN);
wake_up_interruptible(&queue->proc_list);
}
}
}
static inline int queue_empty(void)
{
return queue->head == queue->tail;
}
static int fasync_aux(int fd, struct file *filp, int on)
{
int retval;
retval = fasync_helper(fd, filp, on, &queue->fasync);
if (retval < 0)
return retval;
return 0;
}
/*
* Random magic cookie for the aux device
*/
#define AUX_DEV ((void *)queue)
static int release_aux(struct inode * inode, struct file * file)
{
fasync_aux(-1, file, 0);
if (--aux_count)
return 0;
free_irq(IRQ_MOUSERX, AUX_DEV);
return 0;
}
/*
* Install interrupt handler.
* Enable auxiliary device.
*/
static int open_aux(struct inode * inode, struct file * file)
{
if (aux_count++)
return 0;
queue->head = queue->tail = 0; /* Flush input queue */
if (request_irq(IRQ_MOUSERX, psaux_interrupt, SA_SHIRQ, "ps/2 mouse",
AUX_DEV)) {
aux_count--;
return -EBUSY;
}
aux_write_ack(AUX_ENABLE_DEV); /* Enable aux device */
return 0;
}
/*
* Put bytes from input queue to buffer.
*/
static ssize_t read_aux(struct file * file, char * buffer,
size_t count, loff_t *ppos)
{
DECLARE_WAITQUEUE(wait, current);
ssize_t i = count;
unsigned char c;
if (queue_empty()) {
if (file->f_flags & O_NONBLOCK)
return -EAGAIN;
add_wait_queue(&queue->proc_list, &wait);
repeat:
current->state = TASK_INTERRUPTIBLE;
if (queue_empty() && !signal_pending(current)) {
schedule();
goto repeat;
}
current->state = TASK_RUNNING;
remove_wait_queue(&queue->proc_list, &wait);
}
while (i > 0 && !queue_empty()) {
c = get_from_queue();
put_user(c, buffer++);
i--;
}
if (count-i) {
file->f_dentry->d_inode->i_atime = CURRENT_TIME;
return count-i;
}
if (signal_pending(current))
return -ERESTARTSYS;
return 0;
}
/*
* Write to the aux device.
*/
static ssize_t write_aux(struct file * file, const char * buffer,
size_t count, loff_t *ppos)
{
ssize_t retval = 0;
if (count) {
ssize_t written = 0;
if (count > 32)
count = 32; /* Limit to 32 bytes. */
do {
char c;
get_user(c, buffer++);
aux_write_dev(c);
written++;
} while (--count);
retval = -EIO;
if (written) {
retval = written;
file->f_dentry->d_inode->i_mtime = CURRENT_TIME;
}
}
return retval;
}
static unsigned int aux_poll(struct file *file, poll_table * wait)
{
poll_wait(file, &queue->proc_list, wait);
if (!queue_empty())
return POLLIN | POLLRDNORM;
return 0;
}
struct file_operations psaux_fops = {
.read = read_aux,
.write = write_aux,
.poll = aux_poll,
.open = open_aux,
.release = release_aux,
.fasync = fasync_aux,
};
/*
* Initialize driver.
*/
static struct miscdevice psaux_mouse = {
PSMOUSE_MINOR, "psaux", &psaux_fops
};
int __init psaux_init(void)
{
/* Reset the mouse state machine. */
iomd_writeb(0, IOMD_MSECTL);
iomd_writeb(8, IOMD_MSECTL);
queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
if (queue == NULL)
return -ENOMEM;
if (misc_register(&psaux_mouse)) {
kfree(queue);
return -ENODEV;
}
memset(queue, 0, sizeof(*queue));
queue->head = queue->tail = 0;
init_waitqueue_head(&queue->proc_list);
aux_write_ack(AUX_SET_SAMPLE);
aux_write_ack(100); /* 100 samples/sec */
aux_write_ack(AUX_SET_RES);
aux_write_ack(3); /* 8 counts per mm */
aux_write_ack(AUX_SET_SCALE21); /* 2:1 scaling */
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment