maltepöggel.de

Using the USBFunk interface on OpenWRT

Crosscompiling the USBFunk console tool

To be able to control radio-controlled sockets via WLAN, some of you will surely have had this wish before. At another site I presented the USBFunk interface to send switching commands to 433MHz radio-controlled sockets via the USB interface of a computer.

Picture: USBFunk at a router

But it is not always necessary to use a whole PC for such small tasks. I would like to prove that in the simplest case also an old router with OpenWRT operating system can be used.

I don't want to go into details about the compilation process. This is well explained in the OpenWRT Wiki.

I assume that the OpenWRT source code has already been checked out from SVN and we are in the appropriate directory. However, since the USBFunk package is not an official part of the OpenWRT repository we now create a directory and reload the appropriate Makefile.

mkdir ./package/utils/usbfunk
wget http://maltepoeggel.de/data/usbfunk-openwrt/Makefile -P ./package/utils/usbfunk/

Afterwards the package selection has to be configured. We run the following command to do this:

make menuconfig

In the menu "Utilities" USBFunk is now selectable. With the space bar the package can be selected. If there is a the program will be built as an additional package. <*> means that the binary will be integrated into the read-only file system.

Picture: menuconfig

We confirm with Exit and save the configuration.

To build the single package we have to prepare the toolchain first:

make tools/install
make toolchain/install

Now the actual package (together with its dependencies) is built:

make package/usbfunk/compile
make package/usbfunk/install

If you want to compile the complete system instead, you could call make without the above paths. This takes a long time and is usually not necessary. As parameter you can add -j3 (dualcore CPU) or -j5 (quadcore CPU) to speed up the build process. If something fails, the compiler messages can be printed with the switch V=s.

make -j5

If there were no errors, we are back to the console at some point. The packages are located in bin/[targetarchitecture]/packages/. They can for example be copied via SFTP to the /tmp directory on the box, and installed from there using "opkg":

opkg install /tmp/libusb-1.0_1.0.9-1_ramips.ipk
opkg install /tmp/libusb-compat_0.1.4-1_ramips.ipk
opkg install /tmp/usbfunk_1.2-1_ramips.ipk

The CLI tool can now be started on the console of the OpenWRT device and the interface can be controlled as usual!

Picture: OpenWRT console

Good luck!

Downloads