Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/todbot/blink1
Browse files Browse the repository at this point in the history
  • Loading branch information
todbot committed Jan 27, 2015
2 parents 14584ff + 35f2159 commit 5afcd3f
Show file tree
Hide file tree
Showing 216 changed files with 182,724 additions and 47,924 deletions.
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,29 @@ pip-log.txt
# Mac crap
.DS_Store

# tod stuff
#### tod stuff

# emacs
*~

# c build results
*.o
*.so

# java build results
*.class

# misc
*.pro
*.sav
*.pro.user*
*.a
*.def
*.dll
*.exp
/commandline/blink1-tool
/haskell/.cabal-sandbox/**/*
/commandline/blink1-lib-v1.95-linux-armv7l.zip
/commandline/blink1-tool-v1.95-linux-armv7l.zip
/haskell/Main
/haskell/Main.hi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ and is the primary user-level application for controlling blink(1).
It is an event-based system for triggering blink(1) color patterns.
Those events can be on your computer or on the Net.

Blin1kControl can receive events from:
Blink1Control can receive events from:
- [IFTTT](http://ifttt.com/channels)'s many channels
- IMAP/POP/GMAIL email services
- URLs containing text or JSON
Expand Down
17 changes: 17 additions & 0 deletions VERSIONS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# released versions.
# format: versionid - short description. one per line
# last line is most recent version
# comments begin with hash
v1.6 - beta builds of new Qt-based Blink1Control
v1.7 - Blink1Control w/ IFTTT fixes
v1.8 - Blink1Control w/ tracking color picker
v1.81 - Blink1Control smaller window & API server fixes
v1.82 - Blink1Control w/ non-Webkit help page
v1.83 - Blink1Control w/ device selection in config
v1.9 - Blink1Control with installers and new color patterns
v1.91 - Blink1Control Hardware tab fixes
v1.92 - internal release
v1.93 - Blink1Control Advanced Preferences, blink1control-tool, more API fixes
v1.94 - Blink1Control crashing fixes (device scanning, logging)
v1.95 - Blink1Control font size fix for high-DPI displays, blink1-mini-tool for OpenWrt systems

14 changes: 14 additions & 0 deletions chrome/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

Chrome support for blink(1)
=================

The projects in this directory were created before Chrome had proper USB HID support.

But as of Chrome 39.0.2140.0, Chrome supports USB HID devices like blink(1) really easily!

Check it out here:
https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/blink1

or in the Chrome Web Store:
https://chrome.google.com/webstore/detail/blink1/kcpjgiicabigbjejdjnkflkdkjknkdch

126 changes: 96 additions & 30 deletions commandline/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@
# Platform-specific notes:
#
# Mac OS X
# - Install Xcode with "Unix Dev Support" and "Command-line tools" (in Preferences)
# - Install XCode
# - In Terminal, "xcode-select --install" to install command-line tools
# - make
#
# Windows XP/7
# - Install MinGW and MSYS (http://www.tdragon.net/recentgcc/ )
# - make
#
# Linux (Ubuntu)
# - apt-get install build-essential pkg-config libusb-1.0-0-dev
# - apt-get install build-essential pkg-config libusb-1.0-0-dev
# - make
#
# Linux (Fedora 18+)
# - yum install make gcc
# - make EXEFLAGS= (yes, leave it blank)
# - make
#
# Linux (Fedora 17)
# - yum install make gcc libusb1-static glibc-static
Expand Down Expand Up @@ -58,7 +59,7 @@
# - exit
#
# Raspberry Pi
# - apt-get install libusb-1.0.0-dev
# - apt-get install build-essential pkg-config libusb-1.0.0-dev
# - make
#
# BeagleBone / BeagleBoard (on Angstrom Linux)
Expand All @@ -74,16 +75,20 @@
# "HIDAPI" type is best for Mac, Windows, Linux Desktop,
# but has dependencies on iconv, libusb-1.0, pthread, dl
#
# "HIDAPI_HIDRAW" uses udev instead of libusb
#
# "HIDDATA" type is best for low-resource Linux,
# and the only dependencies it has is libusb-0.1
#
# Try either on the commandline with "make USBLIB_TYPE=HIDDATA"
#

USBLIB_TYPE ?= HIDAPI
#USBLIB_TYPE = HIDAPI_HIDRAW
#USBLIB_TYPE = HIDDATA

# uncomment for debugging HID stuff
# or make with: CFLAGS=-DDEBUG_PRINTF make
#CFLAGS += -DDEBUG_PRINTF


Expand All @@ -107,24 +112,29 @@ ifeq "$(UNAME)" "FreeBSD"
endif


GIT_TAG="$(strip $(shell git tag | tail -1))"
MACH_TYPE="$(strip $(shell uname -m))"
MACH_TYPE:="$(strip $(shell uname -m))"
GIT_TAG:="$(strip $(shell git tag 2>&1 | tail -1 | cut -f1 -d' '))"
# deal with case of no git or no git tags, check for presence of "v" (i.e. "v1.93")
ifneq ($(findstring v,$(GIT_TAG)), v)
GIT_TAG:="v0"
endif

BLINK1_VERSION="$(GIT_TAG)-$(OS)-$(MACH_TYPE)"




################# Mac OS X ##################################################
ifeq "$(OS)" "macosx"
LIBTARGET = libBlink1.dylib
CFLAGS += -mmacosx-version-min=10.6
CFLAGS += -mmacosx-version-min=10.6
#CFLAGS += -fsanitize=address

ifeq "$(USBLIB_TYPE)" "HIDAPI"
CFLAGS += -DUSE_HIDAPI
CFLAGS += -arch i386 -arch x86_64
# don't need pthread with clang
#CFLAGS += -pthread
CFLAGS += -O2 -D_THREAD_SAFE -MT MD -MP
CFLAGS += -I./hidapi/hidapi
OBJS = ./hidapi/mac/hid.o
endif
Expand All @@ -145,8 +155,10 @@ LIBFLAGS = -dynamiclib -o $(LIBTARGET) -Wl,-search_paths_first $(LIBS)
EXE=

INSTALL = install -D
EXELOCATION ?= /usr/local/bin
LIBLOCATION ?= /usr/local/lib
PREFIX ?= /usr/local
EXELOCATION ?= $(PREFIX)/bin
LIBLOCATION ?= $(PREFIX)/lib
INCLOCATION ?= $(PREFIX)/include

endif

Expand Down Expand Up @@ -179,12 +191,15 @@ LIB_EXTRA = lib /machine:i386 /def:blink1-lib.def
INSTALL = cp
EXELOCATION ?= $(SystemRoot)/system32
LIBLOCATION ?= $(SystemRoot)/system32
# not sure where this really should point
INCLOCATION ?= $(SystemRoot)/system32

endif

################# Linux ####################################################
ifeq "$(OS)" "linux"
LIBTARGET = blink1-lib.so
LIBTARGET = libblink1.so
# was blink1-lib.so

ifeq "$(USBLIB_TYPE)" "HIDAPI"
CFLAGS += -DUSE_HIDAPI
Expand All @@ -194,26 +209,38 @@ CFLAGS += `pkg-config libusb-1.0 --cflags` -fPIC
LIBS += `pkg-config libusb-1.0 --libs` -lrt -lpthread -ldl
endif

ifeq "$(USBLIB_TYPE)" "HIDAPI_HIDRAW"
CFLAGS += -DUSE_HIDAPI
CFLAGS += -I./hidapi/hidapi
OBJS = ./hidapi/linux/hid.o
CFLAGS += `pkg-config libusb-1.0 --cflags` -fPIC
LIBS += `pkg-config libusb-1.0 --libs` `pkg-config libudev --libs` -lrt
endif

ifeq "$(USBLIB_TYPE)" "HIDDATA"
CFLAGS += -DUSE_HIDDATA
OBJS = ./hiddata.o
CFLAGS += `pkg-config libusb --cflags` -fPIC
LIBS += `pkg-config libusb --libs`
endif

EXEFLAGS = -static
# static doesn't work on Ubuntu 13+
#EXEFLAGS = -static
LIBFLAGS = -shared -o $(LIBTARGET) $(LIBS)
EXE=

INSTALL = install -D
EXELOCATION ?= /usr/local/bin
LIBLOCATION ?= /usr/local/lib
PREFIX ?= /usr/local
EXELOCATION ?= $(PREFIX)/bin
LIBLOCATION ?= $(PREFIX)/lib
INCLOCATION ?= $(PREFIX)/include

endif

################ FreeBSD ###################################################
ifeq "$(OS)" "freebsd"
LIBTARGET = blink1-lib.so
LIBTARGET = libblink1.so
# was blink1-lib.so

ifeq "$(USBLIB_TYPE)" "HIDAPI"
CFLAGS += -DUSE_HIDAPI
Expand Down Expand Up @@ -241,14 +268,16 @@ LIBFLAGS = -shared -o $(LIBTARGET) $(LIBS)
EXE=

INSTALL = install -D
EXELOCATION ?= /usr/local/bin
LIBLOCATION ?= /usr/local/lib
PREFIX ?= /usr/local
EXELOCATION ?= $(PREFIX)/bin
LIBLOCATION ?= $(PREFIX)/lib
INCLOCATION ?= $(PREFIX)/include

endif

################# WRT Linux ################################################
ifeq "$(OS)" "wrt"
LIBTARGET = blink1-lib.so
ifeq "$(OS)" "wrtlinux"
LIBTARGET = libblink1.so

# HIDAPI build doesn't work, use HIDDATA instead
ifeq "$(USBLIB_TYPE)" "HIDAPI"
Expand All @@ -274,24 +303,56 @@ EXE=

endif

############## Cross-compile WRT Linux #####################################
ifeq "$(OS)" "wrtcross"
############## Cross-compile WRT Linux for Arduino Yun #####################
ifeq "$(OS)" "yun"
LIBTARGET = libblink1.so

ifeq "$(USBLIB_TYPE)" "HIDDATA"
#ifeq "$(USBLIB_TYPE)" "HIDDATA"
CFLAGS += -DUSE_HIDDATA
OBJS = ./hiddata.o

WRT_SDK_HOME := $(HOME)/projects/openwrt/sdk/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1
CC = $(WRT_SDK_HOME)/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/mips-openwrt-linux-gcc
LD = $(WRT_SDK_HOME)/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/mips-openwrt-linux-ld
CFLAGS += "-I$(WRT_SDK_HOME)/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/include" -fPIC
LIBS += "$(WRT_SDK_HOME)/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib/libusb.a"
#LDFLAGS += -static
WRT_SDK_HOME := $(HOME)/openwrt/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2
WRT_TOOLCHAIN_ROOT=$(strip $(shell ls -d $(WRT_SDK_HOME)/staging_dir/toolchain-* | tail -1))
WRT_TARGET_ROOT=$(strip $(shell ls -d $(WRT_SDK_HOME)/staging_dir/target-* | tail -1))
STAGING_DIR=$(WRT_SDK_HOME)/staging_dir

CC = $(WRT_TOOLCHAIN_ROOT)/bin/mips-openwrt-linux-gcc
LD = $(WRT_TOOLCHAIN_ROOT)/bin/mips-openwrt-linux-ld
CFLAGS += -I$(WRT_TARGET_ROOT)/usr/include
LIBS += -L$(WRT_TARGET_ROOT)/usr/lib -lusb -lusb-1.0
export STAGING_DIR=$$(STAGING_DIR)

#endif

#EXEFLAGS = -static
LIBFLAGS = -o $(LIBTARGET) $(LIBS)
EXE=

endif

############## Cross-compile WRT Linux #####################################
ifeq "$(OS)" "wrt"
LIBTARGET = libblink1.so

#ifeq "$(USBLIB_TYPE)" "HIDDATA"
CFLAGS += -DUSE_HIDDATA
OBJS = ./hiddata.o

WRT_SDK_HOME := $(HOME)/openwrt/OpenWrt-SDK-brcm47xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2
WRT_TOOLCHAIN_ROOT=$(strip $(shell ls -d $(WRT_SDK_HOME)/staging_dir/toolchain-* | tail -1))
WRT_TARGET_ROOT=$(strip $(shell ls -d $(WRT_SDK_HOME)/staging_dir/target-* | tail -1))
STAGING_DIR=$(WRT_SDK_HOME)/staging_dir

CC = $(WRT_TOOLCHAIN_ROOT)/bin/mips*-openwrt-linux-gcc
LD = $(WRT_TOOLCHAIN_ROOT)/bin/mips*-openwrt-linux-ld
CFLAGS += -I$(WRT_TARGET_ROOT)/usr/include
LIBS += -L$(WRT_TARGET_ROOT)/usr/lib -lusb -lusb-1.0
export STAGING_DIR=$$(STAGING_DIR)

#endif

EXEFLAGS = -static
LIBFLAGS = -shared -o $(LIBTARGET) $(LIBS)
#LIBFLAGS = -shared -o $(LIBTARGET) $(LIBS)
EXE=

endif
Expand Down Expand Up @@ -333,7 +394,7 @@ help:
@echo

msg:
@echo "Building for OS=$(OS) BLINK1_VERSION=$(BLINK1_VERSION)"
@echo "Building for OS=$(OS) BLINK1_VERSION=$(BLINK1_VERSION) USBLIB_TYPE=$(USBLIB_TYPE)"


$(OBJS): %.o: %.c
Expand Down Expand Up @@ -362,6 +423,7 @@ package: lib blink1-tool
install: all
$(INSTALL) blink1-tool$(EXE) $(DESTDIR)$(EXELOCATION)/blink1-tool$(EXE)
$(INSTALL) $(LIBTARGET) $(DESTDIR)$(LIBLOCATION)/$(LIBTARGET)
$(INSTALL) blink1-lib.h $(DESTDIR)$(INCLOCATION)/blink1-lib.h

.PHONY: install

Expand All @@ -370,11 +432,15 @@ clean:
rm -f $(LIBTARGET)
rm -f blink1-tiny-server.o blink1-tool.o hiddata.o
rm -f server/mongoose/mongoose.o
rm -f blink1-tool$(EXE) blink1-tiny-server$(EXE)

distclean: clean
rm -f blink1-tool$(EXE)
rm -f blink1-tiny-server$(EXE)
rm -f $(LIBTARGET) $(LIBTARGET).a
#rm blink1-lib.{a,lib,exp,dll,def}
rm libblink1.so
rm blink1-tool.exe

# show shared library use
# in general we want minimal to no dependecies for blink1-tool
Expand Down
Loading

0 comments on commit 5afcd3f

Please sign in to comment.