Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input

+982 -308
+1
Documentation/kernel-parameters.txt
··· 549 549 keyboard and can not control its state 550 550 (Don't attempt to blink the leds) 551 551 i8042.noaux [HW] Don't check for auxiliary (== mouse) port 552 + i8042.nokbd [HW] Don't check/create keyboard port 552 553 i8042.nomux [HW] Don't check presence of an active multiplexing 553 554 controller 554 555 i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX
+56 -55
drivers/char/keyboard.c
··· 14 14 * `Sticky' modifier keys, 951006. 15 15 * 16 16 * 11-11-96: SAK should now work in the raw mode (Martin Mares) 17 - * 17 + * 18 18 * Modified to provide 'generic' keyboard support by Hamish Macdonald 19 19 * Merge with the m68k keyboard driver and split-off of the PC low-level 20 20 * parts by Geert Uytterhoeven, May 1997 ··· 52 52 /* 53 53 * Some laptops take the 789uiojklm,. keys as number pad when NumLock is on. 54 54 * This seems a good reason to start with NumLock off. On HIL keyboards 55 - * of PARISC machines however there is no NumLock key and everyone expects the keypad 55 + * of PARISC machines however there is no NumLock key and everyone expects the keypad 56 56 * to be used for numbers. 57 57 */ 58 58 ··· 76 76 k_meta, k_ascii, k_lock, k_lowercase,\ 77 77 k_slock, k_dead2, k_ignore, k_ignore 78 78 79 - typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value, 79 + typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value, 80 80 char up_flag, struct pt_regs *regs); 81 81 static k_handler_fn K_HANDLERS; 82 82 static k_handler_fn *k_handler[16] = { K_HANDLERS }; 83 83 84 84 #define FN_HANDLERS\ 85 - fn_null, fn_enter, fn_show_ptregs, fn_show_mem,\ 86 - fn_show_state, fn_send_intr, fn_lastcons, fn_caps_toggle,\ 87 - fn_num, fn_hold, fn_scroll_forw, fn_scroll_back,\ 88 - fn_boot_it, fn_caps_on, fn_compose, fn_SAK,\ 89 - fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num 85 + fn_null, fn_enter, fn_show_ptregs, fn_show_mem,\ 86 + fn_show_state, fn_send_intr, fn_lastcons, fn_caps_toggle,\ 87 + fn_num, fn_hold, fn_scroll_forw, fn_scroll_back,\ 88 + fn_boot_it, fn_caps_on, fn_compose, fn_SAK,\ 89 + fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num 90 90 91 91 typedef void (fn_handler_fn)(struct vc_data *vc, struct pt_regs *regs); 92 92 static fn_handler_fn FN_HANDLERS; ··· 159 159 */ 160 160 int getkeycode(unsigned int scancode) 161 161 { 162 - struct list_head * node; 162 + struct list_head *node; 163 163 struct input_dev *dev = NULL; 164 164 165 - list_for_each(node,&kbd_handler.h_list) { 166 - struct input_handle * handle = to_handle_h(node); 167 - if (handle->dev->keycodesize) { 168 - dev = handle->dev; 165 + list_for_each(node, &kbd_handler.h_list) { 166 + struct input_handle *handle = to_handle_h(node); 167 + if (handle->dev->keycodesize) { 168 + dev = handle->dev; 169 169 break; 170 170 } 171 171 } ··· 181 181 182 182 int setkeycode(unsigned int scancode, unsigned int keycode) 183 183 { 184 - struct list_head * node; 184 + struct list_head *node; 185 185 struct input_dev *dev = NULL; 186 186 unsigned int i, oldkey; 187 187 188 - list_for_each(node,&kbd_handler.h_list) { 188 + list_for_each(node, &kbd_handler.h_list) { 189 189 struct input_handle *handle = to_handle_h(node); 190 - if (handle->dev->keycodesize) { 191 - dev = handle->dev; 192 - break; 190 + if (handle->dev->keycodesize) { 191 + dev = handle->dev; 192 + break; 193 193 } 194 194 } 195 195 ··· 200 200 return -EINVAL; 201 201 if (keycode < 0 || keycode > KEY_MAX) 202 202 return -EINVAL; 203 - if (keycode >> (dev->keycodesize * 8)) 203 + if (dev->keycodesize < sizeof(keycode) && (keycode >> (dev->keycodesize * 8))) 204 204 return -EINVAL; 205 205 206 206 oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); ··· 216 216 } 217 217 218 218 /* 219 - * Making beeps and bells. 219 + * Making beeps and bells. 220 220 */ 221 221 static void kd_nosound(unsigned long ignored) 222 222 { 223 - struct list_head * node; 223 + struct list_head *node; 224 224 225 225 list_for_each(node,&kbd_handler.h_list) { 226 226 struct input_handle *handle = to_handle_h(node); ··· 237 237 238 238 void kd_mksound(unsigned int hz, unsigned int ticks) 239 239 { 240 - struct list_head * node; 240 + struct list_head *node; 241 241 242 242 del_timer(&kd_mksound_timer); 243 243 244 244 if (hz) { 245 - list_for_each_prev(node,&kbd_handler.h_list) { 245 + list_for_each_prev(node, &kbd_handler.h_list) { 246 246 struct input_handle *handle = to_handle_h(node); 247 247 if (test_bit(EV_SND, handle->dev->evbit)) { 248 248 if (test_bit(SND_TONE, handle->dev->sndbit)) { ··· 337 337 if (c < 0x80) 338 338 /* 0******* */ 339 339 put_queue(vc, c); 340 - else if (c < 0x800) { 340 + else if (c < 0x800) { 341 341 /* 110***** 10****** */ 342 - put_queue(vc, 0xc0 | (c >> 6)); 342 + put_queue(vc, 0xc0 | (c >> 6)); 343 343 put_queue(vc, 0x80 | (c & 0x3f)); 344 - } else { 344 + } else { 345 345 /* 1110**** 10****** 10****** */ 346 346 put_queue(vc, 0xe0 | (c >> 12)); 347 347 put_queue(vc, 0x80 | ((c >> 6) & 0x3f)); 348 348 put_queue(vc, 0x80 | (c & 0x3f)); 349 - } 349 + } 350 350 } 351 351 352 - /* 352 + /* 353 353 * Called after returning from RAW mode or when changing consoles - recompute 354 354 * shift_down[] and shift_state from key_down[] maybe called when keymap is 355 355 * undefined, so that shiftkey release is seen ··· 360 360 361 361 shift_state = 0; 362 362 memset(shift_down, 0, sizeof(shift_down)); 363 - 363 + 364 364 for (i = 0; i < ARRAY_SIZE(key_down); i++) { 365 365 366 366 if (!key_down[i]) ··· 499 499 if (want_console != -1) 500 500 cur = want_console; 501 501 502 - for (i = cur-1; i != cur; i--) { 502 + for (i = cur - 1; i != cur; i--) { 503 503 if (i == -1) 504 - i = MAX_NR_CONSOLES-1; 504 + i = MAX_NR_CONSOLES - 1; 505 505 if (vc_cons_allocated(i)) 506 506 break; 507 507 } ··· 567 567 568 568 static void fn_spawn_con(struct vc_data *vc, struct pt_regs *regs) 569 569 { 570 - if (spawnpid) 571 - if(kill_proc(spawnpid, spawnsig, 1)) 572 - spawnpid = 0; 570 + if (spawnpid) 571 + if (kill_proc(spawnpid, spawnsig, 1)) 572 + spawnpid = 0; 573 573 } 574 574 575 575 static void fn_SAK(struct vc_data *vc, struct pt_regs *regs) ··· 603 603 return; 604 604 if (value >= ARRAY_SIZE(fn_handler)) 605 605 return; 606 - if ((kbd->kbdmode == VC_RAW || 607 - kbd->kbdmode == VC_MEDIUMRAW) && 606 + if ((kbd->kbdmode == VC_RAW || 607 + kbd->kbdmode == VC_MEDIUMRAW) && 608 608 value != KVAL(K_SAK)) 609 609 return; /* SAK is allowed even in raw mode */ 610 610 fn_handler[value](vc, regs); ··· 894 894 895 895 static void kbd_bh(unsigned long dummy) 896 896 { 897 - struct list_head * node; 897 + struct list_head *node; 898 898 unsigned char leds = getleds(); 899 899 900 900 if (leds != ledstate) { 901 - list_for_each(node,&kbd_handler.h_list) { 901 + list_for_each(node, &kbd_handler.h_list) { 902 902 struct input_handle * handle = to_handle_h(node); 903 903 input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); 904 904 input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); ··· 963 963 extern void sun_do_break(void); 964 964 #endif 965 965 966 - static int emulate_raw(struct vc_data *vc, unsigned int keycode, 966 + static int emulate_raw(struct vc_data *vc, unsigned int keycode, 967 967 unsigned char up_flag) 968 968 { 969 969 if (keycode > 255 || !x86_keycodes[keycode]) 970 - return -1; 970 + return -1; 971 971 972 972 switch (keycode) { 973 973 case KEY_PAUSE: ··· 981 981 case KEY_HANJA: 982 982 if (!up_flag) put_queue(vc, 0xf2); 983 983 return 0; 984 - } 984 + } 985 985 986 986 if (keycode == KEY_SYSRQ && sysrq_alt) { 987 987 put_queue(vc, 0x54 | up_flag); ··· 1104 1104 else 1105 1105 clear_bit(keycode, key_down); 1106 1106 1107 - if (rep && (!vc_kbd_mode(kbd, VC_REPEAT) || (tty && 1108 - (!L_ECHO(tty) && tty->driver->chars_in_buffer(tty))))) { 1107 + if (rep && 1108 + (!vc_kbd_mode(kbd, VC_REPEAT) || 1109 + (tty && !L_ECHO(tty) && tty->driver->chars_in_buffer(tty)))) { 1109 1110 /* 1110 1111 * Don't repeat a key if the input buffers are not empty and the 1111 - * characters get aren't echoed locally. This makes key repeat 1112 + * characters get aren't echoed locally. This makes key repeat 1112 1113 * usable with slow applications and under heavy loads. 1113 1114 */ 1114 1115 return; ··· 1131 1130 type = KTYP(keysym); 1132 1131 1133 1132 if (type < 0xf0) { 1134 - if (down && !raw_mode) to_utf8(vc, keysym); 1133 + if (down && !raw_mode) 1134 + to_utf8(vc, keysym); 1135 1135 return; 1136 1136 } 1137 1137 ··· 1156 1154 kbd->slockstate = 0; 1157 1155 } 1158 1156 1159 - static void kbd_event(struct input_handle *handle, unsigned int event_type, 1157 + static void kbd_event(struct input_handle *handle, unsigned int event_type, 1160 1158 unsigned int event_code, int value) 1161 1159 { 1162 1160 if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev)) ··· 1168 1166 schedule_console_callback(); 1169 1167 } 1170 1168 1171 - static char kbd_name[] = "kbd"; 1172 - 1173 1169 /* 1174 1170 * When a keyboard (or other input device) is found, the kbd_connect 1175 1171 * function is called. The function then looks at the device, and if it 1176 1172 * likes it, it can open it and get events from it. In this (kbd_connect) 1177 1173 * function, we should decide which VT to bind that keyboard to initially. 1178 1174 */ 1179 - static struct input_handle *kbd_connect(struct input_handler *handler, 1175 + static struct input_handle *kbd_connect(struct input_handler *handler, 1180 1176 struct input_dev *dev, 1181 1177 struct input_device_id *id) 1182 1178 { ··· 1182 1182 int i; 1183 1183 1184 1184 for (i = KEY_RESERVED; i < BTN_MISC; i++) 1185 - if (test_bit(i, dev->keybit)) break; 1185 + if (test_bit(i, dev->keybit)) 1186 + break; 1186 1187 1187 - if ((i == BTN_MISC) && !test_bit(EV_SND, dev->evbit)) 1188 + if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) 1188 1189 return NULL; 1189 1190 1190 - if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) 1191 + if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) 1191 1192 return NULL; 1192 1193 memset(handle, 0, sizeof(struct input_handle)); 1193 1194 1194 1195 handle->dev = dev; 1195 1196 handle->handler = handler; 1196 - handle->name = kbd_name; 1197 + handle->name = "kbd"; 1197 1198 1198 1199 input_open_device(handle); 1199 1200 kbd_refresh_leds(handle); ··· 1213 1212 .flags = INPUT_DEVICE_ID_MATCH_EVBIT, 1214 1213 .evbit = { BIT(EV_KEY) }, 1215 1214 }, 1216 - 1215 + 1217 1216 { 1218 1217 .flags = INPUT_DEVICE_ID_MATCH_EVBIT, 1219 1218 .evbit = { BIT(EV_SND) }, 1220 - }, 1219 + }, 1221 1220 1222 1221 { }, /* Terminating entry */ 1223 1222 };
+1 -1
drivers/input/evdev.c
··· 322 322 if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; 323 323 if (get_user(v, ip + 1)) return -EFAULT; 324 324 if (v < 0 || v > KEY_MAX) return -EINVAL; 325 - if (v >> (dev->keycodesize * 8)) return -EINVAL; 325 + if (dev->keycodesize < sizeof(v) && (v >> (dev->keycodesize * 8))) return -EINVAL; 326 326 u = SET_INPUT_KEYCODE(dev, t, v); 327 327 clear_bit(u, dev->keybit); 328 328 set_bit(v, dev->keybit);
+7 -25
drivers/input/joystick/iforce/iforce-packets.c
··· 249 249 250 250 int iforce_get_id_packet(struct iforce *iforce, char *packet) 251 251 { 252 - DECLARE_WAITQUEUE(wait, current); 253 - int timeout = HZ; /* 1 second */ 254 - 255 252 switch (iforce->bus) { 256 253 257 254 case IFORCE_USB: ··· 257 260 iforce->cr.bRequest = packet[0]; 258 261 iforce->ctrl->dev = iforce->usbdev; 259 262 260 - set_current_state(TASK_INTERRUPTIBLE); 261 - add_wait_queue(&iforce->wait, &wait); 262 - 263 - if (usb_submit_urb(iforce->ctrl, GFP_ATOMIC)) { 264 - set_current_state(TASK_RUNNING); 265 - remove_wait_queue(&iforce->wait, &wait); 263 + if (usb_submit_urb(iforce->ctrl, GFP_ATOMIC)) 266 264 return -1; 267 - } 268 265 269 - while (timeout && iforce->ctrl->status == -EINPROGRESS) 270 - timeout = schedule_timeout(timeout); 266 + wait_event_interruptible_timeout(iforce->wait, 267 + iforce->ctrl->status != -EINPROGRESS, HZ); 271 268 272 - set_current_state(TASK_RUNNING); 273 - remove_wait_queue(&iforce->wait, &wait); 274 - 275 - if (!timeout) { 269 + if (iforce->ctrl->status != -EINPROGRESS) { 276 270 usb_unlink_urb(iforce->ctrl); 277 271 return -1; 278 272 } ··· 278 290 iforce->expect_packet = FF_CMD_QUERY; 279 291 iforce_send_packet(iforce, FF_CMD_QUERY, packet); 280 292 281 - set_current_state(TASK_INTERRUPTIBLE); 282 - add_wait_queue(&iforce->wait, &wait); 293 + wait_event_interruptible_timeout(iforce->wait, 294 + !iforce->expect_packet, HZ); 283 295 284 - while (timeout && iforce->expect_packet) 285 - timeout = schedule_timeout(timeout); 286 - 287 - set_current_state(TASK_RUNNING); 288 - remove_wait_queue(&iforce->wait, &wait); 289 - 290 - if (!timeout) { 296 + if (iforce->expect_packet) { 291 297 iforce->expect_packet = 0; 292 298 return -1; 293 299 }
+1
drivers/input/joystick/iforce/iforce-usb.c
··· 95 95 goto exit; 96 96 } 97 97 98 + wake_up(&iforce->wait); 98 99 iforce_process_packet(iforce, 99 100 (iforce->data[0] << 8) | (urb->actual_length - 1), iforce->data + 1, regs); 100 101
+7 -3
drivers/input/keyboard/atkbd.c
··· 208 208 unsigned char resend; 209 209 unsigned char release; 210 210 unsigned char bat_xl; 211 + unsigned char err_xl; 211 212 unsigned int last; 212 213 unsigned long time; 213 214 }; ··· 297 296 if (atkbd->emul || 298 297 !(code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1 || 299 298 code == ATKBD_RET_HANGUEL || code == ATKBD_RET_HANJA || 300 - code == ATKBD_RET_ERR || 299 + (code == ATKBD_RET_ERR && !atkbd->err_xl) || 301 300 (code == ATKBD_RET_BAT && !atkbd->bat_xl))) { 302 301 atkbd->release = code >> 7; 303 302 code &= 0x7f; 304 303 } 305 304 306 - if (!atkbd->emul && 307 - (code & 0x7f) == (ATKBD_RET_BAT & 0x7f)) 305 + if (!atkbd->emul) { 306 + if ((code & 0x7f) == (ATKBD_RET_BAT & 0x7f)) 308 307 atkbd->bat_xl = !atkbd->release; 308 + if ((code & 0x7f) == (ATKBD_RET_ERR & 0x7f)) 309 + atkbd->err_xl = !atkbd->release; 310 + } 309 311 } 310 312 311 313 switch (code) {
+1 -1
drivers/input/keyboard/sunkbd.c
··· 44 44 MODULE_LICENSE("GPL"); 45 45 46 46 static unsigned char sunkbd_keycode[128] = { 47 - 0,128,114,129,115, 59, 60, 68, 61, 87, 62, 88, 63,100, 64, 0, 47 + 0,128,114,129,115, 59, 60, 68, 61, 87, 62, 88, 63,100, 64,112, 48 48 65, 66, 67, 56,103,119, 99, 70,105,130,131,108,106, 1, 2, 3, 49 49 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 41, 14,110,113, 98, 55, 50 50 116,132, 83,133,102, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+1 -1
drivers/input/mouse/Makefile
··· 15 15 obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o 16 16 obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o 17 17 18 - psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o 18 + psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o trackpoint.o
+1 -1
drivers/input/mouse/alps.c
··· 170 170 input_report_key(dev, BTN_TOOL_FINGER, z > 0); 171 171 172 172 if (priv->i->flags & ALPS_WHEEL) 173 - input_report_rel(dev, REL_WHEEL, ((packet[0] >> 4) & 0x07) | ((packet[2] >> 2) & 0x08)); 173 + input_report_rel(dev, REL_WHEEL, ((packet[2] << 1) & 0x08) - ((packet[0] >> 4) & 0x07)); 174 174 175 175 if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { 176 176 input_report_key(dev, BTN_FORWARD, forward);
+8 -5
drivers/input/mouse/logips2pp.c
··· 150 150 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 151 151 } 152 152 153 - static ssize_t psmouse_attr_show_smartscroll(struct psmouse *psmouse, char *buf) 153 + static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse, void *data, char *buf) 154 154 { 155 155 return sprintf(buf, "%d\n", psmouse->smartscroll ? 1 : 0); 156 156 } 157 157 158 - static ssize_t psmouse_attr_set_smartscroll(struct psmouse *psmouse, const char *buf, size_t count) 158 + static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, const char *buf, size_t count) 159 159 { 160 160 unsigned long value; 161 161 char *rest; ··· 169 169 return count; 170 170 } 171 171 172 - PSMOUSE_DEFINE_ATTR(smartscroll); 172 + PSMOUSE_DEFINE_ATTR(smartscroll, S_IWUSR | S_IRUGO, NULL, 173 + ps2pp_attr_show_smartscroll, ps2pp_attr_set_smartscroll); 173 174 174 175 /* 175 176 * Support 800 dpi resolution _only_ if the user wants it (there are good ··· 195 194 196 195 static void ps2pp_disconnect(struct psmouse *psmouse) 197 196 { 198 - device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll); 197 + device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll.dattr); 199 198 } 200 199 201 200 static struct ps2pp_info *get_model_info(unsigned char model) ··· 223 222 { 80, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, 224 223 { 81, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 225 224 { 83, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 225 + { 86, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 226 226 { 88, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 227 227 { 96, 0, 0 }, 228 228 { 97, PS2PP_KIND_TP3, PS2PP_WHEEL | PS2PP_HWHEEL }, ··· 381 379 psmouse->set_resolution = ps2pp_set_resolution; 382 380 psmouse->disconnect = ps2pp_disconnect; 383 381 384 - device_create_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll); 382 + device_create_file(&psmouse->ps2dev.serio->dev, 383 + &psmouse_attr_smartscroll.dattr); 385 384 } 386 385 } 387 386
+80 -52
drivers/input/mouse/psmouse-base.c
··· 25 25 #include "logips2pp.h" 26 26 #include "alps.h" 27 27 #include "lifebook.h" 28 + #include "trackpoint.h" 28 29 29 30 #define DRIVER_DESC "PS/2 mouse driver" 30 31 ··· 58 57 module_param_named(resetafter, psmouse_resetafter, uint, 0644); 59 58 MODULE_PARM_DESC(resetafter, "Reset device after so many bad packets (0 = never)."); 60 59 61 - PSMOUSE_DEFINE_ATTR(protocol); 62 - PSMOUSE_DEFINE_ATTR(rate); 63 - PSMOUSE_DEFINE_ATTR(resolution); 64 - PSMOUSE_DEFINE_ATTR(resetafter); 60 + PSMOUSE_DEFINE_ATTR(protocol, S_IWUSR | S_IRUGO, 61 + NULL, 62 + psmouse_attr_show_protocol, psmouse_attr_set_protocol); 63 + PSMOUSE_DEFINE_ATTR(rate, S_IWUSR | S_IRUGO, 64 + (void *) offsetof(struct psmouse, rate), 65 + psmouse_show_int_attr, psmouse_attr_set_rate); 66 + PSMOUSE_DEFINE_ATTR(resolution, S_IWUSR | S_IRUGO, 67 + (void *) offsetof(struct psmouse, resolution), 68 + psmouse_show_int_attr, psmouse_attr_set_resolution); 69 + PSMOUSE_DEFINE_ATTR(resetafter, S_IWUSR | S_IRUGO, 70 + (void *) offsetof(struct psmouse, resetafter), 71 + psmouse_show_int_attr, psmouse_set_int_attr); 72 + 73 + static struct attribute *psmouse_attributes[] = { 74 + &psmouse_attr_protocol.dattr.attr, 75 + &psmouse_attr_rate.dattr.attr, 76 + &psmouse_attr_resolution.dattr.attr, 77 + &psmouse_attr_resetafter.dattr.attr, 78 + NULL 79 + }; 80 + 81 + static struct attribute_group psmouse_attribute_group = { 82 + .attrs = psmouse_attributes, 83 + }; 65 84 66 85 __obsolete_setup("psmouse_noext"); 67 86 __obsolete_setup("psmouse_resolution="); ··· 541 520 return PSMOUSE_IMPS; 542 521 543 522 /* 523 + * Try to initialize the IBM TrackPoint 524 + */ 525 + if (max_proto > PSMOUSE_IMEX && trackpoint_detect(psmouse, set_properties) == 0) 526 + return PSMOUSE_TRACKPOINT; 527 + 528 + /* 544 529 * Okay, all failed, we have a standard mouse here. The number of the buttons 545 530 * is still a question, though. We assume 3. 546 531 */ ··· 625 598 .name = "LBPS/2", 626 599 .alias = "lifebook", 627 600 .init = lifebook_init, 601 + }, 602 + { 603 + .type = PSMOUSE_TRACKPOINT, 604 + .name = "TPPS/2", 605 + .alias = "trackpoint", 606 + .detect = trackpoint_detect, 628 607 }, 629 608 { 630 609 .type = PSMOUSE_AUTO, ··· 820 787 821 788 psmouse = serio_get_drvdata(serio); 822 789 823 - device_remove_file(&serio->dev, &psmouse_attr_protocol); 824 - device_remove_file(&serio->dev, &psmouse_attr_rate); 825 - device_remove_file(&serio->dev, &psmouse_attr_resolution); 826 - device_remove_file(&serio->dev, &psmouse_attr_resetafter); 790 + sysfs_remove_group(&serio->dev.kobj, &psmouse_attribute_group); 827 791 828 792 down(&psmouse_sem); 829 793 ··· 957 927 if (parent && parent->pt_activate) 958 928 parent->pt_activate(parent); 959 929 960 - device_create_file(&serio->dev, &psmouse_attr_protocol); 961 - device_create_file(&serio->dev, &psmouse_attr_rate); 962 - device_create_file(&serio->dev, &psmouse_attr_resolution); 963 - device_create_file(&serio->dev, &psmouse_attr_resetafter); 930 + sysfs_create_group(&serio->dev.kobj, &psmouse_attribute_group); 964 931 965 932 psmouse_activate(psmouse); 966 933 ··· 1054 1027 .cleanup = psmouse_cleanup, 1055 1028 }; 1056 1029 1057 - ssize_t psmouse_attr_show_helper(struct device *dev, char *buf, 1058 - ssize_t (*handler)(struct psmouse *, char *)) 1030 + ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *devattr, 1031 + char *buf) 1059 1032 { 1060 1033 struct serio *serio = to_serio_port(dev); 1034 + struct psmouse_attribute *attr = to_psmouse_attr(devattr); 1035 + struct psmouse *psmouse; 1061 1036 int retval; 1062 1037 1063 1038 retval = serio_pin_driver(serio); ··· 1071 1042 goto out; 1072 1043 } 1073 1044 1074 - retval = handler(serio_get_drvdata(serio), buf); 1045 + psmouse = serio_get_drvdata(serio); 1046 + 1047 + retval = attr->show(psmouse, attr->data, buf); 1075 1048 1076 1049 out: 1077 1050 serio_unpin_driver(serio); 1078 1051 return retval; 1079 1052 } 1080 1053 1081 - ssize_t psmouse_attr_set_helper(struct device *dev, const char *buf, size_t count, 1082 - ssize_t (*handler)(struct psmouse *, const char *, size_t)) 1054 + ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr, 1055 + const char *buf, size_t count) 1083 1056 { 1084 1057 struct serio *serio = to_serio_port(dev); 1085 - struct psmouse *psmouse = serio_get_drvdata(serio); 1086 - struct psmouse *parent = NULL; 1058 + struct psmouse_attribute *attr = to_psmouse_attr(devattr); 1059 + struct psmouse *psmouse, *parent = NULL; 1087 1060 int retval; 1088 1061 1089 1062 retval = serio_pin_driver(serio); ··· 1101 1070 if (retval) 1102 1071 goto out_unpin; 1103 1072 1073 + psmouse = serio_get_drvdata(serio); 1074 + 1104 1075 if (psmouse->state == PSMOUSE_IGNORE) { 1105 1076 retval = -ENODEV; 1106 1077 goto out_up; ··· 1115 1082 1116 1083 psmouse_deactivate(psmouse); 1117 1084 1118 - retval = handler(psmouse, buf, count); 1085 + retval = attr->set(psmouse, attr->data, buf, count); 1119 1086 1120 1087 if (retval != -ENODEV) 1121 1088 psmouse_activate(psmouse); ··· 1130 1097 return retval; 1131 1098 } 1132 1099 1133 - static ssize_t psmouse_attr_show_protocol(struct psmouse *psmouse, char *buf) 1100 + static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf) 1101 + { 1102 + unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset); 1103 + 1104 + return sprintf(buf, "%lu\n", *field); 1105 + } 1106 + 1107 + static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count) 1108 + { 1109 + unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset); 1110 + unsigned long value; 1111 + char *rest; 1112 + 1113 + value = simple_strtoul(buf, &rest, 10); 1114 + if (*rest) 1115 + return -EINVAL; 1116 + 1117 + *field = value; 1118 + 1119 + return count; 1120 + } 1121 + 1122 + static ssize_t psmouse_attr_show_protocol(struct psmouse *psmouse, void *data, char *buf) 1134 1123 { 1135 1124 return sprintf(buf, "%s\n", psmouse_protocol_by_type(psmouse->type)->name); 1136 1125 } 1137 1126 1138 - static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, const char *buf, size_t count) 1127 + static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, const char *buf, size_t count) 1139 1128 { 1140 1129 struct serio *serio = psmouse->ps2dev.serio; 1141 1130 struct psmouse *parent = NULL; ··· 1221 1166 return count; 1222 1167 } 1223 1168 1224 - static ssize_t psmouse_attr_show_rate(struct psmouse *psmouse, char *buf) 1225 - { 1226 - return sprintf(buf, "%d\n", psmouse->rate); 1227 - } 1228 - 1229 - static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, const char *buf, size_t count) 1169 + static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const char *buf, size_t count) 1230 1170 { 1231 1171 unsigned long value; 1232 1172 char *rest; ··· 1234 1184 return count; 1235 1185 } 1236 1186 1237 - static ssize_t psmouse_attr_show_resolution(struct psmouse *psmouse, char *buf) 1238 - { 1239 - return sprintf(buf, "%d\n", psmouse->resolution); 1240 - } 1241 - 1242 - static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, const char *buf, size_t count) 1187 + static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, const char *buf, size_t count) 1243 1188 { 1244 1189 unsigned long value; 1245 1190 char *rest; ··· 1247 1202 return count; 1248 1203 } 1249 1204 1250 - static ssize_t psmouse_attr_show_resetafter(struct psmouse *psmouse, char *buf) 1251 - { 1252 - return sprintf(buf, "%d\n", psmouse->resetafter); 1253 - } 1254 - 1255 - static ssize_t psmouse_attr_set_resetafter(struct psmouse *psmouse, const char *buf, size_t count) 1256 - { 1257 - unsigned long value; 1258 - char *rest; 1259 - 1260 - value = simple_strtoul(buf, &rest, 10); 1261 - if (*rest) 1262 - return -EINVAL; 1263 - 1264 - psmouse->resetafter = value; 1265 - return count; 1266 - } 1267 1205 1268 1206 static int psmouse_set_maxproto(const char *val, struct kernel_param *kp) 1269 1207 { ··· 1262 1234 1263 1235 *((unsigned int *)kp->arg) = proto->type; 1264 1236 1265 - return 0; \ 1237 + return 0; 1266 1238 } 1267 1239 1268 1240 static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp)
+32 -18
drivers/input/mouse/psmouse.h
··· 78 78 PSMOUSE_SYNAPTICS, 79 79 PSMOUSE_ALPS, 80 80 PSMOUSE_LIFEBOOK, 81 + PSMOUSE_TRACKPOINT, 81 82 PSMOUSE_AUTO /* This one should always be last */ 82 83 }; 83 84 ··· 86 85 int psmouse_reset(struct psmouse *psmouse); 87 86 void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution); 88 87 89 - ssize_t psmouse_attr_show_helper(struct device *dev, char *buf, 90 - ssize_t (*handler)(struct psmouse *, char *)); 91 - ssize_t psmouse_attr_set_helper(struct device *dev, const char *buf, size_t count, 92 - ssize_t (*handler)(struct psmouse *, const char *, size_t)); 93 88 94 - #define PSMOUSE_DEFINE_ATTR(_name) \ 95 - static ssize_t psmouse_attr_show_##_name(struct psmouse *, char *); \ 96 - static ssize_t psmouse_attr_set_##_name(struct psmouse *, const char *, size_t);\ 97 - static ssize_t psmouse_do_show_##_name(struct device *d, struct device_attribute *attr, char *b) \ 98 - { \ 99 - return psmouse_attr_show_helper(d, b, psmouse_attr_show_##_name); \ 100 - } \ 101 - static ssize_t psmouse_do_set_##_name(struct device *d, struct device_attribute *attr, const char *b, size_t s)\ 102 - { \ 103 - return psmouse_attr_set_helper(d, b, s, psmouse_attr_set_##_name); \ 104 - } \ 105 - static struct device_attribute psmouse_attr_##_name = \ 106 - __ATTR(_name, S_IWUSR | S_IRUGO, \ 107 - psmouse_do_show_##_name, psmouse_do_set_##_name); 89 + struct psmouse_attribute { 90 + struct device_attribute dattr; 91 + void *data; 92 + ssize_t (*show)(struct psmouse *psmouse, void *data, char *buf); 93 + ssize_t (*set)(struct psmouse *psmouse, void *data, 94 + const char *buf, size_t count); 95 + }; 96 + #define to_psmouse_attr(a) container_of((a), struct psmouse_attribute, dattr) 97 + 98 + ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *attr, 99 + char *buf); 100 + ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *attr, 101 + const char *buf, size_t count); 102 + 103 + #define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \ 104 + static ssize_t _show(struct psmouse *, void *data, char *); \ 105 + static ssize_t _set(struct psmouse *, void *data, const char *, size_t); \ 106 + static struct psmouse_attribute psmouse_attr_##_name = { \ 107 + .dattr = { \ 108 + .attr = { \ 109 + .name = __stringify(_name), \ 110 + .mode = _mode, \ 111 + .owner = THIS_MODULE, \ 112 + }, \ 113 + .show = psmouse_attr_show_helper, \ 114 + .store = psmouse_attr_set_helper, \ 115 + }, \ 116 + .data = _data, \ 117 + .show = _show, \ 118 + .set = _set, \ 119 + } 108 120 109 121 #endif /* _PSMOUSE_H */
+304
drivers/input/mouse/trackpoint.c
··· 1 + /* 2 + * Stephen Evanchik <evanchsa@gmail.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms of the GNU General Public License version 2 as published by 6 + * the Free Software Foundation. 7 + * 8 + * Trademarks are the property of their respective owners. 9 + */ 10 + 11 + #include <linux/delay.h> 12 + #include <linux/serio.h> 13 + #include <linux/module.h> 14 + #include <linux/moduleparam.h> 15 + #include <linux/input.h> 16 + #include <linux/libps2.h> 17 + #include <linux/proc_fs.h> 18 + #include <asm/uaccess.h> 19 + #include "psmouse.h" 20 + #include "trackpoint.h" 21 + 22 + /* 23 + * Device IO: read, write and toggle bit 24 + */ 25 + static int trackpoint_read(struct ps2dev *ps2dev, unsigned char loc, unsigned char *results) 26 + { 27 + if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) || 28 + ps2_command(ps2dev, results, MAKE_PS2_CMD(0, 1, loc))) { 29 + return -1; 30 + } 31 + 32 + return 0; 33 + } 34 + 35 + static int trackpoint_write(struct ps2dev *ps2dev, unsigned char loc, unsigned char val) 36 + { 37 + if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) || 38 + ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_WRITE_MEM)) || 39 + ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, loc)) || 40 + ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, val))) { 41 + return -1; 42 + } 43 + 44 + return 0; 45 + } 46 + 47 + static int trackpoint_toggle_bit(struct ps2dev *ps2dev, unsigned char loc, unsigned char mask) 48 + { 49 + /* Bad things will happen if the loc param isn't in this range */ 50 + if (loc < 0x20 || loc >= 0x2F) 51 + return -1; 52 + 53 + if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) || 54 + ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_TOGGLE)) || 55 + ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, loc)) || 56 + ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, mask))) { 57 + return -1; 58 + } 59 + 60 + return 0; 61 + } 62 + 63 + 64 + /* 65 + * Trackpoint-specific attributes 66 + */ 67 + struct trackpoint_attr_data { 68 + size_t field_offset; 69 + unsigned char command; 70 + unsigned char mask; 71 + }; 72 + 73 + static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf) 74 + { 75 + struct trackpoint_data *tp = psmouse->private; 76 + struct trackpoint_attr_data *attr = data; 77 + unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); 78 + 79 + return sprintf(buf, "%u\n", *field); 80 + } 81 + 82 + static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, 83 + const char *buf, size_t count) 84 + { 85 + struct trackpoint_data *tp = psmouse->private; 86 + struct trackpoint_attr_data *attr = data; 87 + unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); 88 + unsigned long value; 89 + char *rest; 90 + 91 + value = simple_strtoul(buf, &rest, 10); 92 + if (*rest || value > 255) 93 + return -EINVAL; 94 + 95 + *field = value; 96 + trackpoint_write(&psmouse->ps2dev, attr->command, value); 97 + 98 + return count; 99 + } 100 + 101 + #define TRACKPOINT_INT_ATTR(_name, _command) \ 102 + static struct trackpoint_attr_data trackpoint_attr_##_name = { \ 103 + .field_offset = offsetof(struct trackpoint_data, _name), \ 104 + .command = _command, \ 105 + }; \ 106 + PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ 107 + &trackpoint_attr_##_name, \ 108 + trackpoint_show_int_attr, trackpoint_set_int_attr) 109 + 110 + static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data, 111 + const char *buf, size_t count) 112 + { 113 + struct trackpoint_data *tp = psmouse->private; 114 + struct trackpoint_attr_data *attr = data; 115 + unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); 116 + unsigned long value; 117 + char *rest; 118 + 119 + value = simple_strtoul(buf, &rest, 10); 120 + if (*rest || value > 1) 121 + return -EINVAL; 122 + 123 + if (*field != value) { 124 + *field = value; 125 + trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask); 126 + } 127 + 128 + return count; 129 + } 130 + 131 + 132 + #define TRACKPOINT_BIT_ATTR(_name, _command, _mask) \ 133 + static struct trackpoint_attr_data trackpoint_attr_##_name = { \ 134 + .field_offset = offsetof(struct trackpoint_data, _name), \ 135 + .command = _command, \ 136 + .mask = _mask, \ 137 + }; \ 138 + PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ 139 + &trackpoint_attr_##_name, \ 140 + trackpoint_show_int_attr, trackpoint_set_bit_attr) 141 + 142 + TRACKPOINT_INT_ATTR(sensitivity, TP_SENS); 143 + TRACKPOINT_INT_ATTR(speed, TP_SPEED); 144 + TRACKPOINT_INT_ATTR(inertia, TP_INERTIA); 145 + TRACKPOINT_INT_ATTR(reach, TP_REACH); 146 + TRACKPOINT_INT_ATTR(draghys, TP_DRAGHYS); 147 + TRACKPOINT_INT_ATTR(mindrag, TP_MINDRAG); 148 + TRACKPOINT_INT_ATTR(thresh, TP_THRESH); 149 + TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH); 150 + TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME); 151 + TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV); 152 + 153 + TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON); 154 + TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK); 155 + TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV); 156 + 157 + static struct attribute *trackpoint_attrs[] = { 158 + &psmouse_attr_sensitivity.dattr.attr, 159 + &psmouse_attr_speed.dattr.attr, 160 + &psmouse_attr_inertia.dattr.attr, 161 + &psmouse_attr_reach.dattr.attr, 162 + &psmouse_attr_draghys.dattr.attr, 163 + &psmouse_attr_mindrag.dattr.attr, 164 + &psmouse_attr_thresh.dattr.attr, 165 + &psmouse_attr_upthresh.dattr.attr, 166 + &psmouse_attr_ztime.dattr.attr, 167 + &psmouse_attr_jenks.dattr.attr, 168 + &psmouse_attr_press_to_select.dattr.attr, 169 + &psmouse_attr_skipback.dattr.attr, 170 + &psmouse_attr_ext_dev.dattr.attr, 171 + NULL 172 + }; 173 + 174 + static struct attribute_group trackpoint_attr_group = { 175 + .attrs = trackpoint_attrs, 176 + }; 177 + 178 + static void trackpoint_disconnect(struct psmouse *psmouse) 179 + { 180 + sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group); 181 + 182 + kfree(psmouse->private); 183 + psmouse->private = NULL; 184 + } 185 + 186 + static int trackpoint_sync(struct psmouse *psmouse) 187 + { 188 + unsigned char toggle; 189 + struct trackpoint_data *tp = psmouse->private; 190 + 191 + if (!tp) 192 + return -1; 193 + 194 + /* Disable features that may make device unusable with this driver */ 195 + trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle); 196 + if (toggle & TP_MASK_TWOHAND) 197 + trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, TP_MASK_TWOHAND); 198 + 199 + trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG, &toggle); 200 + if (toggle & TP_MASK_SOURCE_TAG) 201 + trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG, TP_MASK_SOURCE_TAG); 202 + 203 + trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_MB, &toggle); 204 + if (toggle & TP_MASK_MB) 205 + trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_MB, TP_MASK_MB); 206 + 207 + /* Push the config to the device */ 208 + trackpoint_write(&psmouse->ps2dev, TP_SENS, tp->sensitivity); 209 + trackpoint_write(&psmouse->ps2dev, TP_INERTIA, tp->inertia); 210 + trackpoint_write(&psmouse->ps2dev, TP_SPEED, tp->speed); 211 + 212 + trackpoint_write(&psmouse->ps2dev, TP_REACH, tp->reach); 213 + trackpoint_write(&psmouse->ps2dev, TP_DRAGHYS, tp->draghys); 214 + trackpoint_write(&psmouse->ps2dev, TP_MINDRAG, tp->mindrag); 215 + 216 + trackpoint_write(&psmouse->ps2dev, TP_THRESH, tp->thresh); 217 + trackpoint_write(&psmouse->ps2dev, TP_UP_THRESH, tp->upthresh); 218 + 219 + trackpoint_write(&psmouse->ps2dev, TP_Z_TIME, tp->ztime); 220 + trackpoint_write(&psmouse->ps2dev, TP_JENKS_CURV, tp->jenks); 221 + 222 + trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_PTSON, &toggle); 223 + if (((toggle & TP_MASK_PTSON) == TP_MASK_PTSON) != tp->press_to_select) 224 + trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_PTSON, TP_MASK_PTSON); 225 + 226 + trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK, &toggle); 227 + if (((toggle & TP_MASK_SKIPBACK) == TP_MASK_SKIPBACK) != tp->skipback) 228 + trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK); 229 + 230 + trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, &toggle); 231 + if (((toggle & TP_MASK_EXT_DEV) == TP_MASK_EXT_DEV) != tp->ext_dev) 232 + trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV); 233 + 234 + return 0; 235 + } 236 + 237 + static void trackpoint_defaults(struct trackpoint_data *tp) 238 + { 239 + tp->press_to_select = TP_DEF_PTSON; 240 + tp->sensitivity = TP_DEF_SENS; 241 + tp->speed = TP_DEF_SPEED; 242 + tp->reach = TP_DEF_REACH; 243 + 244 + tp->draghys = TP_DEF_DRAGHYS; 245 + tp->mindrag = TP_DEF_MINDRAG; 246 + 247 + tp->thresh = TP_DEF_THRESH; 248 + tp->upthresh = TP_DEF_UP_THRESH; 249 + 250 + tp->ztime = TP_DEF_Z_TIME; 251 + tp->jenks = TP_DEF_JENKS_CURV; 252 + 253 + tp->inertia = TP_DEF_INERTIA; 254 + tp->skipback = TP_DEF_SKIPBACK; 255 + tp->ext_dev = TP_DEF_EXT_DEV; 256 + } 257 + 258 + int trackpoint_detect(struct psmouse *psmouse, int set_properties) 259 + { 260 + struct trackpoint_data *priv; 261 + struct ps2dev *ps2dev = &psmouse->ps2dev; 262 + unsigned char firmware_id; 263 + unsigned char button_info; 264 + unsigned char param[2]; 265 + 266 + param[0] = param[1] = 0; 267 + 268 + if (ps2_command(ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) 269 + return -1; 270 + 271 + if (param[0] != TP_MAGIC_IDENT) 272 + return -1; 273 + 274 + if (!set_properties) 275 + return 0; 276 + 277 + firmware_id = param[1]; 278 + 279 + if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { 280 + printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); 281 + button_info = 0; 282 + } 283 + 284 + psmouse->private = priv = kcalloc(1, sizeof(struct trackpoint_data), GFP_KERNEL); 285 + if (!priv) 286 + return -1; 287 + 288 + psmouse->vendor = "IBM"; 289 + psmouse->name = "TrackPoint"; 290 + 291 + psmouse->reconnect = trackpoint_sync; 292 + psmouse->disconnect = trackpoint_disconnect; 293 + 294 + trackpoint_defaults(priv); 295 + trackpoint_sync(psmouse); 296 + 297 + sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); 298 + 299 + printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", 300 + firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f); 301 + 302 + return 0; 303 + } 304 +
+147
drivers/input/mouse/trackpoint.h
··· 1 + /* 2 + * IBM TrackPoint PS/2 mouse driver 3 + * 4 + * Stephen Evanchik <evanchsa@gmail.com> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License version 2 as published by 8 + * the Free Software Foundation. 9 + */ 10 + 11 + #ifndef _TRACKPOINT_H 12 + #define _TRACKPOINT_H 13 + 14 + /* 15 + * These constants are from the TrackPoint System 16 + * Engineering documentation Version 4 from IBM Watson 17 + * research: 18 + * http://wwwcssrv.almaden.ibm.com/trackpoint/download.html 19 + */ 20 + 21 + #define TP_COMMAND 0xE2 /* Commands start with this */ 22 + 23 + #define TP_READ_ID 0xE1 /* Sent for device identification */ 24 + #define TP_MAGIC_IDENT 0x01 /* Sent after a TP_READ_ID followed */ 25 + /* by the firmware ID */ 26 + 27 + 28 + /* 29 + * Commands 30 + */ 31 + #define TP_RECALIB 0x51 /* Recalibrate */ 32 + #define TP_POWER_DOWN 0x44 /* Can only be undone through HW reset */ 33 + #define TP_EXT_DEV 0x21 /* Determines if external device is connected (RO) */ 34 + #define TP_EXT_BTN 0x4B /* Read extended button status */ 35 + #define TP_POR 0x7F /* Execute Power on Reset */ 36 + #define TP_POR_RESULTS 0x25 /* Read Power on Self test results */ 37 + #define TP_DISABLE_EXT 0x40 /* Disable external pointing device */ 38 + #define TP_ENABLE_EXT 0x41 /* Enable external pointing device */ 39 + 40 + /* 41 + * Mode manipulation 42 + */ 43 + #define TP_SET_SOFT_TRANS 0x4E /* Set mode */ 44 + #define TP_CANCEL_SOFT_TRANS 0xB9 /* Cancel mode */ 45 + #define TP_SET_HARD_TRANS 0x45 /* Mode can only be set */ 46 + 47 + 48 + /* 49 + * Register oriented commands/properties 50 + */ 51 + #define TP_WRITE_MEM 0x81 52 + #define TP_READ_MEM 0x80 /* Not used in this implementation */ 53 + 54 + /* 55 + * RAM Locations for properties 56 + */ 57 + #define TP_SENS 0x4A /* Sensitivity */ 58 + #define TP_MB 0x4C /* Read Middle Button Status (RO) */ 59 + #define TP_INERTIA 0x4D /* Negative Inertia */ 60 + #define TP_SPEED 0x60 /* Speed of TP Cursor */ 61 + #define TP_REACH 0x57 /* Backup for Z-axis press */ 62 + #define TP_DRAGHYS 0x58 /* Drag Hysteresis */ 63 + /* (how hard it is to drag */ 64 + /* with Z-axis pressed) */ 65 + 66 + #define TP_MINDRAG 0x59 /* Minimum amount of force needed */ 67 + /* to trigger dragging */ 68 + 69 + #define TP_THRESH 0x5C /* Minimum value for a Z-axis press */ 70 + #define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */ 71 + #define TP_Z_TIME 0x5E /* How sharp of a press */ 72 + #define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */ 73 + 74 + /* 75 + * Toggling Flag bits 76 + */ 77 + #define TP_TOGGLE 0x47 /* Toggle command */ 78 + 79 + #define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */ 80 + #define TP_MASK_MB 0x01 81 + #define TP_TOGGLE_EXT_DEV 0x23 /* Toggle external device */ 82 + #define TP_MASK_EXT_DEV 0x02 83 + #define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */ 84 + #define TP_MASK_DRIFT 0x80 85 + #define TP_TOGGLE_BURST 0x28 /* Burst Mode */ 86 + #define TP_MASK_BURST 0x80 87 + #define TP_TOGGLE_PTSON 0x2C /* Press to Select */ 88 + #define TP_MASK_PTSON 0x01 89 + #define TP_TOGGLE_HARD_TRANS 0x2C /* Alternate method to set Hard Transparency */ 90 + #define TP_MASK_HARD_TRANS 0x80 91 + #define TP_TOGGLE_TWOHAND 0x2D /* Two handed */ 92 + #define TP_MASK_TWOHAND 0x01 93 + #define TP_TOGGLE_STICKY_TWO 0x2D /* Sticky two handed */ 94 + #define TP_MASK_STICKY_TWO 0x04 95 + #define TP_TOGGLE_SKIPBACK 0x2D /* Suppress movement after drag release */ 96 + #define TP_MASK_SKIPBACK 0x08 97 + #define TP_TOGGLE_SOURCE_TAG 0x20 /* Bit 3 of the first packet will be set to 98 + to the origin of the packet (external or TP) */ 99 + #define TP_MASK_SOURCE_TAG 0x80 100 + #define TP_TOGGLE_EXT_TAG 0x22 /* Bit 3 of the first packet coming from the 101 + external device will be forced to 1 */ 102 + #define TP_MASK_EXT_TAG 0x04 103 + 104 + 105 + /* Power on Self Test Results */ 106 + #define TP_POR_SUCCESS 0x3B 107 + 108 + /* 109 + * Default power on values 110 + */ 111 + #define TP_DEF_SENS 0x80 112 + #define TP_DEF_INERTIA 0x06 113 + #define TP_DEF_SPEED 0x61 114 + #define TP_DEF_REACH 0x0A 115 + 116 + #define TP_DEF_DRAGHYS 0xFF 117 + #define TP_DEF_MINDRAG 0x14 118 + 119 + #define TP_DEF_THRESH 0x08 120 + #define TP_DEF_UP_THRESH 0xFF 121 + #define TP_DEF_Z_TIME 0x26 122 + #define TP_DEF_JENKS_CURV 0x87 123 + 124 + /* Toggles */ 125 + #define TP_DEF_MB 0x00 126 + #define TP_DEF_PTSON 0x00 127 + #define TP_DEF_SKIPBACK 0x00 128 + #define TP_DEF_EXT_DEV 0x01 129 + 130 + #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) 131 + 132 + struct trackpoint_data 133 + { 134 + unsigned char sensitivity, speed, inertia, reach; 135 + unsigned char draghys, mindrag; 136 + unsigned char thresh, upthresh; 137 + unsigned char ztime, jenks; 138 + 139 + unsigned char press_to_select; 140 + unsigned char skipback; 141 + 142 + unsigned char ext_dev; 143 + }; 144 + 145 + extern int trackpoint_detect(struct psmouse *psmouse, int set_properties); 146 + 147 + #endif /* _TRACKPOINT_H */
+3 -3
drivers/input/serio/i8042-io.h
··· 69 69 */ 70 70 #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC64) 71 71 if (!request_region(I8042_DATA_REG, 16, "i8042")) 72 - return -1; 72 + return -EBUSY; 73 73 #endif 74 74 75 75 i8042_reset = 1; 76 76 77 77 #if defined(CONFIG_PPC64) 78 78 if (check_legacy_ioport(I8042_DATA_REG)) 79 - return -1; 79 + return -EBUSY; 80 80 if (!request_region(I8042_DATA_REG, 16, "i8042")) 81 - return -1; 81 + return -EBUSY; 82 82 #endif 83 83 return 0; 84 84 }
+1 -1
drivers/input/serio/i8042-ip22io.h
··· 58 58 #if 0 59 59 /* XXX sgi_kh is a virtual address */ 60 60 if (!request_mem_region(sgi_kh, sizeof(struct hpc_keyb), "i8042")) 61 - return 1; 61 + return -EBUSY; 62 62 #endif 63 63 64 64 i8042_reset = 1;
+1 -1
drivers/input/serio/i8042-jazzio.h
··· 53 53 #if 0 54 54 /* XXX JAZZ_KEYBOARD_ADDRESS is a virtual address */ 55 55 if (!request_mem_region(JAZZ_KEYBOARD_ADDRESS, 2, "i8042")) 56 - return 1; 56 + return -EBUSY; 57 57 #endif 58 58 59 59 return 0;
+6 -6
drivers/input/serio/i8042-sparcio.h
··· 48 48 #define OBP_PS2MS_NAME1 "kdmouse" 49 49 #define OBP_PS2MS_NAME2 "mouse" 50 50 51 - static int i8042_platform_init(void) 51 + static int __init i8042_platform_init(void) 52 52 { 53 53 #ifndef CONFIG_PCI 54 - return -1; 54 + return -ENODEV; 55 55 #else 56 56 char prop[128]; 57 57 int len; ··· 59 59 len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop)); 60 60 if (len < 0) { 61 61 printk("i8042: Cannot get name property of root OBP node.\n"); 62 - return -1; 62 + return -ENODEV; 63 63 } 64 64 if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) { 65 65 /* Hardcoded values for MrCoffee. */ 66 66 i8042_kbd_irq = i8042_aux_irq = 13 | 0x20; 67 67 kbd_iobase = ioremap(0x71300060, 8); 68 68 if (!kbd_iobase) 69 - return -1; 69 + return -ENODEV; 70 70 } else { 71 71 struct linux_ebus *ebus; 72 72 struct linux_ebus_device *edev; ··· 78 78 goto edev_found; 79 79 } 80 80 } 81 - return -1; 81 + return -ENODEV; 82 82 83 83 edev_found: 84 84 for_each_edevchild(edev, child) { ··· 96 96 i8042_aux_irq == -1) { 97 97 printk("i8042: Error, 8042 device lacks both kbd and " 98 98 "mouse nodes.\n"); 99 - return -1; 99 + return -ENODEV; 100 100 } 101 101 } 102 102
+47 -25
drivers/input/serio/i8042-x86ia64io.h
··· 138 138 }, 139 139 }, 140 140 { 141 + .ident = "Fujitsu-Siemens Lifebook E4010", 142 + .matches = { 143 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 144 + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"), 145 + }, 146 + }, 147 + { 141 148 .ident = "Toshiba P10", 142 149 .matches = { 143 150 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), ··· 263 256 } 264 257 } 265 258 266 - static int i8042_pnp_init(void) 259 + static int __init i8042_pnp_init(void) 267 260 { 268 - int result_kbd, result_aux; 261 + int result_kbd = 0, result_aux = 0; 262 + char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; 269 263 270 264 if (i8042_nopnp) { 271 265 printk(KERN_INFO "i8042: PNP detection disabled\n"); ··· 275 267 276 268 if ((result_kbd = pnp_register_driver(&i8042_pnp_kbd_driver)) >= 0) 277 269 i8042_pnp_kbd_registered = 1; 270 + 278 271 if ((result_aux = pnp_register_driver(&i8042_pnp_aux_driver)) >= 0) 279 272 i8042_pnp_aux_registered = 1; 280 273 ··· 288 279 return 0; 289 280 #endif 290 281 } 282 + 283 + if (result_kbd > 0) 284 + snprintf(kbd_irq_str, sizeof(kbd_irq_str), 285 + "%d", i8042_pnp_kbd_irq); 286 + if (result_aux > 0) 287 + snprintf(aux_irq_str, sizeof(aux_irq_str), 288 + "%d", i8042_pnp_aux_irq); 289 + 290 + printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n", 291 + i8042_pnp_kbd_name, (result_kbd > 0 && result_aux > 0) ? "," : "", 292 + i8042_pnp_aux_name, 293 + i8042_pnp_data_reg, i8042_pnp_command_reg, 294 + kbd_irq_str, (result_kbd > 0 && result_aux > 0) ? "," : "", 295 + aux_irq_str); 296 + 297 + #if defined(__ia64__) 298 + if (result_kbd <= 0) 299 + i8042_nokbd = 1; 300 + if (result_aux <= 0) 301 + i8042_noaux = 1; 302 + #endif 291 303 292 304 if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) && 293 305 i8042_pnp_data_reg != i8042_data_reg) || !i8042_pnp_data_reg) { ··· 324 294 i8042_pnp_command_reg = i8042_command_reg; 325 295 } 326 296 327 - if (!i8042_pnp_kbd_irq) { 328 - printk(KERN_WARNING "PNP: PS/2 controller doesn't have KBD irq; using default %#x\n", i8042_kbd_irq); 297 + if (!i8042_nokbd && !i8042_pnp_kbd_irq) { 298 + printk(KERN_WARNING "PNP: PS/2 controller doesn't have KBD irq; using default %d\n", i8042_kbd_irq); 329 299 i8042_pnp_kbd_irq = i8042_kbd_irq; 330 300 } 331 301 332 - if (!i8042_pnp_aux_irq) { 333 - printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %#x\n", i8042_aux_irq); 302 + if (!i8042_noaux && !i8042_pnp_aux_irq) { 303 + printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %d\n", i8042_aux_irq); 334 304 i8042_pnp_aux_irq = i8042_aux_irq; 335 305 } 336 - 337 - #if defined(__ia64__) 338 - if (result_aux <= 0) 339 - i8042_noaux = 1; 340 - #endif 341 306 342 307 i8042_data_reg = i8042_pnp_data_reg; 343 308 i8042_command_reg = i8042_pnp_command_reg; 344 309 i8042_kbd_irq = i8042_pnp_kbd_irq; 345 310 i8042_aux_irq = i8042_pnp_aux_irq; 346 311 347 - printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %d%s%d\n", 348 - i8042_pnp_kbd_name, (result_kbd > 0 && result_aux > 0) ? "," : "", i8042_pnp_aux_name, 349 - i8042_data_reg, i8042_command_reg, i8042_kbd_irq, 350 - (result_aux > 0) ? "," : "", i8042_aux_irq); 351 - 352 312 return 0; 353 313 } 354 314 315 + #else 316 + static inline int i8042_pnp_init(void) { return 0; } 317 + static inline void i8042_pnp_exit(void) { } 355 318 #endif 356 319 357 - static inline int i8042_platform_init(void) 320 + static int __init i8042_platform_init(void) 358 321 { 322 + int retval; 323 + 359 324 /* 360 325 * On ix86 platforms touching the i8042 data register region can do really 361 326 * bad things. Because of this the region is always reserved on ix86 boxes. 362 327 * 363 328 * if (!request_region(I8042_DATA_REG, 16, "i8042")) 364 - * return -1; 329 + * return -EBUSY; 365 330 */ 366 331 367 332 i8042_kbd_irq = I8042_MAP_IRQ(1); 368 333 i8042_aux_irq = I8042_MAP_IRQ(12); 369 334 370 - #ifdef CONFIG_PNP 371 - if (i8042_pnp_init()) 372 - return -1; 373 - #endif 335 + retval = i8042_pnp_init(); 336 + if (retval) 337 + return retval; 374 338 375 339 #if defined(__ia64__) 376 340 i8042_reset = 1; ··· 378 354 i8042_nomux = 1; 379 355 #endif 380 356 381 - return 0; 357 + return retval; 382 358 } 383 359 384 360 static inline void i8042_platform_exit(void) 385 361 { 386 - #ifdef CONFIG_PNP 387 362 i8042_pnp_exit(); 388 - #endif 389 363 } 390 364 391 365 #endif /* _I8042_X86IA64IO_H */
+115 -78
drivers/input/serio/i8042.c
··· 27 27 MODULE_DESCRIPTION("i8042 keyboard and mouse controller driver"); 28 28 MODULE_LICENSE("GPL"); 29 29 30 + static unsigned int i8042_nokbd; 31 + module_param_named(nokbd, i8042_nokbd, bool, 0); 32 + MODULE_PARM_DESC(nokbd, "Do not probe or use KBD port."); 33 + 30 34 static unsigned int i8042_noaux; 31 35 module_param_named(noaux, i8042_noaux, bool, 0); 32 36 MODULE_PARM_DESC(noaux, "Do not probe or use AUX (mouse) port."); ··· 342 338 343 339 return 0; 344 340 345 - activate_fail: 341 + activate_fail: 346 342 free_irq(port->irq, i8042_request_irq_cookie); 347 343 348 - irq_fail: 344 + irq_fail: 349 345 serio_unregister_port_delayed(serio); 350 346 351 347 return -1; ··· 489 485 serio_interrupt(port->serio, data, dfl, regs); 490 486 491 487 ret = 1; 492 - out: 488 + out: 493 489 return IRQ_RETVAL(ret); 494 490 } 495 491 ··· 556 552 * Enable all muxed ports. 557 553 */ 558 554 559 - for (i = 0; i < 4; i++) { 555 + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) { 560 556 i8042_command(&param, I8042_CMD_MUX_PFX + i); 561 557 i8042_command(&param, I8042_CMD_AUX_ENABLE); 562 558 } ··· 686 682 kfree(port->serio); 687 683 port->serio = NULL; 688 684 i8042_ctr |= port->disable; 689 - return -1; 685 + return -EIO; 690 686 } 691 687 692 688 printk(KERN_INFO "serio: i8042 %s port at %#lx,%#lx irq %d\n", ··· 981 977 .shutdown = i8042_shutdown, 982 978 }; 983 979 984 - static void __init i8042_create_kbd_port(void) 980 + static int __init i8042_create_kbd_port(void) 985 981 { 986 982 struct serio *serio; 987 983 struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; 988 984 989 - serio = kmalloc(sizeof(struct serio), GFP_KERNEL); 990 - if (serio) { 991 - memset(serio, 0, sizeof(struct serio)); 992 - serio->id.type = i8042_direct ? SERIO_8042 : SERIO_8042_XL; 993 - serio->write = i8042_dumbkbd ? NULL : i8042_kbd_write; 994 - serio->open = i8042_open; 995 - serio->close = i8042_close; 996 - serio->start = i8042_start; 997 - serio->stop = i8042_stop; 998 - serio->port_data = port; 999 - serio->dev.parent = &i8042_platform_device->dev; 1000 - strlcpy(serio->name, "i8042 Kbd Port", sizeof(serio->name)); 1001 - strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys)); 985 + serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 986 + if (!serio) 987 + return -ENOMEM; 1002 988 1003 - port->serio = serio; 1004 - i8042_port_register(port); 1005 - } 989 + serio->id.type = i8042_direct ? SERIO_8042 : SERIO_8042_XL; 990 + serio->write = i8042_dumbkbd ? NULL : i8042_kbd_write; 991 + serio->open = i8042_open; 992 + serio->close = i8042_close; 993 + serio->start = i8042_start; 994 + serio->stop = i8042_stop; 995 + serio->port_data = port; 996 + serio->dev.parent = &i8042_platform_device->dev; 997 + strlcpy(serio->name, "i8042 Kbd Port", sizeof(serio->name)); 998 + strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys)); 999 + 1000 + port->serio = serio; 1001 + 1002 + return i8042_port_register(port); 1006 1003 } 1007 1004 1008 - static void __init i8042_create_aux_port(void) 1005 + static int __init i8042_create_aux_port(void) 1009 1006 { 1010 1007 struct serio *serio; 1011 1008 struct i8042_port *port = &i8042_ports[I8042_AUX_PORT_NO]; 1012 1009 1013 - serio = kmalloc(sizeof(struct serio), GFP_KERNEL); 1014 - if (serio) { 1015 - memset(serio, 0, sizeof(struct serio)); 1016 - serio->id.type = SERIO_8042; 1017 - serio->write = i8042_aux_write; 1018 - serio->open = i8042_open; 1019 - serio->close = i8042_close; 1020 - serio->start = i8042_start; 1021 - serio->stop = i8042_stop; 1022 - serio->port_data = port; 1023 - serio->dev.parent = &i8042_platform_device->dev; 1024 - strlcpy(serio->name, "i8042 Aux Port", sizeof(serio->name)); 1025 - strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys)); 1010 + serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 1011 + if (!serio) 1012 + return -ENOMEM; 1026 1013 1027 - port->serio = serio; 1028 - i8042_port_register(port); 1029 - } 1014 + serio->id.type = SERIO_8042; 1015 + serio->write = i8042_aux_write; 1016 + serio->open = i8042_open; 1017 + serio->close = i8042_close; 1018 + serio->start = i8042_start; 1019 + serio->stop = i8042_stop; 1020 + serio->port_data = port; 1021 + serio->dev.parent = &i8042_platform_device->dev; 1022 + strlcpy(serio->name, "i8042 Aux Port", sizeof(serio->name)); 1023 + strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys)); 1024 + 1025 + port->serio = serio; 1026 + 1027 + return i8042_port_register(port); 1030 1028 } 1031 1029 1032 - static void __init i8042_create_mux_port(int index) 1030 + static int __init i8042_create_mux_port(int index) 1033 1031 { 1034 1032 struct serio *serio; 1035 1033 struct i8042_port *port = &i8042_ports[I8042_MUX_PORT_NO + index]; 1036 1034 1037 - serio = kmalloc(sizeof(struct serio), GFP_KERNEL); 1038 - if (serio) { 1039 - memset(serio, 0, sizeof(struct serio)); 1040 - serio->id.type = SERIO_8042; 1041 - serio->write = i8042_aux_write; 1042 - serio->open = i8042_open; 1043 - serio->close = i8042_close; 1044 - serio->start = i8042_start; 1045 - serio->stop = i8042_stop; 1046 - serio->port_data = port; 1047 - serio->dev.parent = &i8042_platform_device->dev; 1048 - snprintf(serio->name, sizeof(serio->name), "i8042 Aux-%d Port", index); 1049 - snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, index + 1); 1035 + serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 1036 + if (!serio) 1037 + return -ENOMEM; 1050 1038 1051 - *port = i8042_ports[I8042_AUX_PORT_NO]; 1052 - port->exists = 0; 1053 - snprintf(port->name, sizeof(port->name), "AUX%d", index); 1054 - port->mux = index; 1055 - port->serio = serio; 1056 - i8042_port_register(port); 1057 - } 1039 + serio->id.type = SERIO_8042; 1040 + serio->write = i8042_aux_write; 1041 + serio->open = i8042_open; 1042 + serio->close = i8042_close; 1043 + serio->start = i8042_start; 1044 + serio->stop = i8042_stop; 1045 + serio->port_data = port; 1046 + serio->dev.parent = &i8042_platform_device->dev; 1047 + snprintf(serio->name, sizeof(serio->name), "i8042 Aux-%d Port", index); 1048 + snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, index + 1); 1049 + 1050 + *port = i8042_ports[I8042_AUX_PORT_NO]; 1051 + port->exists = 0; 1052 + snprintf(port->name, sizeof(port->name), "AUX%d", index); 1053 + port->mux = index; 1054 + port->serio = serio; 1055 + 1056 + return i8042_port_register(port); 1058 1057 } 1059 1058 1060 1059 static int __init i8042_init(void) 1061 1060 { 1062 - int i; 1061 + int i, have_ports = 0; 1063 1062 int err; 1064 1063 1065 1064 dbg_init(); ··· 1070 1063 init_timer(&i8042_timer); 1071 1064 i8042_timer.function = i8042_timer_func; 1072 1065 1073 - if (i8042_platform_init()) 1074 - return -EBUSY; 1066 + err = i8042_platform_init(); 1067 + if (err) 1068 + return err; 1075 1069 1076 1070 i8042_ports[I8042_AUX_PORT_NO].irq = I8042_AUX_IRQ; 1077 1071 i8042_ports[I8042_KBD_PORT_NO].irq = I8042_KBD_IRQ; 1078 1072 1079 1073 if (i8042_controller_init()) { 1080 - i8042_platform_exit(); 1081 - return -ENODEV; 1074 + err = -ENODEV; 1075 + goto err_platform_exit; 1082 1076 } 1083 1077 1084 1078 err = driver_register(&i8042_driver); 1085 - if (err) { 1086 - i8042_platform_exit(); 1087 - return err; 1088 - } 1079 + if (err) 1080 + goto err_controller_cleanup; 1089 1081 1090 1082 i8042_platform_device = platform_device_register_simple("i8042", -1, NULL, 0); 1091 1083 if (IS_ERR(i8042_platform_device)) { 1092 - driver_unregister(&i8042_driver); 1093 - i8042_platform_exit(); 1094 - return PTR_ERR(i8042_platform_device); 1084 + err = PTR_ERR(i8042_platform_device); 1085 + goto err_unregister_driver; 1095 1086 } 1096 1087 1097 1088 if (!i8042_noaux && !i8042_check_aux()) { 1098 - if (!i8042_nomux && !i8042_check_mux()) 1099 - for (i = 0; i < I8042_NUM_MUX_PORTS; i++) 1100 - i8042_create_mux_port(i); 1101 - else 1102 - i8042_create_aux_port(); 1089 + if (!i8042_nomux && !i8042_check_mux()) { 1090 + for (i = 0; i < I8042_NUM_MUX_PORTS; i++) { 1091 + err = i8042_create_mux_port(i); 1092 + if (err) 1093 + goto err_unregister_ports; 1094 + } 1095 + } else { 1096 + err = i8042_create_aux_port(); 1097 + if (err) 1098 + goto err_unregister_ports; 1099 + } 1100 + have_ports = 1; 1103 1101 } 1104 1102 1105 - i8042_create_kbd_port(); 1103 + if (!i8042_nokbd) { 1104 + err = i8042_create_kbd_port(); 1105 + if (err) 1106 + goto err_unregister_ports; 1107 + have_ports = 1; 1108 + } 1109 + 1110 + if (!have_ports) { 1111 + err = -ENODEV; 1112 + goto err_unregister_device; 1113 + } 1106 1114 1107 1115 mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD); 1108 1116 1109 1117 return 0; 1118 + 1119 + err_unregister_ports: 1120 + for (i = 0; i < I8042_NUM_PORTS; i++) 1121 + if (i8042_ports[i].serio) 1122 + serio_unregister_port(i8042_ports[i].serio); 1123 + err_unregister_device: 1124 + platform_device_unregister(i8042_platform_device); 1125 + err_unregister_driver: 1126 + driver_unregister(&i8042_driver); 1127 + err_controller_cleanup: 1128 + i8042_controller_cleanup(); 1129 + err_platform_exit: 1130 + i8042_platform_exit(); 1131 + 1132 + return err; 1110 1133 } 1111 1134 1112 1135 static void __exit i8042_exit(void)
+55 -21
drivers/usb/input/hid-core.c
··· 2 2 * USB HID support for Linux 3 3 * 4 4 * Copyright (c) 1999 Andreas Gal 5 - * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@suse.cz> 5 + * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 6 + * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 6 7 */ 7 8 8 9 /* ··· 39 38 * Version Information 40 39 */ 41 40 42 - #define DRIVER_VERSION "v2.01" 41 + #define DRIVER_VERSION "v2.6" 43 42 #define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik" 44 43 #define DRIVER_DESC "USB HID core driver" 45 44 #define DRIVER_LICENSE "GPL" ··· 1059 1058 if (maxpacket > 0) { 1060 1059 padlen = (len + maxpacket - 1) / maxpacket; 1061 1060 padlen *= maxpacket; 1062 - if (padlen > HID_BUFFER_SIZE) 1063 - padlen = HID_BUFFER_SIZE; 1061 + if (padlen > hid->bufsize) 1062 + padlen = hid->bufsize; 1064 1063 } else 1065 1064 padlen = 0; 1066 1065 hid->urbctrl->transfer_buffer_length = padlen; ··· 1097 1096 1098 1097 switch (urb->status) { 1099 1098 case 0: /* success */ 1099 + break; 1100 1100 case -ESHUTDOWN: /* unplug */ 1101 1101 case -EILSEQ: /* unplug timeout on uhci */ 1102 1102 unplug = 1; ··· 1145 1143 case 0: /* success */ 1146 1144 if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) 1147 1145 hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, 0, regs); 1146 + break; 1148 1147 case -ESHUTDOWN: /* unplug */ 1149 1148 case -EILSEQ: /* unplug timectrl on uhci */ 1150 1149 unplug = 1; ··· 1287 1284 struct hid_report *report; 1288 1285 int err, ret; 1289 1286 1290 - list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) { 1291 - int size = ((report->size - 1) >> 3) + 1 + hid->report_enum[HID_INPUT_REPORT].numbered; 1292 - if (size > HID_BUFFER_SIZE) size = HID_BUFFER_SIZE; 1293 - if (size > hid->urbin->transfer_buffer_length) 1294 - hid->urbin->transfer_buffer_length = size; 1287 + list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) 1295 1288 hid_submit_report(hid, report, USB_DIR_IN); 1296 - } 1297 1289 1298 1290 list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list) 1299 1291 hid_submit_report(hid, report, USB_DIR_IN); ··· 1370 1372 #define USB_VENDOR_ID_A4TECH 0x09da 1371 1373 #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 1372 1374 1373 - #define USB_VENDOR_ID_AASHIMA 0x06D6 1375 + #define USB_VENDOR_ID_AASHIMA 0x06d6 1374 1376 #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 1377 + #define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026 1375 1378 1376 1379 #define USB_VENDOR_ID_CYPRESS 0x04b4 1377 1380 #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 1378 1381 #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 1382 + #define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE 0x7417 1379 1383 1380 1384 #define USB_VENDOR_ID_BERKSHIRE 0x0c98 1381 1385 #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 ··· 1432 1432 #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 1433 1433 1434 1434 #define USB_VENDOR_ID_LD 0x0f11 1435 - #define USB_DEVICE_ID_CASSY 0x1000 1435 + #define USB_DEVICE_ID_CASSY 0x1000 1436 1436 #define USB_DEVICE_ID_POCKETCASSY 0x1010 1437 1437 #define USB_DEVICE_ID_MOBILECASSY 0x1020 1438 1438 #define USB_DEVICE_ID_JWM 0x1080 ··· 1445 1445 #define USB_DEVICE_ID_POWERCONTROL 0x2030 1446 1446 1447 1447 #define USB_VENDOR_ID_APPLE 0x05ac 1448 - #define USB_DEVICE_ID_APPLE_BLUETOOTH 0x1000 1448 + #define USB_DEVICE_ID_APPLE_POWERMOUSE 0x0304 1449 + #define USB_DEVICE_ID_APPLE_BLUETOOTH 0x1000 1449 1450 1450 1451 /* 1451 1452 * Alphabetically sorted blacklist by quirk type. ··· 1472 1471 { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW48, HID_QUIRK_IGNORE }, 1473 1472 { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW28, HID_QUIRK_IGNORE }, 1474 1473 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE }, 1474 + { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE, HID_QUIRK_IGNORE }, 1475 1475 { USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE, HID_QUIRK_IGNORE }, 1476 1476 { USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20, HID_QUIRK_IGNORE }, 1477 1477 { USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5, HID_QUIRK_IGNORE }, ··· 1553 1551 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, 1554 1552 { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, 1555 1553 1554 + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE }, 1556 1555 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, 1557 1556 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, 1558 1557 1559 1558 { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, 1559 + { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, 1560 1560 { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, 1561 1561 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, 1562 1562 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, ··· 1571 1567 { 0, 0 } 1572 1568 }; 1573 1569 1570 + /* 1571 + * Traverse the supplied list of reports and find the longest 1572 + */ 1573 + static void hid_find_max_report(struct hid_device *hid, unsigned int type, int *max) 1574 + { 1575 + struct hid_report *report; 1576 + int size; 1577 + 1578 + list_for_each_entry(report, &hid->report_enum[type].report_list, list) { 1579 + size = ((report->size - 1) >> 3) + 1; 1580 + if (type == HID_INPUT_REPORT && hid->report_enum[type].numbered) 1581 + size++; 1582 + if (*max < size) 1583 + *max = size; 1584 + } 1585 + } 1586 + 1574 1587 static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid) 1575 1588 { 1576 - if (!(hid->inbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE, SLAB_ATOMIC, &hid->inbuf_dma))) 1589 + if (!(hid->inbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->inbuf_dma))) 1577 1590 return -1; 1578 - if (!(hid->outbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE, SLAB_ATOMIC, &hid->outbuf_dma))) 1591 + if (!(hid->outbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->outbuf_dma))) 1579 1592 return -1; 1580 1593 if (!(hid->cr = usb_buffer_alloc(dev, sizeof(*(hid->cr)), SLAB_ATOMIC, &hid->cr_dma))) 1581 1594 return -1; 1582 - if (!(hid->ctrlbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE, SLAB_ATOMIC, &hid->ctrlbuf_dma))) 1595 + if (!(hid->ctrlbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->ctrlbuf_dma))) 1583 1596 return -1; 1584 1597 1585 1598 return 0; ··· 1605 1584 static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid) 1606 1585 { 1607 1586 if (hid->inbuf) 1608 - usb_buffer_free(dev, HID_BUFFER_SIZE, hid->inbuf, hid->inbuf_dma); 1587 + usb_buffer_free(dev, hid->bufsize, hid->inbuf, hid->inbuf_dma); 1609 1588 if (hid->outbuf) 1610 - usb_buffer_free(dev, HID_BUFFER_SIZE, hid->outbuf, hid->outbuf_dma); 1589 + usb_buffer_free(dev, hid->bufsize, hid->outbuf, hid->outbuf_dma); 1611 1590 if (hid->cr) 1612 1591 usb_buffer_free(dev, sizeof(*(hid->cr)), hid->cr, hid->cr_dma); 1613 1592 if (hid->ctrlbuf) 1614 - usb_buffer_free(dev, HID_BUFFER_SIZE, hid->ctrlbuf, hid->ctrlbuf_dma); 1593 + usb_buffer_free(dev, hid->bufsize, hid->ctrlbuf, hid->ctrlbuf_dma); 1615 1594 } 1616 1595 1617 1596 static struct hid_device *usb_hid_configure(struct usb_interface *intf) ··· 1622 1601 struct hid_device *hid; 1623 1602 unsigned quirks = 0, rsize = 0; 1624 1603 char *buf, *rdesc; 1625 - int n; 1604 + int n, insize = 0; 1626 1605 1627 1606 for (n = 0; hid_blacklist[n].idVendor; n++) 1628 1607 if ((hid_blacklist[n].idVendor == le16_to_cpu(dev->descriptor.idVendor)) && ··· 1676 1655 kfree(rdesc); 1677 1656 hid->quirks = quirks; 1678 1657 1658 + hid->bufsize = HID_MIN_BUFFER_SIZE; 1659 + hid_find_max_report(hid, HID_INPUT_REPORT, &hid->bufsize); 1660 + hid_find_max_report(hid, HID_OUTPUT_REPORT, &hid->bufsize); 1661 + hid_find_max_report(hid, HID_FEATURE_REPORT, &hid->bufsize); 1662 + 1663 + if (hid->bufsize > HID_MAX_BUFFER_SIZE) 1664 + hid->bufsize = HID_MAX_BUFFER_SIZE; 1665 + 1666 + hid_find_max_report(hid, HID_INPUT_REPORT, &insize); 1667 + 1668 + if (insize > HID_MAX_BUFFER_SIZE) 1669 + insize = HID_MAX_BUFFER_SIZE; 1670 + 1679 1671 if (hid_alloc_buffers(dev, hid)) { 1680 1672 hid_free_buffers(dev, hid); 1681 1673 goto fail; ··· 1719 1685 if (!(hid->urbin = usb_alloc_urb(0, GFP_KERNEL))) 1720 1686 goto fail; 1721 1687 pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); 1722 - usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, 0, 1688 + usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, insize, 1723 1689 hid_irq_in, hid, interval); 1724 1690 hid->urbin->transfer_dma = hid->inbuf_dma; 1725 1691 hid->urbin->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+28 -6
drivers/usb/input/hid-debug.h
··· 85 85 {0, 0x91, "D-PadDown"}, 86 86 {0, 0x92, "D-PadRight"}, 87 87 {0, 0x93, "D-PadLeft"}, 88 + { 2, 0, "Simulation" }, 89 + {0, 0xb0, "Aileron"}, 90 + {0, 0xb1, "AileronTrim"}, 91 + {0, 0xb2, "Anti-Torque"}, 92 + {0, 0xb3, "Autopilot"}, 93 + {0, 0xb4, "Chaff"}, 94 + {0, 0xb5, "Collective"}, 95 + {0, 0xb6, "DiveBrake"}, 96 + {0, 0xb7, "ElectronicCountermeasures"}, 97 + {0, 0xb8, "Elevator"}, 98 + {0, 0xb9, "ElevatorTrim"}, 99 + {0, 0xba, "Rudder"}, 100 + {0, 0xbb, "Throttle"}, 101 + {0, 0xbc, "FlightCommunications"}, 102 + {0, 0xbd, "FlareRelease"}, 103 + {0, 0xbe, "LandingGear"}, 104 + {0, 0xbf, "ToeBrake"}, 88 105 { 7, 0, "Keyboard" }, 89 106 { 8, 0, "LED" }, 90 107 {0, 0x01, "NumLock"}, ··· 109 92 {0, 0x03, "ScrollLock"}, 110 93 {0, 0x04, "Compose"}, 111 94 {0, 0x05, "Kana"}, 95 + {0, 0x4b, "GenericIndicator"}, 112 96 { 9, 0, "Button" }, 113 97 { 10, 0, "Ordinal" }, 114 98 { 12, 0, "Consumer" }, ··· 592 574 [KEY_EXIT] = "Exit", [KEY_MOVE] = "Move", 593 575 [KEY_EDIT] = "Edit", [KEY_SCROLLUP] = "ScrollUp", 594 576 [KEY_SCROLLDOWN] = "ScrollDown", [KEY_KPLEFTPAREN] = "KPLeftParenthesis", 595 - [KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_F13] = "F13", 577 + [KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_NEW] = "New", 578 + [KEY_REDO] = "Redo", [KEY_F13] = "F13", 596 579 [KEY_F14] = "F14", [KEY_F15] = "F15", 597 580 [KEY_F16] = "F16", [KEY_F17] = "F17", 598 581 [KEY_F18] = "F18", [KEY_F19] = "F19", ··· 603 584 [KEY_PAUSECD] = "PauseCD", [KEY_PROG3] = "Prog3", 604 585 [KEY_PROG4] = "Prog4", [KEY_SUSPEND] = "Suspend", 605 586 [KEY_CLOSE] = "Close", [KEY_PLAY] = "Play", 606 - [KEY_FASTFORWARD] = "Fast Forward", [KEY_BASSBOOST] = "Bass Boost", 587 + [KEY_FASTFORWARD] = "FastForward", [KEY_BASSBOOST] = "BassBoost", 607 588 [KEY_PRINT] = "Print", [KEY_HP] = "HP", 608 589 [KEY_CAMERA] = "Camera", [KEY_SOUND] = "Sound", 609 590 [KEY_QUESTION] = "Question", [KEY_EMAIL] = "Email", 610 591 [KEY_CHAT] = "Chat", [KEY_SEARCH] = "Search", 611 592 [KEY_CONNECT] = "Connect", [KEY_FINANCE] = "Finance", 612 593 [KEY_SPORT] = "Sport", [KEY_SHOP] = "Shop", 613 - [KEY_ALTERASE] = "Alternate Erase", [KEY_CANCEL] = "Cancel", 614 - [KEY_BRIGHTNESSDOWN] = "Brightness down", [KEY_BRIGHTNESSUP] = "Brightness up", 594 + [KEY_ALTERASE] = "AlternateErase", [KEY_CANCEL] = "Cancel", 595 + [KEY_BRIGHTNESSDOWN] = "BrightnessDown", [KEY_BRIGHTNESSUP] = "BrightnessUp", 615 596 [KEY_MEDIA] = "Media", [KEY_UNKNOWN] = "Unknown", 616 597 [BTN_0] = "Btn0", [BTN_1] = "Btn1", 617 598 [BTN_2] = "Btn2", [BTN_3] = "Btn3", ··· 641 622 [BTN_TOOL_AIRBRUSH] = "ToolAirbrush", [BTN_TOOL_FINGER] = "ToolFinger", 642 623 [BTN_TOOL_MOUSE] = "ToolMouse", [BTN_TOOL_LENS] = "ToolLens", 643 624 [BTN_TOUCH] = "Touch", [BTN_STYLUS] = "Stylus", 644 - [BTN_STYLUS2] = "Stylus2", [BTN_TOOL_DOUBLETAP] = "Tool Doubletap", 645 - [BTN_TOOL_TRIPLETAP] = "Tool Tripletap", [BTN_GEAR_DOWN] = "WheelBtn", 625 + [BTN_STYLUS2] = "Stylus2", [BTN_TOOL_DOUBLETAP] = "ToolDoubleTap", 626 + [BTN_TOOL_TRIPLETAP] = "ToolTripleTap", [BTN_GEAR_DOWN] = "WheelBtn", 646 627 [BTN_GEAR_UP] = "Gear up", [KEY_OK] = "Ok", 647 628 [KEY_SELECT] = "Select", [KEY_GOTO] = "Goto", 648 629 [KEY_CLEAR] = "Clear", [KEY_POWER2] = "Power2", ··· 678 659 [KEY_TWEN] = "TWEN", [KEY_DEL_EOL] = "DeleteEOL", 679 660 [KEY_DEL_EOS] = "DeleteEOS", [KEY_INS_LINE] = "InsertLine", 680 661 [KEY_DEL_LINE] = "DeleteLine", 662 + [KEY_SEND] = "Send", [KEY_REPLY] = "Reply", 663 + [KEY_FORWARDMAIL] = "ForwardMail", [KEY_SAVE] = "Save", 664 + [KEY_DOCUMENTS] = "Documents", 681 665 }; 682 666 683 667 static char *relatives[REL_MAX + 1] = {
+62 -4
drivers/usb/input/hid-input.c
··· 78 78 { 79 79 struct input_dev *input = &hidinput->input; 80 80 struct hid_device *device = hidinput->input.private; 81 - int max, code; 82 - unsigned long *bit; 81 + int max = 0, code; 82 + unsigned long *bit = NULL; 83 83 84 84 field->hidinput = hidinput; 85 85 ··· 129 129 } 130 130 131 131 map_key(code); 132 + break; 133 + 134 + 135 + case HID_UP_SIMULATION: 136 + 137 + switch (usage->hid & 0xffff) { 138 + case 0xba: map_abs(ABS_RUDDER); break; 139 + case 0xbb: map_abs(ABS_THROTTLE); break; 140 + } 132 141 break; 133 142 134 143 case HID_UP_GENDESK: ··· 247 238 case 0x000: goto ignore; 248 239 case 0x034: map_key_clear(KEY_SLEEP); break; 249 240 case 0x036: map_key_clear(BTN_MISC); break; 241 + case 0x045: map_key_clear(KEY_RADIO); break; 250 242 case 0x08a: map_key_clear(KEY_WWW); break; 243 + case 0x08d: map_key_clear(KEY_PROGRAM); break; 251 244 case 0x095: map_key_clear(KEY_HELP); break; 245 + case 0x09c: map_key_clear(KEY_CHANNELUP); break; 246 + case 0x09d: map_key_clear(KEY_CHANNELDOWN); break; 252 247 case 0x0b0: map_key_clear(KEY_PLAY); break; 253 248 case 0x0b1: map_key_clear(KEY_PAUSE); break; 254 249 case 0x0b2: map_key_clear(KEY_RECORD); break; ··· 272 259 case 0x18a: map_key_clear(KEY_MAIL); break; 273 260 case 0x192: map_key_clear(KEY_CALC); break; 274 261 case 0x194: map_key_clear(KEY_FILE); break; 262 + case 0x1a7: map_key_clear(KEY_DOCUMENTS); break; 263 + case 0x201: map_key_clear(KEY_NEW); break; 264 + case 0x207: map_key_clear(KEY_SAVE); break; 265 + case 0x208: map_key_clear(KEY_PRINT); break; 266 + case 0x209: map_key_clear(KEY_PROPS); break; 275 267 case 0x21a: map_key_clear(KEY_UNDO); break; 276 268 case 0x21b: map_key_clear(KEY_COPY); break; 277 269 case 0x21c: map_key_clear(KEY_CUT); break; ··· 289 271 case 0x227: map_key_clear(KEY_REFRESH); break; 290 272 case 0x22a: map_key_clear(KEY_BOOKMARKS); break; 291 273 case 0x238: map_rel(REL_HWHEEL); break; 292 - default: goto unknown; 274 + case 0x279: map_key_clear(KEY_REDO); break; 275 + case 0x289: map_key_clear(KEY_REPLY); break; 276 + case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; 277 + case 0x28c: map_key_clear(KEY_SEND); break; 278 + default: goto ignore; 293 279 } 294 280 break; 295 281 ··· 318 296 break; 319 297 320 298 case HID_UP_MSVENDOR: 321 - 322 299 goto ignore; 300 + 301 + case HID_UP_CUSTOM: /* Reported on Logitech and Powerbook USB keyboards */ 302 + 303 + set_bit(EV_REP, input->evbit); 304 + switch(usage->hid & HID_USAGE) { 305 + case 0x003: map_key_clear(KEY_FN); break; 306 + default: goto ignore; 307 + } 308 + break; 309 + 310 + case HID_UP_LOGIVENDOR: /* Reported on Logitech Ultra X Media Remote */ 311 + 312 + set_bit(EV_REP, input->evbit); 313 + switch(usage->hid & HID_USAGE) { 314 + case 0x004: map_key_clear(KEY_AGAIN); break; 315 + case 0x00d: map_key_clear(KEY_HOME); break; 316 + case 0x024: map_key_clear(KEY_SHUFFLE); break; 317 + case 0x025: map_key_clear(KEY_TV); break; 318 + case 0x026: map_key_clear(KEY_MENU); break; 319 + case 0x031: map_key_clear(KEY_AUDIO); break; 320 + case 0x032: map_key_clear(KEY_SUBTITLE); break; 321 + case 0x033: map_key_clear(KEY_LAST); break; 322 + case 0x047: map_key_clear(KEY_MP3); break; 323 + case 0x048: map_key_clear(KEY_DVD); break; 324 + case 0x049: map_key_clear(KEY_MEDIA); break; 325 + case 0x04a: map_key_clear(KEY_VIDEO); break; 326 + case 0x04b: map_key_clear(KEY_ANGLE); break; 327 + case 0x04c: map_key_clear(KEY_LANGUAGE); break; 328 + case 0x04d: map_key_clear(KEY_SUBTITLE); break; 329 + case 0x051: map_key_clear(KEY_RED); break; 330 + case 0x052: map_key_clear(KEY_CLOSE); break; 331 + default: goto ignore; 332 + } 333 + break; 323 334 324 335 case HID_UP_PID: 325 336 ··· 403 348 404 349 if (usage->code > max) 405 350 goto ignore; 351 + 352 + if (((device->quirks & (HID_QUIRK_2WHEEL_POWERMOUSE)) && (usage->hid == 0x00010032))) 353 + map_rel(REL_HWHEEL); 406 354 407 355 if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) && 408 356 (usage->type == EV_REL) && (usage->code == REL_WHEEL))
+8 -1
drivers/usb/input/hid.h
··· 173 173 174 174 #define HID_UP_UNDEFINED 0x00000000 175 175 #define HID_UP_GENDESK 0x00010000 176 + #define HID_UP_SIMULATION 0x00020000 176 177 #define HID_UP_KEYBOARD 0x00070000 177 178 #define HID_UP_LED 0x00080000 178 179 #define HID_UP_BUTTON 0x00090000 ··· 183 182 #define HID_UP_PID 0x000f0000 184 183 #define HID_UP_HPVENDOR 0xff7f0000 185 184 #define HID_UP_MSVENDOR 0xff000000 185 + #define HID_UP_CUSTOM 0x00ff0000 186 + #define HID_UP_LOGIVENDOR 0xffbc0000 186 187 187 188 #define HID_USAGE 0x0000ffff 188 189 ··· 245 242 #define HID_QUIRK_2WHEEL_MOUSE_HACK_7 0x080 246 243 #define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x100 247 244 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x200 245 + #define HID_QUIRK_2WHEEL_POWERMOUSE 0x400 248 246 249 247 /* 250 248 * This is the global environment of the parser. This information is ··· 352 348 353 349 #define HID_REPORT_TYPES 3 354 350 355 - #define HID_BUFFER_SIZE 64 /* use 64 for compatibility with all possible packetlen */ 351 + #define HID_MIN_BUFFER_SIZE 64 /* make sure there is at least a packet size of space */ 352 + #define HID_MAX_BUFFER_SIZE 4096 /* 4kb */ 356 353 #define HID_CONTROL_FIFO_SIZE 256 /* to init devices with >100 reports */ 357 354 #define HID_OUTPUT_FIFO_SIZE 64 358 355 ··· 390 385 int ifnum; /* USB interface number */ 391 386 392 387 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ 388 + 389 + unsigned int bufsize; /* URB buffer size */ 393 390 394 391 struct urb *urbin; /* Input URB */ 395 392 char *inbuf; /* Input buffer */
+1
drivers/usb/input/hiddev.c
··· 507 507 return -EINVAL; 508 508 509 509 hid_submit_report(hid, report, USB_DIR_OUT); 510 + hid_wait_io(hid); 510 511 511 512 return 0; 512 513
+8
include/linux/input.h
··· 289 289 #define KEY_SCROLLDOWN 178 290 290 #define KEY_KPLEFTPAREN 179 291 291 #define KEY_KPRIGHTPAREN 180 292 + #define KEY_NEW 181 293 + #define KEY_REDO 182 292 294 293 295 #define KEY_F13 183 294 296 #define KEY_F14 184 ··· 336 334 #define KEY_KBDILLUMTOGGLE 228 337 335 #define KEY_KBDILLUMDOWN 229 338 336 #define KEY_KBDILLUMUP 230 337 + 338 + #define KEY_SEND 231 339 + #define KEY_REPLY 232 340 + #define KEY_FORWARDMAIL 233 341 + #define KEY_SAVE 234 342 + #define KEY_DOCUMENTS 235 339 343 340 344 #define KEY_UNKNOWN 240 341 345