I have successfully set up a small program to create a uinput device which I plan to use to automate testing of an application receiving keyboard input events.
I have followed both tutorials as found in this very nice answer.
When my program creates the uinput device by calling ioctl(fd, UI_DEV_CREATE)
a new device appears in the file system so my application under test can attach to it and wait for events. My target system already has a /dev/input/event0
device so the new one gets the path /dev/input/event1
. If I compile and run the program for my desktop system, where there are existing devices /dev/input/event[0-15]
, when the program is run the new device gets /dev/input/event16
.
I'd like my program to report the new device name after creating it. Is there a way to get it?