3

To be precise, when you plug in a USB storage device, it is loaded in sd something, but where is a usb keyboard loaded in /dev/?

2 Answers 2

3

Keyboards use event device files. You can find them in /dev/input/event*. To find the exact path you can egrep -i "keyboard.+\/dev" /var/log/Xorg.0.log

1

I know it's a little late to reply but I hope this is helpful for friends.

“mice” contains mouse input data, but to find the file related to the keyboards we need to check the files in folder “by-path”, keyboards file names end with “event-kbd”. We need to find the links to the keyboards, and then we can find the keyboards event file. The following commands can do this automatically for us:

kbdEvents=($(ls /dev/input/by-path | grep "event-kbd"))     
for forCounter in "${kbdEvents[@]}"
do
    eventFile=$(readlink --canonicalize "/dev/input/by-path/${forCounter}")     
    # do anything ...
done

This code is part of the code for the break time on my personal website : mazKnez.com

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .