Hi, please find below an update to blink-0.98a. This drops most of the patches as upstreamed (thanks to bluhm).
OK? Regards, Joerg Index: Makefile =================================================================== RCS file: /cvs/ports/misc/blink1/Makefile,v retrieving revision 1.5 diff -u -p -r1.5 Makefile --- Makefile 16 Mar 2016 16:46:32 -0000 1.5 +++ Makefile 9 Jan 2018 20:18:16 -0000 @@ -2,7 +2,7 @@ COMMENT = software tools for blink(1) LED notification light -V = 1.98 +V = 1.98a DISTNAME = ${GH_PROJECT}-${V} SO_V = 0.1 Index: distinfo =================================================================== RCS file: /cvs/ports/misc/blink1/distinfo,v retrieving revision 1.2 diff -u -p -r1.2 distinfo --- distinfo 23 Dec 2015 10:53:53 -0000 1.2 +++ distinfo 9 Jan 2018 20:18:16 -0000 @@ -1,2 +1,2 @@ -SHA256 (blink1-1.98.tar.gz) = K7+ISMPGVquPsBA1/TEQOjIfvuIBZGkc9n43BsS1CxY= -SIZE (blink1-1.98.tar.gz) = 29439933 +SHA256 (blink1-1.98a.tar.gz) = sMsN8zlejocXA2OUII+tKCW9GmmAJCuULjKR6fv5DP4= +SIZE (blink1-1.98a.tar.gz) = 29503155 Index: patches/patch-commandline_Makefile =================================================================== RCS file: /cvs/ports/misc/blink1/patches/patch-commandline_Makefile,v retrieving revision 1.2 diff -u -p -r1.2 patch-commandline_Makefile --- patches/patch-commandline_Makefile 23 Dec 2015 10:53:53 -0000 1.2 +++ patches/patch-commandline_Makefile 9 Jan 2018 20:18:16 -0000 @@ -1,90 +1,46 @@ $OpenBSD: patch-commandline_Makefile,v 1.2 2015/12/23 10:53:53 bluhm Exp $ - -todo: submit to upstream - ---- commandline/Makefile.orig Wed Sep 9 03:06:56 2015 -+++ commandline/Makefile Wed Dec 23 11:33:08 2015 -@@ -113,9 +113,13 @@ ifeq "$(UNAME)" "FreeBSD" - OS=freebsd - endif - -+ifeq "$(UNAME)" "OpenBSD" -+ OS=openbsd -+endif +Index: commandline/Makefile +--- commandline/Makefile.orig ++++ commandline/Makefile +@@ -124,7 +124,8 @@ endif + # allow overriding of GIT_TAG & BLINK1_VERSION on commandline for automated builds MACH_TYPE:="$(strip $(shell uname -m))" --GIT_TAG:="$(strip $(shell git tag 2>&1 | tail -1 | cut -f1 -d' '))" -+#GIT_TAG:="$(strip $(shell git tag 2>&1 | tail -1 | cut -f1 -d' '))" +-GIT_TAG?="$(strip $(shell git tag 2>&1 | tail -1 | cut -f1 -d' '))" ++#GIT_TAG?="$(strip $(shell git tag 2>&1 | tail -1 | cut -f1 -d' '))" +GIT_TAG:=${GH_TAGNAME} # 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" -@@ -278,6 +282,37 @@ INCLOCATION ?= $(PREFIX)/include +@@ -289,7 +290,7 @@ endif - endif - -+################# OpenBSD ################################################### -+ifeq "$(OS)" "openbsd" + ################# OpenBSD ################################################### + ifeq "$(OS)" "openbsd" +-LIBTARGET = libblink1.so +LIBTARGET = libblink1.so.${SO_V} -+# was blink1-lib.so -+ -+ifeq "$(USBLIB_TYPE)" "HIDAPI" -+CFLAGS += -DUSE_HIDAPI -+CFLAGS += -I./hidapi/hidapi -+OBJS = ./hidapi/libusb/hid.o -+CFLAGS += `pkg-config libusb-1.0 --cflags` -I/usr/local/include -fPIC -+LIBS += `pkg-config libusb-1.0 --libs` -L/usr/local/lib -lpthread -liconv -+endif -+ -+ifeq "$(USBLIB_TYPE)" "HIDDATA" -+CFLAGS += -DUSE_HIDDATA -+OBJS = ./hiddata.o -+CFLAGS += `pkg-config libusb --cflags` -fPIC -+LIBS += `pkg-config libusb --libs` -+endif -+ -+LIBFLAGS = -shared -o $(LIBTARGET) $(LIBS) -+EXE= -+ -+#INSTALL = install -+PREFIX ?= /usr/local -+EXELOCATION ?= $(PREFIX)/bin -+LIBLOCATION ?= $(PREFIX)/lib -+INCLOCATION ?= $(PREFIX)/include -+ -+endif -+ - ################# WRT Linux ################################################ - ifeq "$(OS)" "wrtlinux" - LIBTARGET = libblink1.so -@@ -371,7 +406,7 @@ endif + # was blink1-lib.so + + ifeq "$(USBLIB_TYPE)" "HIDAPI" +@@ -411,7 +412,7 @@ endif - #CFLAGS += -O -Wall -std=gnu99 -I ../hardware/firmware - CFLAGS += -std=gnu99 + #CFLAGS += -O -Wall -std=gnu99 -I ../hardware/firmware + CFLAGS += -std=gnu99 -CFLAGS += -g +#CFLAGS += -g CFLAGS += -DBLINK1_VERSION=\"$(BLINK1_VERSION)\" - OBJS += blink1-lib.o -@@ -389,6 +424,7 @@ help: - @echo "make OS=windows ... build Windows blink1-lib and blink1-tool" - @echo "make OS=linux ... build Linux blink1-lib and blink1-tool" - @echo "make OS=freebsd ... build FreeBSD blink1-lib and blink1-tool" -+ @echo "make OS=openbsd ... build OpenBSD blink1-lib and blink1-tool" - @echo "make OS=macosx ... build Mac OS X blink1-lib and blink1-tool" - @echo "make OS=wrt ... build OpenWrt blink1-lib and blink1-tool" - @echo "make OS=wrtcross... build for OpenWrt using cross-compiler" -@@ -409,7 +445,7 @@ $(OBJS): %.o: %.c + OBJS += blink1-lib.o +@@ -451,7 +452,7 @@ $(OBJS): %.o: %.c blink1-tool: $(OBJS) blink1-tool.o $(CC) $(CFLAGS) -c blink1-tool.c -o blink1-tool.o -- $(CC) $(CFLAGS) $(EXEFLAGS) -g $(OBJS) $(LIBS) blink1-tool.o -o blink1-tool$(EXE) -+ $(CC) $(CFLAGS) $(EXEFLAGS) $(OBJS) $(LIBS) blink1-tool.o -o blink1-tool$(EXE) +- $(CC) $(CFLAGS) $(EXEFLAGS) -g $(OBJS) $(LIBS) blink1-tool.o -o blink1-tool$(EXE) ++ $(CC) $(CFLAGS) $(EXEFLAGS) $(OBJS) $(LIBS) blink1-tool.o -o blink1-tool$(EXE) - # FIXME: verify we don't need MONGOOSE_LIBS and pthread & dl are avilable everywhere blink1-tiny-server: $(OBJS) server/blink1-tiny-server.c -@@ -428,9 +464,9 @@ package: lib blink1-tool - @#mkdir -f builds && cp blink1-tool-$(PKGOKS).zip builds + # $(CC) $(CFLAGS) -DMG_ENABLE_THREADS -I. -I./server/mongoose -c server/blink1-tiny-server.c -o blink1-tiny-server.o +@@ -473,9 +474,9 @@ package-tiny-server: blink1-tiny-server + zip blink1-tiny-server-$(PKGOS).zip blink1-tiny-server$(EXE) install: all - $(INSTALL) blink1-tool$(EXE) $(DESTDIR)$(EXELOCATION)/blink1-tool$(EXE) Index: patches/patch-commandline_blink1-lib-lowlevel-hidapi_h =================================================================== RCS file: patches/patch-commandline_blink1-lib-lowlevel-hidapi_h diff -N patches/patch-commandline_blink1-lib-lowlevel-hidapi_h --- patches/patch-commandline_blink1-lib-lowlevel-hidapi_h 23 Dec 2015 10:53:53 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,34 +0,0 @@ -$OpenBSD: patch-commandline_blink1-lib-lowlevel-hidapi_h,v 1.1 2015/12/23 10:53:53 bluhm Exp $ ---- commandline/blink1-lib-lowlevel-hidapi.h.orig Wed Sep 9 03:06:56 2015 -+++ commandline/blink1-lib-lowlevel-hidapi.h Wed Dec 23 00:00:26 2015 -@@ -20,8 +20,10 @@ int blink1_enumerateByVidPid(int vid, int pid) - if( (cur_dev->vendor_id != 0 && cur_dev->product_id != 0) && - (cur_dev->vendor_id == vid && cur_dev->product_id == pid) ) { - if( cur_dev->serial_number != NULL ) { // can happen if not root -- strcpy( blink1_infos[p].path, cur_dev->path ); -- sprintf( blink1_infos[p].serial, "%ls", cur_dev->serial_number); -+ strncpy( blink1_infos[p].path, cur_dev->path, -+ sizeof(blink1_infos[p].path)); -+ snprintf(blink1_infos[p].serial, sizeof(blink1_infos[p].serial), -+ "%ls", cur_dev->serial_number); - //wcscpy( blink1_infos[p].serial, cur_dev->serial_number ); - //uint32_t sn = wcstol( cur_dev->serial_number, NULL, 16); - uint32_t serialnum = strtol( blink1_infos[p].serial, NULL, 16); -@@ -104,7 +106,7 @@ blink1_device* blink1_openById( uint32_t i ) - LOG("blink1_openById: %d \n", i ); - if( i > blink1_max_devices ) { // then i is a serial number not an array index - char serialstr[serialstrmax]; -- sprintf( serialstr, "%X", i); // convert to wchar_t* -+ snprintf(serialstr, sizeof(serialstr), "%X", i); // convert to wchar_t* - return blink1_openBySerial( serialstr ); - } - else { -@@ -189,7 +191,7 @@ char *blink1_error_msg(int errCode) - case USBOPEN_ERR_NOTFOUND: return "The specified device was not found"; - case USBOPEN_ERR_IO: return "Communication error with device"; - default: -- sprintf(buf, "Unknown USB error %d", errCode); -+ snprintf(buf, sizeof(buf), "Unknown USB error %d", errCode); - return buf; - } - */ Index: patches/patch-commandline_blink1-lib-lowlevel-hiddata_h =================================================================== RCS file: patches/patch-commandline_blink1-lib-lowlevel-hiddata_h diff -N patches/patch-commandline_blink1-lib-lowlevel-hiddata_h --- patches/patch-commandline_blink1-lib-lowlevel-hiddata_h 23 Dec 2015 10:53:53 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,42 +0,0 @@ -$OpenBSD: patch-commandline_blink1-lib-lowlevel-hiddata_h,v 1.1 2015/12/23 10:53:53 bluhm Exp $ ---- commandline/blink1-lib-lowlevel-hiddata.h.orig Wed Sep 9 03:06:56 2015 -+++ commandline/blink1-lib-lowlevel-hiddata.h Wed Dec 23 00:00:37 2015 -@@ -15,7 +15,7 @@ char *blink1_error_msg(int errCode) - case USBOPEN_ERR_NOTFOUND: return "The specified device was not found"; - case USBOPEN_ERR_IO: return "Communication error with device"; - default: -- sprintf(buffer, "Unknown USB error %d", errCode); -+ snprintf(buffer, sizeof(buffer), "Unknown USB error %d", errCode); - return buffer; - } - return NULL; /* not reached */ -@@ -46,8 +46,10 @@ int blink1_enumerateByVidPid(int vid, int pid) - if( (cur_dev->vendor_id != 0 && cur_dev->product_id != 0) && - (cur_dev->vendor_id == vid && cur_dev->product_id == pid) ) { - if( cur_dev->serial_number != NULL ) { // can happen if not root -- strcpy( blink1_infos[p].path, cur_dev->path ); -- sprintf( blink1_infos[p].serial, "%ls", cur_dev->serial_number); -+ strncpy( blink1_infos[p].path, cur_dev->path, -+ sizeof(blink1_infos[p].path)); -+ snprintf(blink1_infos[p].serial, sizeof(blink1_infos[p].serial), -+ "%ls", cur_dev->serial_number); - //wcscpy( blink1_infos[p].serial, cur_dev->serial_number ); - //uint32_t sn = wcstol( cur_dev->serial_number, NULL, 16); - uint32_t serialnum = strtol( blink1_infos[p].serial, NULL, 16); -@@ -136,7 +138,7 @@ blink1_device* blink1_openById( uint32_t i ) - { - if( i > blink1_max_devices ) { // then i is a serial number not array index - char serialstr[serialstrmax]; -- sprintf( serialstr, "%X", i); // convert to wchar_t* -+ snprintf(serialstr, sizeof(serialstr), "%X", i); // convert to wchar_t* - return blink1_openBySerial( serialstr ); - } - else { -@@ -154,6 +156,7 @@ blink1_device* blink1_open(void) - LOG("blink1_open\n"); - if( rc != USBOPEN_SUCCESS ) { - LOG("cannot open: \n"); -+ static_dev = NULL; - } - return static_dev; - } Index: patches/patch-commandline_blink1-lib_c =================================================================== RCS file: patches/patch-commandline_blink1-lib_c diff -N patches/patch-commandline_blink1-lib_c --- patches/patch-commandline_blink1-lib_c 23 Dec 2015 10:53:54 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -$OpenBSD: patch-commandline_blink1-lib_c,v 1.1 2015/12/23 10:53:54 bluhm Exp $ ---- commandline/blink1-lib.c.orig Wed Sep 9 03:06:56 2015 -+++ commandline/blink1-lib.c Wed Dec 23 00:00:26 2015 -@@ -102,7 +102,7 @@ int blink1_getCacheIndexById( uint32_t i ) - { - if( i > blink1_max_devices ) { // then i is a serial number not an array index - char serialstr[serialstrmax]; -- sprintf( serialstr, "%X", i); // convert to wchar_t* -+ snprintf(serialstr, sizeof(serialstr), "%X", i); // convert to wchar_t* - return blink1_getCacheIndexBySerial( serialstr ); - } - return i; Index: patches/patch-commandline_blink1-tool_c =================================================================== RCS file: patches/patch-commandline_blink1-tool_c diff -N patches/patch-commandline_blink1-tool_c --- patches/patch-commandline_blink1-tool_c 23 Dec 2015 10:53:54 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,22 +0,0 @@ -$OpenBSD: patch-commandline_blink1-tool_c,v 1.1 2015/12/23 10:53:54 bluhm Exp $ ---- commandline/blink1-tool.c.orig Wed Sep 9 03:06:56 2015 -+++ commandline/blink1-tool.c Wed Dec 23 00:00:26 2015 -@@ -509,7 +509,7 @@ int main(int argc, char** argv) - dev = blink1_openById( deviceIds[0] ); - rc = blink1_getVersion(dev); - blink1_close(dev); -- sprintf(verbuf, ", fw version: %d", rc); -+ snprintf(verbuf, sizeof(verbuf), ", fw version: %d", rc); - } - msg("blink1-tool version: %s%s\n",BLINK1_VERSION,verbuf); - exit(0); -@@ -741,7 +741,8 @@ int main(int argc, char** argv) - do_rand =1; - } - char ledstr[16]; -- sprintf(ledstr, "#%2.2x%2.2x%2.2x", rgbbuf.r,rgbbuf.g,rgbbuf.b); -+ snprintf(ledstr, sizeof(ledstr), "#%2.2x%2.2x%2.2x", -+ rgbbuf.r,rgbbuf.g,rgbbuf.b); - msg("chase effect %d to %d (with %d leds), color %s, ", - led_start, led_end, chase_length, - ((do_rand) ? "random" : ledstr));