title: Enumerate USB flash drives programatically using libudev in Linux
body: <p>How can I programmatically enumerate all the USB flash drives using libudev under Linux? I want to get the strings such as '<code>/dev/sdb4</code>' so that I can then use '<code>mount()</code>' to mount them.</p>
  
  <p>I was following the libudev example at <a href="http://www.signal11.us/oss/udev/" rel="nofollow">http://www.signal11.us/oss/udev/</a>. The example code works well for '<code>hidraw</code>'; I then tried '<code>usb</code>', '<code>scsi_disk</code>', '<code>scsi_generic</code>', etc, but didn't work - it didn't list the 'device path' like '<code>/dev/sdb4</code>', it said '<code>Device Node Path: (null)</code>'.</p>