Xlib xinput test device status if it got hanged

293 views Asked by At

How to check if keyboard (for examle) is not hanged?

Maybe it is possible to send something to device and check response using pselect()?

I'm using xinput extensions (1,2) do they provide some facility for such a task?

1

There are 1 answers

1
yakupars On

I am currently looking for this. You can get the responding keyboards id by running this in bash.

kbname=$(cat /proc/bus/input/devices |
grep -Poi '(?<=N:\sName=")(.*keyboard.*)(?="$)') &&
xinput list |
grep -Poi '(?<='$kbname')(?:\s+id=\K)(\d+)'