title: How to get name (path) of uinput created device
body: <p>I have successfully set up a small program to create a <a href="/questions/tagged/uinput" class="post-tag" title="show questions tagged &#39;uinput&#39;" rel="tag">uinput</a> device which I plan to use to automate testing of an application receiving keyboard input events.</p>
  
  <p>I have followed <a href="http://thiemonge.org/getting-started-with-uinput" rel="nofollow noreferrer">both</a> <a href="https://web.archive.org/web/20120710121647/http://www.einfochips.com/download/dash_jan_tip.pdf" rel="nofollow noreferrer">tutorials</a> as found in this very nice <a href="https://unix.stackexchange.com/questions/14879/how-to-inject-keystrokes-via-a-shell-script">answer</a>.</p>
  
  <p>When my program creates the uinput device by calling <code>ioctl(fd, UI_DEV_CREATE)</code> 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 <code>/dev/input/event0</code> device so the new one gets the path <code>/dev/input/event1</code>. If I compile and run the program for my desktop system, where there are existing devices <code>/dev/input/event[0-15]</code>, when the program is run the new device gets <code>/dev/input/event16</code>.</p>
  
  <p>I'd like my program to report the new device name after creating it. Is there a way to get it?</p>