usbutils – USB userspace utilities for Linux, how to compile, install and use on Ubuntu

Clone the source code using below command,

 $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usbutils.git 
 $ cd usbutils/ 

first get usbhid-dump :

 $ git submodule init 

Submodule ‘usbhid-dump’ (https://github.com/DIGImend/usbhid-dump.git) registered for path ‘usbhid-dump’

 $ git submodule update 

initialize autobuild with:

 $ autoreconf --install --symlink 

Create an temporary directory if you just want to compile and install in local folder instead of standard directories like /usr/bin etc,

 $ mkdir out 

configure with:

 $ ./configure --prefix=/home/devbee/wp/usbutils 

Above command generated an error like below,

checking pkg-config is at least version 0.9.0… yes
checking for LIBUSB… no
configure: error: Package requirements (libusb-1.0 >= 1.0.9) were not met:

No package ‘libusb-1.0’ found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBUSB_CFLAGS
and LIBUSB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Which means our ubuntu is lacking libusb installation.

You can check the currently installed libusb version as,

 $ dpkg -l libusb* 

Make sure you have both of the below packages installed,

 sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev 

After running configure command, we got following error,

checking for UDEV… no
configure: error: Package requirements (libudev >= 196) were not met:

No package ‘libudev’ found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables UDEV_CFLAGS
and UDEV_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

 sudo apt-get install libudev-dev 
 $ ./configure --prefix=/home/devbee/wp/usbutils/out 

Now compile with:

 $ make 

and install as,

 $ make install 
$ tree out/
out/
├── bin
│   ├── lsusb
│   ├── lsusb.py
│   ├── usb-devices
│   └── usbhid-dump
└── share └── man ├── man1 │   └── usb-devices.1 └── man8 ├── lsusb.8 └── usbhid-dump.8
5 directories, 7 files
READ  Configure host ( PC / Laptop ) bluetooth device on ubuntu using hciconfig

Leave a Reply

Your email address will not be published. Required fields are marked *