I’m not sure where or from whom I heard about this little device, but when I saw it and read some of the possible uses, the geek in me would not rest until I had one. So last week I finally ordered one of the new blink(1) LED USB devices from ThingM.
It came in a nice little (magnetically closed) box, inside a padded envelope, inside another padded envelope. Not much too it, so open it up, plug it in, and… search for the next step as there are no directions in the box
Snooping through their online documentation led me to a download site which contained the blink1-tool application, compiled for 64 linux. So far, so good. Downloaded it and unzipped it. Running it without arguments offered a variety of options, so I tried a few. Surprisingly, all failed with the “no blink(1) devices found” error.
A bit of searching on the web led to various posts of folks with the same error, several of which indicated that the issue might be caused by the fact that my user did not have permissions to the device. After trying several of the command with sudo also failed, I gave up on that course of action.
Another poster indicated that compiling the blink1-tool led to a working version, so I promptly cloned a copy of their git repo and after reading their brief help info, saw that libusb-1.0 needed to be installed. No worries:
|
1 |
sudo yum install libusb1-devel |
Running ‘make’ at this point showed that ld could not find several libraries. I tried to cherry pick the necessary libs, but in the end I simply installed Fedora’s Devlopment Libraries group:
|
1 |
sudo yum groupinstall "Development Libraries" |
Running ‘make’ again yielded the following:
building for OS=linux
gccpkg-config libusb-1.0 --cflags-fPIC -std=gnu99 -I ../hardware/firmware -I./hidapi/hidapi -I./mongoose -g -c blink1-tool.c -o blink1-tool.o
gccpkg-config libusb-1.0 --cflags-fPIC -std=gnu99 -I ../hardware/firmware -I./hidapi/hidapi -I./mongoose -g -static -g ./hidapi/libusb/hid.o blink1-lib.opkg-config libusb-1.0 --libs-lrt -lpthread -ldl blink1-tool.o -o blink1-tool
/usr/bin/ld: cannot find -lusb-1.0
At this point, after finding no on-point answer on the web, I tried symlinking both ‘libusb.so’ and ‘libusb-1.0.so’ to /usr/lib/libusb-1.0.so.0 (the lib installed above). Nada… same error. More searches, no answers.
Finally, after running through all of the steps again, I noticed that there was another libusb1 devel package available: libusb1-static (at this point, all of the C programmers are going, “well duh”). Installing that package and trying make again led to a successful compile!
So while I still need to tweak udev to allow a normal user access to the device, (see below) at least blink1-tool is able to properly cause the device to light up (and change colors). On to trying to write something useful for it now.
So, hoping that others who may run into the same issues might be saved a bit of time and frustration, here are what I believe are all of the necessary steps to compile blink1-tool on Fedora 17 x64:
Install required libraries (note: I do not know if glibc-devel and/or glibc-static are included in the Development Libraries group, as I installed them as part of the cherry picking step – How does one list the packages in a group?)
|
1 2 |
sudo yum install glibc-devel glibc-static libusb1-devel libusb1-static sudo yum groupinstall "Development Libraries" |
Clone the repo, change into the directory and begin compilation:
|
1 2 3 |
git clone https://github.com/todbot/blink1.git cd blink1/commandline make |
Test:
|
1 2 3 |
./blink1-tool # Outputs help sudo ./blink1-tool -t 2000 --random 10 # Causes the blink(1) to change to 10 random colors, at 2 sec intervals sudo ./blink1-tool --off |
Anyone with information on the proper udev (or other) config to stop the ‘sudo’ requirement is appreciated. Many thanks to larcher for posting the link to the udev file. I hadn’t looked there yet. So for those who reached this point, to allow a regular user to control the device, the steps mentioned in his comment should work for you. Here are examples of the commands I used:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# Using the cloned git repo sudo cp blink1/commandline/hidapi/udev/99-hid-rules /etc/udev/rules.d/99-blink1.rules # check 'dmesg' for the details of your device, and edit that file appropriately # My dmesg: [401643.717978] usb 2-1.2: New USB device found, idVendor=27b8, idProduct=01ed # # So my updated line in the 99-blink1.rules file SUBSYSTEM=="usb", ATTRS{idVendor}=="27b8", ATTRS{idProduct}=="01ed", MODE="0666" # Comment out the 'KERNEL==' line # KERNEL=="hidraw*", ATTRS{busnum}=="1", ATTRS{idVendor}=="04d8" ... # Restart udev sudo udevadm control --reload |
At this point, reconnecting your blink(1) device should allow you to control it as a regular user: blink1-tool –rgb 0xff,0,00 –blink 3
Good luck!
N.B. These instructions were written using Fedora 17, but they should work with most distros, e.g. RedHat, Ubuntu, etc by simply changing the necessary installed package names to those used on your system. I was unable to build this on Fedora 18 beta as it looks like it is not possible (today) to install the Development Tools group due to issues with the included rpm package.






