更改给定设备的密钥代码

更改给定设备的密钥代码

我刚买了一台 Logitech Spotlight Presenter,它有两个按钮,其关键代码与我的演示文稿 (revealjs) 不兼容。 NextPrevious绑定为RightLeft,而我想将它们更改为np。我正在使用 Ubuntu 18.04 和 ArchLinux。

设备参数:

$ lsusb -d 046d:c53e -v

Bus 001 Device 012: ID 046d:c53e Logitech, Inc.
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        32
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc53e
  bcdDevice           41.00
  iManufacturer           1
  iProduct                2
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           84
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          4
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower               98mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      59
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               8
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     148
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               2
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      98
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               2

以下是当前的显示键:

# showkeys --scancodes
0xe0 0x4d 0xe0 0xcd
0xe0 0x4b 0xe0 0xcb

# showkeys --keycodes
keycode 106 release
keycode 105 release

以下是根据我的键盘显示的键:

# showkeys --scancodes
0x31 0xb1
p0x19 0x99

# showkeys --keycodes
keycode  49 release
keycode  25 release

我推断出以下内容/lib/udev/hwdb.d/61-logitech-spotlight-presenter-revealjs.hwdb

# This file has been created to improve Logitech Spotlight Presenter in revealjs
evdev:input:b*v046dpc53e*
 KEYBOARD_KEY_69=p
 KEYBOARD_KEY_6a=n

然后我尝试了以下方法

$ sudo systemd-hwdb update
$ udevadm trigger
$ sudo udevadm control --reload-rules && udevadm trigger

但我的遥控器仍然会触发Right/ Left

答案1

开源软件投影仪允许您映射 Logitech Spotlight 的按钮(并拥有可自定义的桌面点)

项目主页:https://github.com/jahnf/Projecteur

arch 包也可用: https://aur.archlinux.org/packages/projecteur

对于 Ubuntu,可以在项目的 github 页面以及 Ubuntu 存储库 20.10 及更高版本中找到软件包。

免责声明:我是以下内容的作者投影仪

相关内容