How to compile with libusb?

In short the question is: how do I compile this command line tool:
I did compile it for linux PC and I have a working openwrt build environment. So I thought it should be possible. I put the source in a newly created folder package/utils/powerswitch. I copied the Makefile of a different utils folder, modified it for powerswitch. I solved a few problems but now it's stuck. It can't find the usb.h that is used by powerswitch.c. In its original Makefile (for linux PC) there is:

USBFLAGS = libusb-config --cflags
USBLIBS = libusb-config --libs #-framework CoreFoundation

How do I transform this for openwrt or how do I tell powerswitch.c where to find usb.h?

If you go through this material, you should find an answer....

The top few sections and the bottom few are most relevant to you.

NOTE: The actual paths may be different due to changes... but the principles are sound.

I finally managed to compile and create my first package. Your reply encouraged me to continue so thank you for that. However, I don't know how I found out that I needed a dependency on libusb-compat, I don't even know what that is, and creating the correct makefile is still utter magic to me. A tutorial would be helpful.
Anyway, as I said, I did create a package and although I feel far from being a developer and I didn't create the PowerSwitch software, should I now submit this package somehow so that others can include it in their firmware?

1 Like