We use Spacenav for interfacing with 3Dconnexion's input devices (like the SpaceNavigator 6 DOF mouse).
Official page: link.
Install Spacenav (Ubuntu)#
You'll get the development files from:
sudo apt install libspnav-dev spacenavd
spacenavd package in case you don't want to install the daemon (e.g. you won't connect the device to your PC).