Example code for interfacing with udisks2
Install the udisks development files
$ sudo apt install libudisks2-dev
Build the source
$ make
List info about the block devices on your system
$ ./query-block-devices
Detect when a device such as a USB thumb drive is plugged into or removed from your system
$ ./detect-hotplug
List info about the USB-attached storage on your system
$ ./probe-usb-devices