我的键盘被识别为鼠标

我的键盘被识别为鼠标

我的 Logitech Wave 无绳键盘将自己呈现为内核的两个设备。一个是常规键盘,工作正常,但所有附加键都显示为事件鼠标,这样

cat /dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse

按下按钮时会产生预期的垃圾,但 xev 根本不注册任何内容。我已经尝试过 hidpoint,它不想在 OpenSuse Tumbleweed 上运行,并且我已经尝试过 usbhid.quirks=0x46d:0xc517:0x40 使用内核参数来强制“多身份”识别,但目前我还无法理解,因此很可能无法正确识别明白我在做什么

关于如何最好地说服内核将额外设备识别为键盘而不是鼠标有什么建议吗?

根据要求提供更多信息:

lsusb: Bus 001 Device 007: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser

邮件: usb 1-6: new low-speed USB device number 7 using xhci_hcd usb 1-6: New USB device found, idVendor=046d, idProduct=c517 usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 1-6: Product: USB Receiver usb 1-6: Manufacturer: Logitech input: Logitech USB Receiver as /devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/0003:046D:C517.0009/input/input14 logitech 0003:046D:C517.0009: input,hidraw3: USB HID v1.10 Keyboard [Logitech USB Receiver] on usb-0000:00:14.0-6/input0 logitech 0003:046D:C517.000A: fixing up Logitech keyboard report descriptor input: Logitech USB Receiver as /devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.1/0003:046D:C517.000A/input/input15 logitech 0003:046D:C517.000A: input,hiddev0,hidraw4: USB HID v1.10 Mouse [Logitech USB Receiver] on usb-0000:00:14.0-6/input1

$ evtest /dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse > evtestdump

Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x46d product 0xc517 version 0x110
Input device name: "Logitech USB Receiver"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 28 (KEY_ENTER)
    Event code 74 (KEY_KPMINUS)
    Event code 78 (KEY_KPPLUS)
    Event code 103 (KEY_UP)
...
    Event code 241 (KEY_VIDEO_NEXT)
    Event code 244 (KEY_BRIGHTNESS_ZERO)
    Event code 256 (BTN_0)
    Event code 272 (BTN_LEFT)
    Event code 273 (BTN_RIGHT)
    Event code 274 (BTN_MIDDLE)
    Event code 275 (BTN_SIDE)
    Event code 276 (BTN_EXTRA)
    Event code 277 (BTN_FORWARD)
    Event code 278 (BTN_BACK)
    Event code 279 (BTN_TASK)
    Event code 352 (KEY_OK)
    Event code 353 (KEY_SELECT)
    Event code 354 (KEY_GOTO)
    Event code 358 (KEY_INFO)
    Event code 362 (KEY_PROGRAM)
    Event code 366 (KEY_PVR)
    Event code 370 (KEY_SUBTITLE)
    Event code 371 (KEY_ANGLE)
    Event code 372 (KEY_ZOOM)
    Event code 374 (KEY_KEYBOARD)
    Event code 376 (KEY_PC)
    Event code 377 (KEY_TV)
    Event code 378 (KEY_TV2)
...
    Event code 431 (KEY_DISPLAYTOGGLE)
    Event code 432 (KEY_SPELLCHECK)
    Event code 433 (KEY_LOGOFF)
    Event code 439 (KEY_MEDIA_REPEAT)
    Event code 442 (KEY_IMAGES)
    Event code 478 (KEY_FN_1)
    Event code 479 (KEY_FN_2)
    Event code 576 (KEY_BUTTONCONFIG)
    Event code 577 (KEY_TASKMANAGER)
    Event code 578 (KEY_JOURNAL)
    Event code 579 (KEY_CONTROLPANEL)
    Event code 580 (KEY_APPSELECT)
    Event code 581 (KEY_SCREENSAVER)
    Event code 582 (KEY_VOICECOMMAND)
    Event code 592 (KEY_BRIGHTNESS_MIN)
    Event code 593 (KEY_BRIGHTNESS_MAX)
    Event code 608 (KEY_KBDINPUTASSIST_PREV)
    Event code 609 (KEY_KBDINPUTASSIST_NEXT)
    Event code 610 (KEY_KBDINPUTASSIST_PREVGROUP)
    Event code 611 (KEY_KBDINPUTASSIST_NEXTGROUP)
    Event code 612 (KEY_KBDINPUTASSIST_ACCEPT)
    Event code 613 (KEY_KBDINPUTASSIST_CANCEL)
  Event type 2 (EV_REL)
    Event code 0 (REL_X)
    Event code 1 (REL_Y)
    Event code 6 (REL_HWHEEL)
    Event code 7 (REL_DIAL)
    Event code 8 (REL_WHEEL)
  Event type 3 (EV_ABS)
    Event code 32 (ABS_VOLUME)
      Value      0
      Min        1
      Max     4173
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1498324926.500910, type 4 (EV_MSC), code 4 (MSC_SCAN), value c101c
Event: time 1498324926.500910, type 1 (EV_KEY), code 154 (KEY_CYCLEWINDOWS), value 1
Event: time 1498324926.500910, -------------- SYN_REPORT ------------
Event: time 1498324926.644944, type 4 (EV_MSC), code 4 (MSC_SCAN), value c101c
Event: time 1498324926.644944, type 1 (EV_KEY), code 154 (KEY_CYCLEWINDOWS), value 0
Event: time 1498324926.644944, -------------- SYN_REPORT ------------
Event: time 1498324926.932933, type 4 (EV_MSC), code 4 (MSC_SCAN), value c101f
Event: time 1498324926.932933, type 1 (EV_KEY), code 419 (KEY_ZOOMOUT), value 1
Event: time 1498324926.932933, -------------- SYN_REPORT ------------
Event: time 1498324927.052921, type 4 (EV_MSC), code 4 (MSC_SCAN), value c101f
Event: time 1498324927.052921, type 1 (EV_KEY), code 419 (KEY_ZOOMOUT), value 0
Event: time 1498324927.052921, -------------- SYN_REPORT ------------
Event: time 1498324927.396932, type 4 (EV_MSC), code 4 (MSC_SCAN), value c1020
Event: time 1498324927.396932, type 1 (EV_KEY), code 418 (KEY_ZOOMIN), value 1
Event: time 1498324927.396932, -------------- SYN_REPORT ------------
Event: time 1498324927.548930, type 4 (EV_MSC), code 4 (MSC_SCAN), value c1020
Event: time 1498324927.548930, type 1 (EV_KEY), code 418 (KEY_ZOOMIN), value 0
Event: time 1498324927.548930, -------------- SYN_REPORT ------------
Event: time 1498324927.916944, type 4 (EV_MSC), code 4 (MSC_SCAN), value c103d
Event: time 1498324927.916944, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 1
Event: time 1498324927.916944, -------------- SYN_REPORT ------------
Event: time 1498324928.084925, type 4 (EV_MSC), code 4 (MSC_SCAN), value c103d
Event: time 1498324928.084925, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 0
Event: time 1498324928.084925, -------------- SYN_REPORT ------------
Event: time 1498324928.460914, type 4 (EV_MSC), code 4 (MSC_SCAN), value c1005
Event: time 1498324928.460914, type 1 (EV_KEY), code 212 (KEY_CAMERA), value 1
Event: time 1498324928.460914, -------------- SYN_REPORT ------------
Event: time 1498324928.628903, type 4 (EV_MSC), code 4 (MSC_SCAN), value c1005
Event: time 1498324928.628903, type 1 (EV_KEY), code 212 (KEY_CAMERA), value 0
Event: time 1498324928.628903, -------------- SYN_REPORT ------------
Event: time 1498324930.876924, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b6
Event: time 1498324930.876924, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 1
Event: time 1498324930.876924, -------------- SYN_REPORT ------------
Event: time 1498324930.908915, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b6
Event: time 1498324930.908915, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 0
Event: time 1498324930.908915, -------------- SYN_REPORT ------------
Event: time 1498324931.684927, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b5
Event: time 1498324931.684927, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 1
Event: time 1498324931.684927, -------------- SYN_REPORT ------------
Event: time 1498324931.724935, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b5
Event: time 1498324931.724935, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 0
Event: time 1498324931.724935, -------------- SYN_REPORT ------------
Event: time 1498324932.652916, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0183
Event: time 1498324932.652916, type 1 (EV_KEY), code 226 (KEY_MEDIA), value 1
Event: time 1498324932.652916, -------------- SYN_REPORT ------------
Event: time 1498324932.812954, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0183
Event: time 1498324932.812954, type 1 (EV_KEY), code 226 (KEY_MEDIA), value 0
Event: time 1498324932.812954, -------------- SYN_REPORT ------------
Event: time 1498324933.748907, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0192
Event: time 1498324933.748907, type 1 (EV_KEY), code 140 (KEY_CALC), value 1
Event: time 1498324933.748907, -------------- SYN_REPORT ------------
Event: time 1498324933.884934, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0192
Event: time 1498324933.884934, type 1 (EV_KEY), code 140 (KEY_CALC), value 0
Event: time 1498324933.884934, -------------- SYN_REPORT ------------
Event: time 1498324938.084936, type 4 (EV_MSC), code 4 (MSC_SCAN), value 10082
Event: time 1498324938.084936, type 1 (EV_KEY), code 142 (KEY_SLEEP), value 1
Event: time 1498324938.084936, -------------- SYN_REPORT ------------
Event: time 1498324938.100912, type 4 (EV_MSC), code 4 (MSC_SCAN), value 10082
Event: time 1498324938.100912, type 1 (EV_KEY), code 142 (KEY_SLEEP), value 0
Event: time 1498324938.100912, -------------- SYN_REPORT ------------

(II) config/udev: Adding input device Logitech USB Receiver (/dev/input/mouse1)
(**) Logitech USB Receiver: Applying InputClass "system-keyboard"
(**) Logitech USB Receiver: Applying InputClass "Logitech USB TrackBall"
(**) Logitech USB Receiver: Applying InputClass "Logitech M570 Trackball"
(II) Using input driver 'evdev' for 'Logitech USB Receiver'
(**) Option "SendCoreEvents" "true"
(**) Logitech USB Receiver: always reports core events
(**) evdev: Logitech USB Receiver: Device: "/dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse"
(WW) evdev: Logitech USB Receiver: device file is duplicate. Ignoring.
(EE) PreInit returned 8 for "Logitech USB Receiver"
(II) UnloadModule: "evdev"
(II) config/udev: Adding input device Logitech USB Receiver (/dev/input/event11)
(**) Logitech USB Receiver: Applying InputClass "evdev keyboard catchall"
(**) Logitech USB Receiver: Applying InputClass "system-keyboard"
(**) Logitech USB Receiver: Applying InputClass "evdev keyboard catchall"
(**) Logitech USB Receiver: Applying InputClass "libinput keyboard catchall"
(II) Using input driver 'libinput' for 'Logitech USB Receiver'
(**) Logitech USB Receiver: always reports core events
(**) Option "Device" "/dev/input/event11"
(**) Option "_source" "server/udev"
(II) event11 - (II) Logitech USB Receiver: (II) is tagged by udev as: Keyboard
(II) event11 - (II) Logitech USB Receiver: (II) device is a keyboard
(II) event11 - (II) Logitech USB Receiver: (II) device removed
(**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/0003:046D:C517.000D/input/input18/event11"
(II) XINPUT: Adding extended input device "Logitech USB Receiver" (type: KEYBOARD, id 11)
(**) Option "xkb_model" "microsoftpro"
(**) Option "xkb_layout" "gb"
(**) Option "xkb_options" "terminate:ctrl_alt_bksp"
(II) event11 - (II) Logitech USB Receiver: (II) is tagged by udev as: Keyboard
(II) event11 - (II) Logitech USB Receiver: (II) device is a keyboard
(II) config/udev: Adding input device Logitech USB Receiver (/dev/input/event12)
(**) Logitech USB Receiver: Applying InputClass "evdev pointer catchall"
(**) Logitech USB Receiver: Applying InputClass "evdev keyboard catchall"
(**) Logitech USB Receiver: Applying InputClass "system-keyboard"
(**) Logitech USB Receiver: Applying InputClass "evdev pointer catchall"
(**) Logitech USB Receiver: Applying InputClass "evdev keyboard catchall"
(**) Logitech USB Receiver: Applying InputClass "Logitech USB TrackBall"
(**) Logitech USB Receiver: Applying InputClass "Logitech M570 Trackball"
(**) Logitech USB Receiver: Applying InputClass "libinput pointer catchall"
(**) Logitech USB Receiver: Applying InputClass "libinput keyboard catchall"
(II) Using input driver 'libinput' for 'Logitech USB Receiver'
(**) Option "SendCoreEvents" "true"
(**) Logitech USB Receiver: always reports core events
(**) Option "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse"
(**) Option "_source" "server/udev"
(EE) Failed to look up path '/dev/input/event13'
(II) event13: opening input device '/dev/input/event13' failed (No such device).
(II) event13 - failed to create input device '/dev/input/event13'.
(EE) libinput: Logitech USB Receiver: Failed to create a device for /dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse
(EE) PreInit returned 2 for "Logitech USB Receiver"
(II) UnloadModule: "libinput"

我确实有一个 M570 轨迹球,接收器显然正在连接到它,尽管它已经通过通用接收器连接。

答案1

部分答案:如何获取更多信息

1)用 out 更新问题lsusb,以便我们可以看到供应商和设备 ID。

2)dmesg当组合被识别时,用输出更新问题。如果在启动消息中找不到加密狗,请拔下并重新插入加密狗以强制重新识别。

3)evtest在鼠标输入设备上以 root 身份运行,以查看 (a) 它声称会产生什么事件 (b) 当您按下其他键时它会产生什么实际事件。用该输出更新问题。

4) 查看驱动程序识别的/var/log/Xorg.0.log设备。evdev用相关行更新问题。

这至少应该可以查明设备被识别为鼠标的原因。

编辑

我不明白罗技的驱动程序是怎样的应该工作,但发生的情况是第二个设备似乎确实是为额外的钥匙保留的对于鼠标 ( EV_REL) 事件,所以也许它是某种包罗万象的东西。

从内核方面来看,没有什么区别,内核只知道它将 USB HID 事件转换为输入事件。并udev使用误导性名称进行符号链接,但这也没关系。重要的是 X 似乎认为第二个输入设备是重复的(可能是因为它具有相同的名称)。所以我会尝试在其中xorg.conf包含一个InputClass部分,并尝试各种选项,希望让 X 接受该设备。我不知道为什么X拒绝了,所以我无法给出分步说明。如果描述不充分,请查看man xorg.conf的选项InputClass,并谷歌一下以了解它们的作用,有很多指南。

除了检查 X 日志之外,还要查看xinput列出的设备。即使它显示为鼠标,也足以使其显示在此列表中 - 您可以将其重新分配给Virtual core keyboard.还有它将要可能会被检测为鼠标,因为 X 认为(在大多数情况下可能是正确的)带有EV_REL事件的东西一定是鼠标,即使它有额外的EV_KEY按钮。

答案2

奇怪的是,将其识别为老鼠并不是最棘手的部分。这就是我在 xorg.con 中需要的全部内容

Section "InputClass"
        Identifier      "Wave keyboard extra keys"
        MatchUSBID      "046d:c517"
        MatchIsPointer  "on"
        Driver          "evdev"
        Option          "SendCoreEvents"        "true"
        Option          "Buttons"               "27"
        Option          "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse"
EndSection

问题是很多键发出的键码太高,xorg/evdev 听不到(扫描码> 255)我找到的解决方案是外路由器,使用此配置:

"Logitech USB Receiver" "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse" none key/418 "XKey/XF86RotateWindows"
"Logitech USB Receiver" "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse" none key/419 "XKey/XF86Game"
"Logitech USB Receiver" "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse" none key/421 "Xkey/XF86Launch7"
"Logitech USB Receiver" "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse" none key/423 "Xkey/XF86Launch8"
"Logitech USB Receiver" "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse" none key/397 "Xkey/XF86Launch9"
"Logitech USB Receiver" "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse" none key/430 "Xkey/XF86Messenger"
"Logitech USB Receiver" "/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse" none key/136 "Xkey/XF86Search"

显然,每行末尾的 Xkey 映射可以根据需要进行调整。一把钥匙似乎无法映射 - 这是左上角的大银色钥匙,带有齿轮和窗口;这根本不会生成有意义的扫描码,所以我认为它不会起作用。那么,唯一的另一个问题是媒体中心和(相邻的)“音乐音符”键发出相同的扫描码,因此它们总是彼此重复并且看起来是相同的键。除此之外,所有 Fn 键和媒体键要么按预期工作,要么在短暂访问桌面键盘快捷键配置后工作。

相关内容