From the error I think you need to install the following package as well:
sudo apt-get install libhidapi-dev
Ok, that worked to make the correct file, when I try and open without a keyboard plugged in, I get a no controller found.
But when I plug in a known working keyboard, I get an error: couldn't open device. Could this be because of missing udev rules?
For it working without udev rules, only problem is, I have to run it with sudo
I'm glad to see you got it working.
Most likely when you plugged the keyboard with the xwhatsit controller into the computer whatever device it attached to was owned by root and/or belonged to a group that you didn't have read/write access to. So when you run the
ibm_capsense_usb_util program as yourself, you don't have permission to access the device. Using dmesg or lsusb may show what the device name is. You'll probably need to look at them anyway to find out the Vendor ID if you want to write a udev rule for it.
If you run ls -l in the /dev directory, you will see most devices are owned by root and belong to groups that you are also probably not a member of. I don't think it's a huge deal to use sudo here though.