将 PS/2 转 USB 键盘连接到 Linux

将 PS/2 转 USB 键盘连接到 Linux

我有一个可爱的古老人体工学键盘(无名 SK-6000),通过DIN-5-到-PS/2适配器连接到 PS/2-tp-USB 适配器,再连接到我的扩展坞。之后GRUB,它停止工作。它需要在 Linux 运行时暂停并唤醒或重新插入才能使其工作。无需为此加载额外的内核模块。当它工作时,我重新启动而不关闭电源,它会立即工作。

即使如此不是工作,它是可见的(系统盘设备编号各不相同,但无论是否工作,输出都是相同的):

lsusb -v -s 001:006

Bus 001 Device 006: ID 0a81:0205 Chesen Electronics Corp. PS/2 Keyboard+Mouse Adapter
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0a81 Chesen Electronics Corp.
  idProduct          0x0205 PS/2 Keyboard+Mouse Adapter
  bcdDevice            0.10
  iManufacturer           1 CHESEN
  iProduct                2 PS2 to USB Converter
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
bLength                 9
bDescriptorType         2
wTotalLength           59
bNumInterfaces          2
bConfigurationValue     1
iConfiguration          2 PS2 to USB Converter
bmAttributes         0xa0
  (Bus Powered)
  Remote Wakeup
MaxPower              100mA
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.10
      bCountryCode            0 Not supported
      bNumDescriptors         1
      bDescriptorType        34 Report
      wDescriptorLength      64
     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              10
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.10
      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              10
Device Status:     0x0000
  (Bus Powered)


ll -R /sys/bus/hid/drivers/

/sys/bus/hid/drivers/:
total 0
drwxr-xr-x 2 root root 0 Jul  8  2012 generic-usb/

/sys/bus/hid/drivers/generic-usb:
total 0
lrwxrwxrwx 1 root root    0 Jul  7 23:33 0003:046D:C03D.0003 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:046D:C03D.0003/
lrwxrwxrwx 1 root root    0 Jul  7 23:33 0003:0A81:0205.0001 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/0003:0A81:0205.0001/
lrwxrwxrwx 1 root root    0 Jul  7 23:33 0003:0A81:0205.0002 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.1/0003:0A81:0205.0002/
--w------- 1 root root 4096 Jul  7 23:32 bind
lrwxrwxrwx 1 root root    0 Jul  7 23:33 module -> ../../../../module/usbhid/
--w------- 1 root root 4096 Jul  7 23:32 new_id
--w------- 1 root root 4096 Jul  8  2012 uevent
--w------- 1 root root 4096 Jul  7 23:32 unbind

重新插电时,消息显示这一点(除了第一行和不同的输入数字在启动时已经出现):

[ 1583.295385] usb 1-1.2.1: new low-speed USB device number 6 using ehci_hcd
[ 1583.446514] input: CHESEN PS2 to USB Converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/input/input17
[ 1583.446817] generic-usb 0003:0A81:0205.0001: input,hidraw0: USB HID v1.10 Keyboard [CHESEN PS2 to USB Converter] on usb-0000:00:1a.0-1.2.1/input0
[ 1583.454764] input: CHESEN PS2 to USB Converter as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.1/input/input18
[ 1583.455534] generic-usb 0003:0A81:0205.0002: input,hidraw1: USB HID v1.10 Mouse [CHESEN PS2 to USB Converter] on usb-0000:00:1a.0-1.2.1/input1
[ 1583.455578] usbcore: registered new interface driver usbhid
[ 1583.455584] usbhid: USB HID core driver

所以我尝试了

sudo udevadm test /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/0003:0A81:0205.0001/hidraw/hidraw0

run_command: calling: test
adm_test: version 175
This program is for debugging only, it does not run any program,
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

parse_file: reading '/lib/udev/rules.d/40-crda.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-fuse.rules' as rules file
...
parse_file: reading '/lib/udev/rules.d/40-usb-media-players.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-usb_modeswitch.rules' as rules file
...
parse_file: reading '/lib/udev/rules.d/42-qemu-usb.rules' as rules file
...
parse_file: reading '/lib/udev/rules.d/69-cd-sensors.rules' as rules file
add_rule: IMPORT found builtin 'usb_id', replacing /lib/udev/rules.d/69-cd-sensors.rules:76
...
parse_file: reading '/lib/udev/rules.d/77-mm-usb-device-blacklist.rules' as rules file
...
parse_file: reading '/lib/udev/rules.d/85-usbmuxd.rules' as rules file
...
parse_file: reading '/lib/udev/rules.d/95-upower-hid.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-wup.rules' as rules file
parse_file: reading '/lib/udev/rules.d/97-bluetooth-hid2hci.rules' as rules file
udev_rules_new: rules use 271500 bytes tokens (22625 * 12 bytes), 44331 bytes buffer
udev_rules_new: temporary index used 76320 bytes (3816 * 20 bytes)
udev_device_new_from_syspath: device 0x7f78a5e4d2d0 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/0003:0A81:0205.0001/hidraw/hidraw0'
udev_device_new_from_syspath: device 0x7f78a5e5f820 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/0003:0A81:0205.0001/hidraw/hidraw0'
udev_device_read_db: device 0x7f78a5e5f820 filled with db file data
udev_device_new_from_syspath: device 0x7f78a5e60270 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/0003:0A81:0205.0001'
udev_device_new_from_syspath: device 0x7f78a5e609c0 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0'
udev_device_new_from_syspath: device 0x7f78a5e61160 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1'
udev_device_new_from_syspath: device 0x7f78a5e61960 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2'
udev_device_new_from_syspath: device 0x7f78a5e62150 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1/1-1'
udev_device_new_from_syspath: device 0x7f78a5e62940 has devpath '/devices/pci0000:00/0000:00:1a.0/usb1'
udev_device_new_from_syspath: device 0x7f78a5e630f0 has devpath '/devices/pci0000:00/0000:00:1a.0'
udev_device_new_from_syspath: device 0x7f78a5e638a0 has devpath '/devices/pci0000:00'
udev_event_execute_rules: no node name set, will use kernel supplied name 'hidraw0'
udev_node_add: creating device node '/dev/hidraw0', devnum=251:0, mode=0600, uid=0, gid=0
udev_node_mknod: preserve file '/dev/hidraw0', because it has correct dev_t
udev_node_mknod: preserve permissions /dev/hidraw0, 020600, uid=0, gid=0
node_symlink: preserve already existing symlink '/dev/char/251:0' to '../hidraw0'
udev_device_update_db: created empty file '/run/udev/data/c251:0' for '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/0003:0A81:0205.0001/hidraw/hidraw0'
ACTION=add
DEVNAME=/dev/hidraw0
DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/0003:0A81:0205.0001/hidraw/hidraw0
MAJOR=251
MINOR=0
SUBSYSTEM=hidraw
UDEV_LOG=6
USEC_INITIALIZED=969079051

后面几行听起来好像已经存在了。但这些都没有唤醒键盘:

sudo udevadm trigger --verbose --sysname-match=usb*

/sys/devices/pci0000:00/0000:00:1a.0/usb1
/sys/devices/pci0000:00/0000:00:1a.0/usbmon/usbmon1
/sys/devices/pci0000:00/0000:00:1d.0/usb2
/sys/devices/pci0000:00/0000:00:1d.0/usbmon/usbmon2
/sys/devices/virtual/usbmon/usbmon0

sudo udevadm trigger --verbose --sysname-match=hidraw0

/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/0003:0A81:0205.0001/hidraw/hidraw0

sudo udevadm trigger

我也尝试过这个但没有成功(作为超级用户):

echo -n 0003:0A81:0205.0001 > /sys/bus/hid/drivers/generic-usb/bind
ksh: echo: write to 1 failed [No such device]

echo -n 0003:0A81:0205.0001 > /sys/bus/hid/drivers/generic-usb/unbind

echo -n 0003:0A81:0205.0001 > /sys/bus/hid/drivers/generic-usb/bind

echo usb1 >/sys/bus/usb/drivers/usb/unbind

echo usb1 >/sys/bus/usb/drivers/usb/bind

我还应该尝试什么才能通过发出命令获得与重新插入或暂停相同的结果?

答案1

这是解决方案:https://askubuntu.com/questions/48792/how-to-enable-an-extern-keyboard-using-ps2-to-usb-adapter-on-a-notebook

这种适配器有两种:第一种是简单地将一个插头换成另一个插头,另一种是针对信号进行工作的。

答案2

我也遇到了同样的问题。

解决方案(不确定根本原因,但这对我有用):

  1. 将 PS2 转 USB 从笔记本电脑上断开。
  2. 拆下键盘和鼠标。
  3. 只需将 PS2-USB 重新连接到笔记本电脑,然后插入键盘和鼠标即可。开始工作。根本原因尚不清楚。

答案3

听起来如果 BIOS 在 GRUB 中工作,它就能很好地看到键盘和鼠标。我有一个可能听起来违反直觉的建议。如果您的 BIOS 有该选项,则启用 PS/2 键盘和鼠标模拟。这样做的目的是让主板上的芯片中断来自任何 USB HID 设备的 USB 信号,并将其转换为操作系统可以看到的等效 PS/2 设备。此功能非常常见,因为主板制造商试图最大限度地减少端口数量,同时仍让那些运行不完全支持 USB 的操作系统的人感到满意。

使用 PS/2 转 USB 适配器在主板上模拟 PS/2 设备确实意味着需要进行两次转换才能回到起始位置,但这可能行得通。可能是适配器在转换过程中丢失了 USB 驱动程序无法理解的某些内容,但 BIOS 却能正常工作。因此,让 BIOS 来做这项工作吧。

另一个选择是尝试 USB 转串口适配器和 PS/2 串口驱动程序。我曾经在 Windows 和 Linux 的串口上使用过老式 PS/2 鼠标,但还没有真正尝试过键盘。您需要一个半能用的键盘或其他东西来设置它,听起来您有。如果您有串口和/或 USB 转串口适配器,那就试一试吧。

在尝试使用串行端口上的键盘之前,我建议先进行 BIOS 模拟,它更容易且更有可能工作,并且即使不工作也很容易恢复。另一方面,串行端口鼠标和键盘可能微不足道,也可能并非如此。

答案4

尝试编辑配置文件时,PS/2 键盘的行为非常不稳定(疯狂的重复按键,混合,上下垂直光标移动),完全混乱!PS/2 鼠标配置也不稳定,鼠标键的动作在每次重新连接时都会改变,导致 GUI 和 Web 浏览器通常无法使用!

好主意:注意使用有源 USB 集线器,在我的情况下,7 端口(5 个直接 + 2 个间歇充电)USB 集线器的 5 安培电源输出一次性解决了所有错误行为。此外,通过观察每个连接设备的相同电源要求并再次将所有设备保持在 5 安培总电流范围内,可以通过 USB 连接大容量 2.5 英寸硬盘。

(我搜索这个主题是因为我有 PS/2 鼠标和键盘,以及一个 PS/2 x2 母头连接器和一个 USB x1 公头连接器,还有连接电缆的适配器。自从 USB 开始取代 PS/2 以来,我就一直有这个适配器,我发现它仍然适用于原装 IBM 品牌的重型 claketty-clack 键盘,幸运的是,它还配有一个光学 3 键滚轮鼠标。永远不要扔掉任何东西。它总是会重新带来更便宜的使用机会!即使每个人都忘记了新技术和旧技术的不同功率要求及其后果)

谢谢。

相关内容