我的 Xorg 程序使用tty1
.使用Ctrl++Alt之间F[2~6]进行切换ttY[2~6]
。此时NumLock或CapsLock状态(包括键盘上相应的 LED 灯)可以正常同步。
tty1
如果在和之间切换tty[2~6]
,NumLock或CapsLock状态正常,但键盘灯不正常切换。我想知道,谁负责保存和切换键盘的NumLock或状态(包括键盘上相应的LED灯)?CapsLocktty
用于evtest
监听键盘事件,示例如下:
场景一:
tty1: Num led is on, you can input numbers;
tty2: Num Led is off, you cannot enter numbers;
tty1-->tty2: Num led is on, no number can be input
ctrl+alt+f2, tty1-->tty2, evtest print as follows:
Event: time 1631671173.524324, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1631671173.524324, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1631671173.524324, -------------- SYN_REPORT ------------
Event: time 1631671173.612530, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1631671173.612530, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 1
Event: time 1631671173.612530, -------------- SYN_REPORT ------------
Event: time 1631671173.684525, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7003b
Event: time 1631671173.684525, type 1 (EV_KEY), code 60 (KEY_F2), value 1
Event: time 1631671173.684525, -------------- SYN_REPORT ------------
Event: time 1631671173.804507, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1631671173.804507, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
Event: time 1631671173.804507, -------------- SYN_REPORT ------------
Event: time 1631671173.812235, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1631671173.812235, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 0
Event: time 1631671173.812235, -------------- SYN_REPORT ------------
Event: time 1631671173.824310, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7003b
Event: time 1631671173.824310, type 1 (EV_KEY), code 60 (KEY_F2), value 0
Event: time 1631671173.824310, -------------- SYN_REPORT ------------
场景2:
tty2: Num led is on, you can input numbers;
tty3: Num Led is off, you cannot enter numbers;
tty2-->tty3: Num led is off, no number can be input
ctrl+alt+f3, tty2-->tty3, evtest print as follows:
Event: time 1631671357.985873, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1631671357.985873, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1631671357.985873, -------------- SYN_REPORT ------------
Event: time 1631671358.097893, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1631671358.097893, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 1
Event: time 1631671358.097893, -------------- SYN_REPORT ------------
Event: time 1631671358.181861, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7003c
Event: time 1631671358.181861, type 1 (EV_KEY), code 61 (KEY_F3), value 1
Event: time 1631671358.181861, -------------- SYN_REPORT ------------
Event: time 1631671358.313866, type 17 (EV_LED), code 0 (LED_NUML), value 0
Event: time 1631671358.313866, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7003c
Event: time 1631671358.313866, type 1 (EV_KEY), code 61 (KEY_F3), value 0
Event: time 1631671358.313866, -------------- SYN_REPORT ------------
Event: time 1631671358.321862, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1631671358.321862, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
Event: time 1631671358.321862, -------------- SYN_REPORT ------------
Event: time 1631671358.337870, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e2
Event: time 1631671358.337870, type 1 (EV_KEY), code 56 (KEY_LEFTALT), value 0
Event: time 1631671358.337870, -------------- SYN_REPORT ------------