私のRFワイヤレスキーボードは、キーを押すか放すたびに、XF86Forward KeyPressイベントとKeyReleaseイベントをシステムに送信し続けます。

私のRFワイヤレスキーボードは、キーを押すか放すたびに、XF86Forward KeyPressイベントとKeyReleaseイベントをシステムに送信し続けます。

倒れた後、RFワイヤレスキーボードはキーを押すか放すたびにXF86Forward KeyPressイベントとKeyReleaseイベントをシステムに送信し続けます。

$ xev -event keyboard | egrep -w "KeyPress|KeyRelease|keycode"
KeyRelease event, serial 34, synthetic NO, window 0x3c00001,
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyPress event, serial 37, synthetic NO, window 0x3c00001,
    state 0x10, keycode 24 (keysym 0x61, a), same_screen YES,
KeyPress event, serial 37, synthetic NO, window 0x3c00001,
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyRelease event, serial 38, synthetic NO, window 0x3c00001,
    state 0x10, keycode 24 (keysym 0x61, a), same_screen YES,
KeyRelease event, serial 39, synthetic NO, window 0x3c00001,
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyPress event, serial 311, synthetic NO, window 0x3c00001,
    state 0x10, keycode 56 (keysym 0x62, b), same_screen YES,
KeyPress event, serial 312, synthetic NO, window 0x3c00001,
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyRelease event, serial 312, synthetic NO, window 0x3c00001,
    state 0x10, keycode 56 (keysym 0x62, b), same_screen YES,
KeyRelease event, serial 313, synthetic NO, window 0x3c00001,
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyPress event, serial 313, synthetic NO, window 0x3c00001,
    state 0x10, keycode 54 (keysym 0x63, c), same_screen YES,
KeyPress event, serial 313, synthetic NO, window 0x3c00001,
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyRelease event, serial 314, synthetic NO, window 0x3c00001,
    state 0x10, keycode 54 (keysym 0x63, c), same_screen YES,
KeyRelease event, serial 315, synthetic NO, window 0x3c00001,
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyPress event, serial 315, synthetic NO, window 0x3c00001,
    state 0x10, keycode 40 (keysym 0x64, d), same_screen YES,
KeyPress event, serial 315, synthetic NO, window 0x3c00001,
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyRelease event, serial 316, synthetic NO, window 0x3c00001,
    state 0x10, keycode 40 (keysym 0x64, d), same_screen YES,
KeyRelease event, serial 317, synthetic NO, window 0x3c00001,
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,

^@したがって、入力したすべての文字に以下が追加されるため、tty [1-6]コンソールにログインできません。

$ showkey -k
 kb mode was UNICODE
 [ if you are trying this under X, it might not work
 since the X server is also reading /dev/console ]

 press any key (program terminates 10s after last keypress)...
 keycode  28 release
 keycode  16 press
 keycode 159 press
 keycode  16 release
 keycode 159 release
 keycode  48 press
 keycode 159 press
 keycode  48 release
 keycode 159 release
 keycode  46 press
 keycode 159 press
 keycode  46 release
 keycode 159 release
 keycode  32 press
 keycode 159 press
 keycode  32 release
 keycode 159 release

編集0:私によると、私のRAPOOワイヤレスキーボード+マウスコンボ/proc/bus/input/devicesには2つの項目があります。/dev/input/eventX

$ cat /proc/bus/input/devices  | grep -P '^[NH]: ' | paste - - | grep RAPOO
N: Name="RAPOO RAPOO 5G Wireless Device"    H: Handlers=sysrq kbd event2 leds 
N: Name="RAPOO RAPOO 5G Wireless Device"    H: Handlers=kbd mouse0 event3 

マウスはキーボードと同じRFチャネルを使用してUSBマイクロレシーバと通信するため、論理的に見えます。

EDIT1:上記のハンドラ値によると、/dev/input/event2イベントはキーボードでのみ受信されるようです。evtest出力は次のとおりです/dev/input/event2

$ sudo evtest /dev/input/event2
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x24ae product 0x2003 version 0x110
Input device name: "RAPOO RAPOO 5G Wireless Device"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
...
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
  Event type 17 (EV_LED)
    Event code 0 (LED_NUML) state 0
    Event code 1 (LED_CAPSL) state 0
    Event code 2 (LED_SCROLLL) state 0
    Event code 3 (LED_COMPOSE) state 0
    Event code 4 (LED_KANA) state 0
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    250
    Repeat code 1 (REP_PERIOD)
      Value     33
Properties:
Testing ... (interrupt to exit)
Event: time 1625417787.379951, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70058
Event: time 1625417787.379951, type 1 (EV_KEY), code 96 (KEY_KPENTER), value 0
Event: time 1625417787.379951, -------------- SYN_REPORT ------------
Event: time 1625417794.923958, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70004
Event: time 1625417794.923958, type 1 (EV_KEY), code 30 (KEY_A), value 1
Event: time 1625417794.923958, -------------- SYN_REPORT ------------
qEvent: time 1625417795.051954, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70004
Event: time 1625417795.051954, type 1 (EV_KEY), code 30 (KEY_A), value 0
Event: time 1625417795.051954, -------------- SYN_REPORT ------------
Event: time 1625417797.083970, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70005
Event: time 1625417797.083970, type 1 (EV_KEY), code 48 (KEY_B), value 1
Event: time 1625417797.083970, -------------- SYN_REPORT ------------
bEvent: time 1625417797.187973, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70005
Event: time 1625417797.187973, type 1 (EV_KEY), code 48 (KEY_B), value 0
Event: time 1625417797.187973, -------------- SYN_REPORT ------------
Event: time 1625417798.363970, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1625417798.363970, type 1 (EV_KEY), code 46 (KEY_C), value 1
Event: time 1625417798.363970, -------------- SYN_REPORT ------------
cEvent: time 1625417798.459960, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1625417798.459960, type 1 (EV_KEY), code 46 (KEY_C), value 0
Event: time 1625417798.459960, -------------- SYN_REPORT ------------
Event: time 1625417799.195958, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70007
Event: time 1625417799.195958, type 1 (EV_KEY), code 32 (KEY_D), value 1
Event: time 1625417799.195958, -------------- SYN_REPORT ------------
dEvent: time 1625417799.259976, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70007
Event: time 1625417799.259976, type 1 (EV_KEY), code 32 (KEY_D), value 0
Event: time 1625417799.259976, -------------- SYN_REPORT ------------
Event: time 1625417801.379970, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1625417801.379970, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1625417801.379970, -------------- SYN_REPORT ------------
Event: time 1625417801.587964, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1625417801.587964, type 1 (EV_KEY), code 46 (KEY_C), value 1
Event: time 1625417801.587964, -------------- SYN_REPORT ------------

EDIT2:/dev/input/event3キーボードとマウスからイベントを受け取っているようです。出力は次のとおりです(各キーを押して放したときのイベントに注意してください)evtest/dev/input/event3KEY_FORWARD

$ sudo evtest /dev/input/event3
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x24ae product 0x2003 version 0x110
Input device name: "RAPOO RAPOO 5G Wireless Device"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    ...
  Event type 3 (EV_ABS)
    Event code 32 (ABS_VOLUME)
      Value      0
      Min        0
      Max      896
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1625418203.492208, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418203.492208, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418203.492208, -------------- SYN_REPORT ------------
Event: time 1625418205.620275, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418205.620275, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 1
Event: time 1625418205.620275, -------------- SYN_REPORT ------------
aEvent: time 1625418205.908189, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418205.908189, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418205.908189, -------------- SYN_REPORT ------------
Event: time 1625418207.076271, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418207.076271, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 1
Event: time 1625418207.076271, -------------- SYN_REPORT ------------
bEvent: time 1625418207.348222, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418207.348222, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418207.348222, -------------- SYN_REPORT ------------
Event: time 1625418208.356296, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418208.356296, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 1
Event: time 1625418208.356296, -------------- SYN_REPORT ------------
cEvent: time 1625418208.660204, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418208.660204, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418208.660204, -------------- SYN_REPORT ------------
Event: time 1625418209.636254, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418209.636254, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 1
Event: time 1625418209.636254, -------------- SYN_REPORT ------------
dEvent: time 1625418209.924202, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418209.924202, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418209.924202, -------------- SYN_REPORT ------------
Event: time 1625418211.564204, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1625418211.564204, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1625418211.564204, -------------- SYN_REPORT ------------
Event: time 1625418211.620212, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1625418211.620212, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1625418211.620212, -------------- SYN_REPORT ------------
Event: time 1625418216.572202, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1625418216.572202, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 1
Event: time 1625418216.572202, -------------- SYN_REPORT ------------
Event: time 1625418216.644212, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1625418216.644212, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 0
Event: time 1625418216.644212, -------------- SYN_REPORT ------------
Event: time 1625418218.780207, type 2 (EV_REL), code 0 (REL_X), value -1
Event: time 1625418218.780207, -------------- SYN_REPORT ------------
Event: time 1625418218.788214, type 2 (EV_REL), code 0 (REL_X), value -1
Event: time 1625418218.788214, -------------- SYN_REPORT ------------
^C

EDIT3:sudo timeout 5s evtest --grab /dev/input/eventXうまくいきますが、それはすべてです。

/dev/input/event2すべてのEV_KEYキーボードイベントのみを受信し、追加KEY_FORWARD EV_KEYイベントとマウスイベントは受信されません。そして、マウスイベントとキーボードイベントのみを/dev/input/event3受け取るようです(他のイベントは受け取りません)。KEY_FORWARD EV_KEYEV_KEY

したがって、 を使用すると/dev/input/event2マウスが機能せず、 を使用すると/dev/input/event3キーボードは機能しません。

udevadm info/dev/input/event2キーボードイベントと/dev/input/event3マウスイベントを確認してください。

$ udevadm info /dev/input/event2 | grep event-
S: input/by-id/usb-RAPOO_RAPOO_5G_Wireless_Device-event-kbd
S: input/by-path/pci-0000:00:1d.3-usb-0:1:1.0-event-kbd
E: DEVLINKS=/dev/input/by-id/usb-RAPOO_RAPOO_5G_Wireless_Device-event-kbd /dev/input/by-path/pci-0000:00:1d.3-usb-0:1:1.0-event-kbd
$ udevadm info /dev/input/event3 | grep event-
S: input/by-id/usb-RAPOO_RAPOO_5G_Wireless_Device-if01-event-mouse
S: input/by-path/pci-0000:00:1d.3-usb-0:1:1.1-event-mouse
E: DEVLINKS=/dev/input/by-path/pci-0000:00:1d.3-usb-0:1:1.1-event-mouse /dev/input/by-id/usb-RAPOO_RAPOO_5G_Wireless_Device-if01-event-mouse

RFキーボードがXF86Forward KeyPressおよびKeyReleaseイベントを送信するのを防ぐ方法は?

ベストアンサー1

さて、まとめてみましょう:

最初のステップは、evtestカーネル入力レイヤーでもこれが起こるかどうかを確認して使用することです。また、RFキーボードには複数の入力デバイスが接続されている可能性があるため(evtest検証のためにすべての入力デバイスに使用される)、実際のキー以外のデバイスから出てくる場合は、そのXF86Forwardデバイスを無視する簡単な解決策があります。

実際には2つのデバイスがあることがわかりました。

次のステップは、evtest --grabキー+マウスデバイスを使用して、イベントがXまたはVTで処理されないようにevtestにのみ送信されるようにすることです。 VTを使用すると、VTを切り替えてもクロールが続くかどうかわからないため、少しトリッキーです。また、/dev/input/by-*起動時にデバイスを正しく識別する方法も見てください。これがうまくいったら実行してみることができます

evtest --grab /dev/input/... > /dev/null

または起動中にそのようなもの。

マウスは明らかにキーボードの一部であり(または同じRFチャネルを使用しますか?)必須であるため、これはオプションではありません。

これがXでのみ機能する場合は、「マウス」入力デバイスをキーボードの代わりにマウスとして使用できます。ただし、VTも使用したい場合はこれはオプションではありません。

したがって、残りの唯一のことは、XF86Forwardマウスイベントを通過しながらイベントを削除するカスタムフィルタを作成することです。私はしばらく前に尋ねた質問がありました。説明するそれを行う方法。それでも利用可能でなければなりませんuinput

おすすめ記事