Suge
Suge

Reputation: 2897

How to detect which /dev/input/eventX is the touchpad in Android/Linux?

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!

Upvotes: 0

Views: 1795

Answers (2)

Guy
Guy

Reputation: 590

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.

Upvotes: 2

Renate
Renate

Reputation: 811

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.

Upvotes: 1

Related Questions