Lines Matching +full:- +full:chn +full:- +full:disabled

1 // SPDX-License-Identifier: GPL-2.0
6 * Some additional features added by Christoph Niemann (ChN), March 1993
15 * 11-11-96: SAK should now work in the raw mode (Martin Mares)
18 * Merge with the m68k keyboard driver and split-off of the PC low-level
21 * 27-05-97: Added support for the Magic SysRq Key (Martin Mares)
22 * 30-07-98: Dead keys redone, aeb@cwi.nl.
23 * 21-08-02: Converted to input API, major cleanup. (Vojtech Pavlik)
116 [ KT_FN ] = ARRAY_SIZE(func_table) - 1,
117 [ KT_SPEC ] = ARRAY_SIZE(fn_handler) - 1,
118 [ KT_PAD ] = NR_PAD - 1,
119 [ KT_DEAD ] = NR_DEAD - 1,
122 [ KT_SHIFT ] = NR_SHIFT - 1,
124 [ KT_ASCII ] = NR_ASCII - 1,
125 [ KT_LOCK ] = NR_LOCK - 1,
127 [ KT_SLOCK ] = NR_LOCK - 1,
129 [ KT_BRL ] = NR_BRL - 1,
154 static unsigned int ledstate = -1U; /* undefined */
194 d->error = input_get_keycode(handle->dev, &d->ke); in getkeycode_helper()
196 return d->error == 0; /* stop as soon as we successfully get one */ in getkeycode_helper()
207 .error = -ENODEV, in getkeycode()
221 d->error = input_set_keycode(handle->dev, &d->ke); in setkeycode_helper()
223 return d->error == 0; /* stop as soon as we successfully set one */ in setkeycode_helper()
234 .error = -ENODEV, in setkeycode()
252 struct input_dev *dev = handle->dev; in kd_sound_helper()
254 if (test_bit(EV_SND, dev->evbit)) { in kd_sound_helper()
255 if (test_bit(SND_TONE, dev->sndbit)) { in kd_sound_helper()
260 if (test_bit(SND_BELL, dev->sndbit)) in kd_sound_helper()
293 struct input_dev *dev = handle->dev; in kbd_rate_helper()
296 if (test_bit(EV_REP, dev->evbit)) { in kbd_rate_helper()
305 rpt[1].delay = dev->rep[REP_DELAY]; in kbd_rate_helper()
306 rpt[1].period = dev->rep[REP_PERIOD]; in kbd_rate_helper()
327 tty_insert_flip_char(&vc->port, ch, 0); in put_queue()
328 tty_flip_buffer_push(&vc->port); in put_queue()
333 tty_insert_flip_string(&vc->port, cp, strlen(cp)); in puts_queue()
334 tty_flip_buffer_push(&vc->port); in puts_queue()
348 * they produce ASCII, or they produce some user-assigned
350 * in utf-8 already.
386 * Called after returning from RAW mode or when changing consoles - recompute
457 if (kbd->kbdmode == VC_UNICODE) in handle_diacr()
461 if (c != -1) in handle_diacr()
474 if (kbd->kbdmode == VC_UNICODE) in fn_enter()
478 if (c != -1) in fn_enter()
515 struct tty_struct *tty = vc->port.tty; in fn_hold()
525 if (tty->flow.stopped) in fn_hold()
540 * Bind this to Shift-NumLock if you work in application keypad mode
553 /* switch to the last used console, ChN */ in fn_lastcons()
562 if (want_console != -1) in fn_dec_console()
565 for (i = cur - 1; i != cur; i--) { in fn_dec_console()
566 if (i == -1) in fn_dec_console()
567 i = MAX_NR_CONSOLES - 1; in fn_dec_console()
579 if (want_console != -1) in fn_inc_console()
593 tty_insert_flip_char(&vc->port, 0, TTY_BREAK); in fn_send_intr()
594 tty_flip_buffer_push(&vc->port); in fn_send_intr()
662 if ((kbd->kbdmode == VC_RAW || in k_spec()
663 kbd->kbdmode == VC_MEDIUMRAW || in k_spec()
664 kbd->kbdmode == VC_OFF) && in k_spec()
672 pr_err("k_lowercase was called - impossible\n"); in k_lowercase()
688 if (kbd->kbdmode == VC_UNICODE) in k_unicode()
692 if (c != -1) in k_unicode()
721 * Obsolete - for backwards compatibility only
745 '-', /* dead_stroke */ in k_dead()
795 static const char pad_chars[] = "0123456789+-*/\015,.?()#"; in k_pad()
874 shift_down[value]--; in k_shift()
885 if (kbd->kbdmode == VC_UNICODE) in k_shift()
917 value -= 10; in k_ascii()
945 if (!key_maps[kbd->lockstate ^ kbd->slockstate]) { in k_slock()
946 kbd->slockstate = 0; in k_slock()
983 if (kbd->kbdmode != VC_UNICODE) { in k_brl()
998 pressed |= BIT(value - 1); in k_brl()
1008 pressed &= ~BIT(value - 1); in k_brl()
1018 pressed &= ~BIT(value - 1); in k_brl()
1032 container_of(cdev->trigger, struct kbd_led_trigger, trigger); in kbd_led_trigger_activate()
1035 if (ledstate != -1U) in kbd_led_trigger_activate()
1036 led_set_brightness(cdev, ledstate & trigger->mask ? LED_FULL : LED_OFF); in kbd_led_trigger_activate()
1054 KBD_LED_TRIGGER(VC_SCROLLOCK, "kbd-scrolllock"),
1055 KBD_LED_TRIGGER(VC_NUMLOCK, "kbd-numlock"),
1056 KBD_LED_TRIGGER(VC_CAPSLOCK, "kbd-capslock"),
1057 KBD_LED_TRIGGER(VC_KANALOCK, "kbd-kanalock"),
1059 KBD_LOCKSTATE_TRIGGER(VC_SHIFTLOCK, "kbd-shiftlock"),
1060 KBD_LOCKSTATE_TRIGGER(VC_ALTGRLOCK, "kbd-altgrlock"),
1061 KBD_LOCKSTATE_TRIGGER(VC_CTRLLOCK, "kbd-ctrllock"),
1062 KBD_LOCKSTATE_TRIGGER(VC_ALTLOCK, "kbd-altlock"),
1063 KBD_LOCKSTATE_TRIGGER(VC_SHIFTLLOCK, "kbd-shiftllock"),
1064 KBD_LOCKSTATE_TRIGGER(VC_SHIFTRLOCK, "kbd-shiftrlock"),
1065 KBD_LOCKSTATE_TRIGGER(VC_CTRLLLOCK, "kbd-ctrlllock"),
1066 KBD_LOCKSTATE_TRIGGER(VC_CTRLRLOCK, "kbd-ctrlrlock"),
1079 if (changed & trigger->mask) in kbd_propagate_led_state()
1080 led_trigger_event(&trigger->trigger, in kbd_propagate_led_state()
1081 new_state & trigger->mask ? in kbd_propagate_led_state()
1090 if (test_bit(EV_LED, handle->dev->evbit)) in kbd_update_leds_helper()
1115 if (test_bit(EV_LED, handle->dev->evbit)) { in kbd_update_leds_helper()
1154 kb->ledmode = LED_SHOW_IOCTL; in setledstate()
1156 kb->ledmode = LED_SHOW_FLAGS; in setledstate()
1166 if (kb->ledmode == LED_SHOW_IOCTL) in getleds()
1169 return kb->ledflagstate; in getleds()
1173 * vt_get_leds - helper for braille console
1194 * vt_set_led_state - set LED state of a console
1208 * vt_kbd_con_start - Keyboard side of console start
1218 * but not during an -rc release!
1231 * vt_kbd_con_stop - Keyboard side of console stop
1260 leds |= (unsigned int)kbd->lockstate << 8; in kbd_bh()
1281 if (!test_bit(EV_MSC, dev->evbit) || !test_bit(MSC_RAW, dev->mscbit)) in kbd_is_hw_raw()
1284 return dev->id.bustype == BUS_I8042 && in kbd_is_hw_raw()
1285 dev->id.vendor == 0x0001 && dev->id.product == 0x0001; in kbd_is_hw_raw()
1353 return -1; in emulate_raw()
1357 return -1; in emulate_raw()
1379 return -1; in emulate_raw()
1390 kbd = &kbd_table[vc->vc_num]; in kbd_rawcode()
1391 if (kbd->kbdmode == VC_RAW) in kbd_rawcode()
1406 tty = vc->port.tty; in kbd_keycode()
1408 if (tty && (!tty->driver_data)) { in kbd_keycode()
1410 tty->driver_data = vc; in kbd_keycode()
1413 kbd = &kbd_table[vc->vc_num]; in kbd_keycode()
1422 raw_mode = (kbd->kbdmode == VC_RAW); in kbd_keycode()
1436 if (kbd->kbdmode == VC_MEDIUMRAW) { in kbd_keycode()
1469 param.shift = shift_final = (shift_state | kbd->slockstate) ^ kbd->lockstate; in kbd_keycode()
1470 param.ledstate = kbd->ledflagstate; in kbd_keycode()
1479 kbd->slockstate = 0; in kbd_keycode()
1486 keysym = U(K(KT_BRL, keycode - KEY_BRL_DOT1 + 1)); in kbd_keycode()
1502 type -= 0xf0; in kbd_keycode()
1519 if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT) in kbd_keycode()
1524 param.ledstate = kbd->ledflagstate; in kbd_keycode()
1528 kbd->slockstate = 0; in kbd_keycode()
1534 /* We are called with interrupts disabled, just take the lock */ in kbd_event()
1538 kbd_is_hw_raw(handle->dev)) in kbd_event()
1541 kbd_keycode(event_code, value, kbd_is_hw_raw(handle->dev)); in kbd_event()
1552 if (test_bit(EV_SND, dev->evbit)) in kbd_match()
1555 if (test_bit(EV_KEY, dev->evbit)) { in kbd_match()
1556 if (find_next_bit(dev->keybit, BTN_MISC, KEY_RESERVED) < in kbd_match()
1559 if (find_next_bit(dev->keybit, KEY_BRL_DOT10 + 1, in kbd_match()
1581 return -ENOMEM; in kbd_connect()
1583 handle->dev = dev; in kbd_connect()
1584 handle->handler = handler; in kbd_connect()
1585 handle->name = "kbd"; in kbd_connect()
1619 if (ledstate != -1U) in kbd_start()
1681 * vt_do_diacrit - diacritical table updates
1705 return -ENOMEM; in vt_do_diacrit()
1722 if (put_user(asize, &a->kb_cnt)) in vt_do_diacrit()
1723 ret = -EFAULT; in vt_do_diacrit()
1724 else if (copy_to_user(a->kbdiacr, dia, in vt_do_diacrit()
1726 ret = -EFAULT; in vt_do_diacrit()
1738 return -ENOMEM; in vt_do_diacrit()
1749 if (put_user(asize, &a->kb_cnt)) in vt_do_diacrit()
1750 ret = -EFAULT; in vt_do_diacrit()
1751 else if (copy_to_user(a->kbdiacruc, buf, in vt_do_diacrit()
1753 ret = -EFAULT; in vt_do_diacrit()
1766 return -EPERM; in vt_do_diacrit()
1767 if (get_user(ct, &a->kb_cnt)) in vt_do_diacrit()
1768 return -EFAULT; in vt_do_diacrit()
1770 return -EINVAL; in vt_do_diacrit()
1773 dia = memdup_array_user(a->kbdiacr, in vt_do_diacrit()
1801 return -EPERM; in vt_do_diacrit()
1803 if (get_user(ct, &a->kb_cnt)) in vt_do_diacrit()
1804 return -EFAULT; in vt_do_diacrit()
1807 return -EINVAL; in vt_do_diacrit()
1810 buf = memdup_array_user(a->kbdiacruc, in vt_do_diacrit()
1829 * vt_do_kdskbmode - set keyboard mode ioctl
1845 kb->kbdmode = VC_RAW; in vt_do_kdskbmode()
1848 kb->kbdmode = VC_MEDIUMRAW; in vt_do_kdskbmode()
1851 kb->kbdmode = VC_XLATE; in vt_do_kdskbmode()
1855 kb->kbdmode = VC_UNICODE; in vt_do_kdskbmode()
1859 kb->kbdmode = VC_OFF; in vt_do_kdskbmode()
1862 ret = -EINVAL; in vt_do_kdskbmode()
1869 * vt_do_kdskbmeta - set keyboard meta state
1891 ret = -EINVAL; in vt_do_kdskbmeta()
1904 return -EFAULT; in vt_do_kbkeycode_ioctl()
1909 kc = put_user(kc, &user_kbkc->keycode); in vt_do_kbkeycode_ioctl()
1913 return -EPERM; in vt_do_kbkeycode_ioctl()
1954 keymap_count--; in vt_kdskbent()
1964 return -EINVAL; in vt_kdskbent()
1966 return -EINVAL; in vt_kdskbent()
1968 /* ++Geert: non-PC keyboards may generate keycode zero */ in vt_kdskbent()
1977 return -ENOMEM; in vt_kdskbent()
1988 return -EPERM; in vt_kdskbent()
2006 return -EPERM; in vt_kdskbent()
2025 return -EFAULT; in vt_do_kdsk_ioctl()
2029 return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index, in vt_do_kdsk_ioctl()
2031 &user_kbe->kb_value); in vt_do_kdsk_ioctl()
2034 return -EPERM; in vt_do_kdsk_ioctl()
2035 return vt_kdskbent(kb->kbdmode, kbe.kb_index, kbe.kb_table, in vt_do_kdsk_ioctl()
2063 if (get_user(kb_func, &user_kdgkb->kb_func)) in vt_do_kdgkb_ioctl()
2064 return -EFAULT; in vt_do_kdgkb_ioctl()
2071 ssize_t len = sizeof(user_kdgkb->kb_string); in vt_do_kdgkb_ioctl()
2075 return -ENOMEM; in vt_do_kdgkb_ioctl()
2082 ret = -ENOSPC; in vt_do_kdgkb_ioctl()
2085 ret = copy_to_user(user_kdgkb->kb_string, kbs, len + 1) ? in vt_do_kdgkb_ioctl()
2086 -EFAULT : 0; in vt_do_kdgkb_ioctl()
2091 return -EPERM; in vt_do_kdgkb_ioctl()
2093 kbs = strndup_user(user_kdgkb->kb_string, in vt_do_kdgkb_ioctl()
2094 sizeof(user_kdgkb->kb_string)); in vt_do_kdgkb_ioctl()
2119 /* don't use them - they will go away without warning */ in vt_do_kdskled()
2122 ucval = kb->ledflagstate | (kb->default_ledflagstate << 4); in vt_do_kdskled()
2128 return -EPERM; in vt_do_kdskled()
2130 return -EINVAL; in vt_do_kdskled()
2132 kb->ledflagstate = (arg & 7); in vt_do_kdskled()
2133 kb->default_ledflagstate = ((arg >> 4) & 7); in vt_do_kdskled()
2146 return -EPERM; in vt_do_kdskled()
2150 return -ENOIOCTLCMD; in vt_do_kdskled()
2157 switch (kb->kbdmode) { in vt_do_kdgkbmode()
2172 * vt_do_kdgkbmeta - report meta status
2185 * vt_reset_unicode - reset the unicode status
2200 * vt_get_shift_state - shift bit state
2212 * vt_reset_keyboard - reset keyboard state
2228 kb->lockstate = 0; in vt_reset_keyboard()
2229 kb->slockstate = 0; in vt_reset_keyboard()
2231 kb->ledmode = LED_SHOW_FLAGS; in vt_reset_keyboard()
2232 kb->ledflagstate = kb->default_ledflagstate; in vt_reset_keyboard()
2240 * vt_get_kbd_mode_bit - read keyboard status bits
2255 * vt_set_kbd_mode_bit - read keyboard status bits
2274 * vt_clr_kbd_mode_bit - read keyboard status bits