title: hidapi vs libusb for Linux
body: <p>Writing some C code for USB mouse.</p>
  
  <p>More specifically writing configuration and information to mouse like poll, sensitivity, button actions, colors (light), tactile alters, OLED etc.</p>
  
  <hr>
  
  <p>Started out with <a href="https://www.linuxjournal.com/article/8145" rel="noreferrer">this old article</a> where <code>libhid</code> is recommended over <code>libusb</code>.</p>
  
  <p>Looking at <a href="https://github.com/bfoz/libhid" rel="noreferrer">libhid</a> it seems to since have died. Last commit on that project is from 2012, - and it is C++. But I found some links saying one should go over to <code>hidapi</code>.</p>
  
  <p>However, <a href="https://github.com/signal11/hidapi" rel="noreferrer">hidapi</a> also seems to be fairly dead. Last commit from 2016. Or perhaps it is simply stable?</p>
  
  <p>It could look like one is better off using <code>libusb</code> after all. Starting out with a 15 year old article - it is not that much of a stretch.</p>
  
  <p><strong>Question is if I am missing something? Is <code>libusb</code> the way to go?</strong></p>
  
  <p>Have done some quick tests with <code>libusb-1.0.0-dev</code></p>
  
  <pre><code>#include &lt;libusb-1.0/libusb.h&gt;
  </code></pre>
  
  <p>and it works nice - at least for the quick tests I have done. But a HID library would perhaps be better?</p>
  
  <p>From native package options I have at least:</p>
  
  <pre><code>libhidapi-dev      
  libhidapi-libusb0  
  libhidrd0-dbg      
  libhidapi-hidraw0  
  libhidrd0          
  libhidrd0-dev
  </code></pre>
  
  <p>And</p>
  
  <pre><code>libusb-0.1-4                 libusbmuxd4
  libusb-1.0-0                 libusbmuxd-dev
  libusb-1.0-0-dev             libusbmuxd-tools
  libusb-1.0-doc               libusb-ocaml
  libusbauth-configparser1     libusb-ocaml-dev
  libusbauth-configparser-dev  libusbprog0v5
  libusb-dev                   libusbprog-dev
  libusbguard0                 libusbredirhost1
  libusbhid-common             libusbredirhost-dev
  libusb-java                  libusbredirparser1
  libusb-java-dbg              libusbredirparser-dev
  libusb-java-doc              libusbtc08-1
  libusb-java-lib              libusbtc08-dev
  </code></pre>