aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio/libps2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/serio/libps2.c')
-rw-r--r--drivers/input/serio/libps2.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
index ed202f2f251a..dcb16b5cbec0 100644
--- a/drivers/input/serio/libps2.c
+++ b/drivers/input/serio/libps2.c
@@ -27,15 +27,6 @@ MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>");
27MODULE_DESCRIPTION("PS/2 driver library"); 27MODULE_DESCRIPTION("PS/2 driver library");
28MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
29 29
30EXPORT_SYMBOL(ps2_init);
31EXPORT_SYMBOL(ps2_sendbyte);
32EXPORT_SYMBOL(ps2_drain);
33EXPORT_SYMBOL(ps2_command);
34EXPORT_SYMBOL(ps2_schedule_command);
35EXPORT_SYMBOL(ps2_handle_ack);
36EXPORT_SYMBOL(ps2_handle_response);
37EXPORT_SYMBOL(ps2_cmd_aborted);
38
39/* Work structure to schedule execution of a command */ 30/* Work structure to schedule execution of a command */
40struct ps2work { 31struct ps2work {
41 struct work_struct work; 32 struct work_struct work;
@@ -71,6 +62,7 @@ int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout)
71 62
72 return -ps2dev->nak; 63 return -ps2dev->nak;
73} 64}
65EXPORT_SYMBOL(ps2_sendbyte);
74 66
75/* 67/*
76 * ps2_drain() waits for device to transmit requested number of bytes 68 * ps2_drain() waits for device to transmit requested number of bytes
@@ -96,15 +88,16 @@ void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout)
96 msecs_to_jiffies(timeout)); 88 msecs_to_jiffies(timeout));
97 mutex_unlock(&ps2dev->cmd_mutex); 89 mutex_unlock(&ps2dev->cmd_mutex);
98} 90}
91EXPORT_SYMBOL(ps2_drain);
99 92
100/* 93/*
101 * ps2_is_keyboard_id() checks received ID byte against the list of 94 * ps2_is_keyboard_id() checks received ID byte against the list of
102 * known keyboard IDs. 95 * known keyboard IDs.
103 */ 96 */
104 97
105static inline int ps2_is_keyboard_id(char id_byte) 98int ps2_is_keyboard_id(char id_byte)
106{ 99{
107 static char keyboard_ids[] = { 100 const static char keyboard_ids[] = {
108 0xab, /* Regular keyboards */ 101 0xab, /* Regular keyboards */
109 0xac, /* NCD Sun keyboard */ 102 0xac, /* NCD Sun keyboard */
110 0x2b, /* Trust keyboard, translated */ 103 0x2b, /* Trust keyboard, translated */
@@ -115,6 +108,7 @@ static inline int ps2_is_keyboard_id(char id_byte)
115 108
116 return memchr(keyboard_ids, id_byte, sizeof(keyboard_ids)) != NULL; 109 return memchr(keyboard_ids, id_byte, sizeof(keyboard_ids)) != NULL;
117} 110}
111EXPORT_SYMBOL(ps2_is_keyboard_id);
118 112
119/* 113/*
120 * ps2_adjust_timeout() is called after receiving 1st byte of command 114 * ps2_adjust_timeout() is called after receiving 1st byte of command
@@ -139,6 +133,19 @@ static int ps2_adjust_timeout(struct ps2dev *ps2dev, int command, int timeout)
139 133
140 case PS2_CMD_GETID: 134 case PS2_CMD_GETID:
141 /* 135 /*
136 * Microsoft Natural Elite keyboard responds to
137 * the GET ID command as it were a mouse, with
138 * a single byte. Fail the command so atkbd will
139 * use alternative probe to detect it.
140 */
141 if (ps2dev->cmdbuf[1] == 0xaa) {
142 serio_pause_rx(ps2dev->serio);
143 ps2dev->flags = 0;
144 serio_continue_rx(ps2dev->serio);
145 timeout = 0;
146 }
147
148 /*
142 * If device behind the port is not a keyboard there 149 * If device behind the port is not a keyboard there
143 * won't be 2nd byte of ID response. 150 * won't be 2nd byte of ID response.
144 */ 151 */
@@ -237,6 +244,7 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
237 mutex_unlock(&ps2dev->cmd_mutex); 244 mutex_unlock(&ps2dev->cmd_mutex);
238 return rc; 245 return rc;
239} 246}
247EXPORT_SYMBOL(ps2_command);
240 248
241/* 249/*
242 * ps2_execute_scheduled_command() sends a command, previously scheduled by 250 * ps2_execute_scheduled_command() sends a command, previously scheduled by
@@ -279,6 +287,7 @@ int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int comman
279 287
280 return 0; 288 return 0;
281} 289}
290EXPORT_SYMBOL(ps2_schedule_command);
282 291
283/* 292/*
284 * ps2_init() initializes ps2dev structure 293 * ps2_init() initializes ps2dev structure
@@ -290,6 +299,7 @@ void ps2_init(struct ps2dev *ps2dev, struct serio *serio)
290 init_waitqueue_head(&ps2dev->wait); 299 init_waitqueue_head(&ps2dev->wait);
291 ps2dev->serio = serio; 300 ps2dev->serio = serio;
292} 301}
302EXPORT_SYMBOL(ps2_init);
293 303
294/* 304/*
295 * ps2_handle_ack() is supposed to be used in interrupt handler 305 * ps2_handle_ack() is supposed to be used in interrupt handler
@@ -335,6 +345,7 @@ int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data)
335 345
336 return 1; 346 return 1;
337} 347}
348EXPORT_SYMBOL(ps2_handle_ack);
338 349
339/* 350/*
340 * ps2_handle_response() is supposed to be used in interrupt handler 351 * ps2_handle_response() is supposed to be used in interrupt handler
@@ -360,6 +371,7 @@ int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data)
360 371
361 return 1; 372 return 1;
362} 373}
374EXPORT_SYMBOL(ps2_handle_response);
363 375
364void ps2_cmd_aborted(struct ps2dev *ps2dev) 376void ps2_cmd_aborted(struct ps2dev *ps2dev)
365{ 377{
@@ -371,4 +383,4 @@ void ps2_cmd_aborted(struct ps2dev *ps2dev)
371 383
372 ps2dev->flags = 0; 384 ps2dev->flags = 0;
373} 385}
374 386EXPORT_SYMBOL(ps2_cmd_aborted);