Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何检查键盘(例如)是否没有挂起?
也许可以向设备发送一些东西并使用 pselect() 检查响应?
我正在使用 xinput 扩展 (1,2) 他们是否为这样的任务提供了一些便利?
我目前正在寻找这个。您可以通过在 bash 中运行它来获取响应的键盘 ID。
kbname=$(cat /proc/bus/input/devices | grep -Poi '(?<=N:\sName=")(.*keyboard.*)(?="$)') && xinput list | grep -Poi '(?<='$kbname')(?:\s+id=\K)(\d+)'