blink(1) を動かすまで

2020/04/18

blink(1) を Fedora17 で動かした時の備忘録。

1. デバイスを一般ユーザーが扱えるようにする

$ cd blink1/linux
$ sudo cp 51-blink1.rules /etc/udev/rules.d/
$ sudo udevadm control –reload-rules

2. コマンドラインツールを make

$ git clone https://github.com/todbot/blink1.git
$ sudo yum install libusb1-devel
$ sudo yum install glibc-devel glibc-static
$ sudo yum groupinstall "Development Libraries"
$ cd blink1/commandline/
$ make

3. コマンドラインツールを実行すると使い方が出る

$ ./blink1-tool

Usage: 
  blink1-tool <cmd> [options]
where <cmd> is one of:
  --blink <numtimes>          Blink on/off (specify --rgb before to blink a color)
  --random <numtimes>         Flash a number of random colors 
  --rgb <red>,<green>,<blue>  Fade to RGB value
  --on                        Turn blink(1) full-on white 
  --off                       Turn blink(1) off 
  --red                       Turn blink(1) red 
  --green                     Turn blink(1) green 
  --blue                      Turn blink(1) blue 
  --savergb <r>,<g>,<b>,<pos> Write pattern RGB value at pos
  --readrgb <pos>             Read pattern RGB value at pos
  --play <1/0,pos>            Start playing color sequence (at pos)
  --servertickle <1/0>        Turn on/off servertickle (uses -t msec) 
  --list                      List connected blink(1) devices 
 Nerd functions: (not used normally) 
  --hidread                   Read a blink(1) USB HID GetFeature report 
  --hidwrite <listofbytes>    Write a blink(1) USB HID SetFeature report 
  --eeread <addr>             Read an EEPROM byte from blink(1)
  --eewrite <addr>,<val>      Write an EEPROM byte to blink(1) 
  --version                   Display blink(1) firmware version 
and [options] are: 
  -d dNums --id all|deviceIds Use these blink(1) ids (from --list) 
  -g -nogamma                 Disable autogamma correction
  -m ms,   --millis=millis    Set millisecs for color fading (default 300)
  -q, --quiet                 Mutes all stdout output (supercedes --verbose)
  -t ms,   --delay=millis     Set millisecs between events (default 500)
  --vid=vid --pid=pid         Specifcy alternate USB VID & PID
  -v, --verbose               verbose debugging msgs

Examples 
  blink1-tool -m 100 --rgb 255,0,255    # fade to #FF00FF in 0.1 seconds 
  blink1-tool -t 2000 --random 100      # every 2 seconds new random color
  blink1-tool --rgb 0xff,0,00 --blink 3 # blink red 3 times

4. コマンドラインツールを試してみる

$ ./blink1-tool -t 2000 --random 100
$ ./blink1-tool --off