稍后我们将需要此信息,以便能够将给定的键盘/鼠标分配给给定的 X 服务器/显示器。
要查找输入设备的 PHYS ID(地址)或名称(通常与设备上标记的名称不同),您必须读取文件/proc/bus/input/devices.
这是我的
[svetljo@svetljo How-To]# cat /proc/bus/input/devices I: Bus=0011 Vendor=0002 Product=0002 Version=0034 N: Name="PS2++ Logitech Wheel Mouse" P: Phys=isa0060/serio1/input0 H: Handlers=mouse0 ts0 B: EV=7 B: KEY=f0000 0 0 0 0 0 0 0 0 B: REL=103 I: Bus=0011 Vendor=0001 Product=0002 Version=ab02 N: Name="AT Set 2 keyboard" P: Phys=isa0060/serio0/input0 H: Handlers=kbd B: EV=120003 B: KEY=4 2000000 8061f9 fbc9d621 efdfffdf ffefffff ffffffff fffffffe B: LED=7 I: Bus=0003 Vendor=046d Product=c303 Version=0700 N: Name="Logitech USB Keyboard" P: Phys=usb-00:10.1-1.1/input0 H: Handlers=kbd B: EV=120003 B: KEY=10000 7f ffe00000 7ff ffbeffdf ffffffff ffffffff fffffffe B: LED=7 I: Bus=0003 Vendor=046d Product=c303 Version=0700 N: Name="Logitech USB Keyboard" P: Phys=usb-00:10.1-1.1/input1 H: Handlers=kbd B: EV=100003 B: KEY=1078 1800d100 1e0000 0 0 0 I: Bus=0003 Vendor=05fe Product=0011 Version=0000 N: Name="Cypress Sem. PS2/USB Browser Combo Mouse" P: Phys=usb-00:10.1-1.2/input0 H: Handlers=mouse1 ts1 B: EV=7 B: KEY=1f0000 0 0 0 0 0 0 0 0 B: REL=103 |
![]() | 注意 |
---|---|
|
首先,我们必须找到 USB 键盘的地址
[root@svetljo How-To]# lsusb Bus 004 Device 001: ID 0000:0000 Bus 003 Device 001: ID 0000:0000 Bus 003 Device 002: ID 0409:55ab NEC Corp. Hub [iMac kbd] Bus 003 Device 003: ID 046d:c303 Logitech, Inc. Bus 003 Device 004: ID 05fe:0011 Chic Technology Corp. Browser Mouse Bus 002 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000 |
在这里,我的 USB Logitech 键盘是总线 003 上的设备 003。
现在我们运行带有参数的 lsusb-v -s [您的 USB 键盘设备 ID,格式为总线:设备],在我的情况下,lsusb -v -s 003:003。
........ Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 3 Human Interface Devices bInterfaceSubClass 1 Boot Interface Subclass bInterfaceProtocol 1 Keyboard iInterface 0 ........ Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 3 Human Interface Devices bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 ........ |
因此,我的 USB 键盘有两个接口(参见 bInterfaceNumber);第一个是真正的键盘 (bInterfaceProtocol 1 Keyboard),第二个 (bInterfaceProtocol 0 None) 是附加键。 因此,真正的 USB 键盘是
..... N: Name="Logitech USB Keyboard" P: Phys=usb-00:10.1-1.1/input0 H: Handlers=kbd ..... |
"P: Phys=" 字段(物理描述符/地址)由以下组成:
总线类型:"usb"
USB 控制器的 PCI 功能:"00:10.1 "(对于 Ruby-2.6 为 "0000:00:10.1")
USB 设备 ID:"1.1"
字符串:"/input"
接口号:"0"