title: libusb: error [op_open] getcap failed in C++ on Linux
body: <p>I am running into trouble calling <code>libusb_open</code> in C++ on Linux (running on Raspberry Pi but virtualized to x86 using Exagear).</p>
  <p>I can find a device using <code>libusb_get_device_list</code> but it appears translating a device to a device handler using <code>libusb_open</code> is causing problems, even though it returns a 0 (success), however no further commands work. It is giving me the error:</p>
  <pre><code>libusb: error [op_open] getcap failed (22)
  </code></pre>
  <p><strong>UPDATE</strong></p>
  <p>A little bit of digging has revealed that the following command is producing the error (within libusb):</p>
  <pre><code>r = ioctl(hpriv-&gt;fd, IOCTL_USBFS_GET_CAPABILITIES, &amp;hpriv-&gt;caps);
  </code></pre>
  <p>where <code>IOCTL_USBFS_GET_CAPABILITIES</code> is <code>_IOR('U', 26, __u32)</code>. Digging has revealed that <code>error 22</code> from <code>ioctl</code> is an invalid argument. I'm still trying to unpick this, but any help here is greatly appreciated.</p>