29 #include <linux/slab.h>
30 #include <linux/module.h>
31 #include <linux/input.h>
33 #include <linux/serio.h>
35 #define DRIVER_DESC "XT keyboard driver"
41 #define XTKBD_EMUL0 0xe0
42 #define XTKBD_EMUL1 0xe1
43 #define XTKBD_KEY 0x7f
44 #define XTKBD_RELEASE 0x80
46 static unsigned char xtkbd_keycode[256] = {
47 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
48 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
49 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
50 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
51 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
52 80, 81, 82, 83, 0, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0,
53 0, 0, 0, 0, 0, 87, 88, 0, 0, 0, 0,110,111,103,108,105,
59 struct input_dev *
dev;
67 struct xtkbd *
xtkbd = serio_get_drvdata(serio);
77 input_sync(xtkbd->
dev);
80 data & XTKBD_KEY, data &
XTKBD_RELEASE ?
"released" :
"pressed");
89 struct input_dev *input_dev;
94 input_dev = input_allocate_device();
95 if (!xtkbd || !input_dev)
99 xtkbd->
dev = input_dev;
103 input_dev->name =
"XT Keyboard";
104 input_dev->phys = xtkbd->
phys;
106 input_dev->id.vendor = 0x0001;
107 input_dev->id.product = 0x0001;
108 input_dev->id.version = 0x0100;
109 input_dev->dev.parent = &serio->
dev;
112 input_dev->keycode = xtkbd->
keycode;
113 input_dev->keycodesize =
sizeof(
unsigned char);
114 input_dev->keycodemax =
ARRAY_SIZE(xtkbd_keycode);
116 for (i = 0; i < 255; i++)
120 serio_set_drvdata(serio, xtkbd);
126 err = input_register_device(xtkbd->
dev);
133 fail2: serio_set_drvdata(serio,
NULL);
134 fail1: input_free_device(input_dev);
139 static void xtkbd_disconnect(
struct serio *serio)
141 struct xtkbd *xtkbd = serio_get_drvdata(serio);
144 serio_set_drvdata(serio,
NULL);
145 input_unregister_device(xtkbd->
dev);
166 .id_table = xtkbd_serio_ids,
167 .interrupt = xtkbd_interrupt,
168 .connect = xtkbd_connect,
169 .disconnect = xtkbd_disconnect,