I'm going to read the stream from touchpad, I know I can do it through /dev/input/eventX, but how can I determine which one represents the touchpad and which one represents the keypad?Thank you!
2 Answers 2
This is how I find the touchpad: look for the list of the id's of all devices.
xinput --list
Find the id of the touchpad. For example, my touchpad is in id=12 then
xinput --list-props 12 | grep "Device Node"
and it should show you the /dev/input/event* that you are looking for.
Comments
Use ioctl on the entries in /dev/input. The various functions seem to be sporadically implemented, but code=ioctl(fd, EVIOCGNAME(sizeof(buf)), buf); will give you a name at least.
Actually, only root can do iotctl on /dev. It's better to enumerate /sys/class/input and get the name entries.