Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 2019 00:38:02 +0000 (UTC)
From:      Li-Wen Hsu <lwhsu@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r512996 - in head: . comms comms/ebusd comms/ebusd/files
Message-ID:  <201909270038.x8R0c2Vr080643@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lwhsu
Date: Fri Sep 27 00:38:02 2019
New Revision: 512996
URL: https://svnweb.freebsd.org/changeset/ports/512996

Log:
  Add comms/ebusd, daemon for communication with eBUS heating systems
  
  PR:		239796
  Submitted by:	samm@os2.kiev.ua

Added:
  head/comms/ebusd/
  head/comms/ebusd/Makefile   (contents, props changed)
  head/comms/ebusd/distinfo   (contents, props changed)
  head/comms/ebusd/files/
  head/comms/ebusd/files/ebusd.in   (contents, props changed)
  head/comms/ebusd/files/patch-configure.ac   (contents, props changed)
  head/comms/ebusd/files/patch-src_lib_ebus_device.cpp   (contents, props changed)
  head/comms/ebusd/files/patch-src_lib_ebus_device.h   (contents, props changed)
  head/comms/ebusd/files/patch-src_lib_utils_tcpsocket.h   (contents, props changed)
  head/comms/ebusd/pkg-descr   (contents, props changed)
  head/comms/ebusd/pkg-message   (contents, props changed)
  head/comms/ebusd/pkg-plist   (contents, props changed)
Modified:
  head/GIDs
  head/UIDs
  head/comms/Makefile

Modified: head/GIDs
==============================================================================
--- head/GIDs	Fri Sep 27 00:17:31 2019	(r512995)
+++ head/GIDs	Fri Sep 27 00:38:02 2019	(r512996)
@@ -794,7 +794,7 @@ qbittorrent:*:850:
 cassandra:*:851:
 p0f:*:852:
 _geodns:*:853:
-# free: 854
+ebusd:*:854:
 # free: 855
 # free: 856
 # free: 857

Modified: head/UIDs
==============================================================================
--- head/UIDs	Fri Sep 27 00:17:31 2019	(r512995)
+++ head/UIDs	Fri Sep 27 00:38:02 2019	(r512996)
@@ -799,7 +799,7 @@ qbittorrent:*:850:850::0:0:qBittorrent Daemon User:/va
 cassandra:*:851:851::0:0:Cassandra DB Daemon User:/var/db/cassandra:/usr/sbin/nologin
 p0f:*:852:852::0:0:p0f unprivileged user:/var/empty:/usr/sbin/nologin
 _geodns:*:853:853::0:0:GeoDNS User:/var/empty:/usr/sbin/nologin
-# free: 854
+ebusd:*:854:854::0:0:eBUS Daemon user:/nonexistent:/usr/sbin/nologin
 # free: 855
 # free: 856
 # free: 857

Modified: head/comms/Makefile
==============================================================================
--- head/comms/Makefile	Fri Sep 27 00:17:31 2019	(r512995)
+++ head/comms/Makefile	Fri Sep 27 00:38:02 2019	(r512996)
@@ -39,6 +39,7 @@
     SUBDIR += dump1090
     SUBDIR += ebook2cw
     SUBDIR += ebook2cwgui
+    SUBDIR += ebusd
     SUBDIR += echolinux
     SUBDIR += efax
     SUBDIR += ems-flasher

Added: head/comms/ebusd/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/Makefile	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,47 @@
+# $FreeBSD$
+
+PORTNAME=	ebusd
+PORTVERSION=	3.3
+CATEGORIES=	comms
+
+MAINTAINER=	samm@os2.kiev.ua
+COMMENT=	Daemon for communication with eBUS heating systems
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+LIB_DEPENDS=	libargp.so:devel/argp-standalone
+
+USES=		autoreconf localbase:ldflags
+
+OPTIONS_DEFINE=	MQTT
+OPTIONS_DEFAULT=MQTT
+MQTT_DESC=	MQTT protocol support
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	john30
+GH_TAGNAME=	v${PORTVERSION}
+
+USE_RC_SUBR=	ebusd
+
+USERS=		ebusd
+GROUPS=		ebusd
+
+LOGDIR=		/var/log/${PORTNAME}
+RUNDIR=		/var/run/${PORTNAME}
+CPPFLAGS+=	-I${LOCALBASE}/include
+GNU_CONFIGURE=	yes
+
+PLIST_SUB=	USER=${USERS} GROUP=${GROUPS} \
+		LOGDIR=${LOGDIR} \
+		RUNDIR=${RUNDIR}
+
+MQTT_CONFIGURE_WITH=	mqtt
+MQTT_LIB_DEPENDS=	libmosquitto.so:net/mosquitto
+MQTT_VARS=		LIBS+=-lmosquitto
+
+post-install:
+	${MKDIR} ${STAGEDIR}${LOGDIR}
+	${MKDIR} ${STAGEDIR}${RUNDIR}
+
+.include <bsd.port.mk>

Added: head/comms/ebusd/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/distinfo	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1565559816
+SHA256 (john30-ebusd-3.3-v3.3_GH0.tar.gz) = 48669140cfafbe060c765b4530018b30f07e1b074dbce00b205a8f2a22dee573
+SIZE (john30-ebusd-3.3-v3.3_GH0.tar.gz) = 696172

Added: head/comms/ebusd/files/ebusd.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/files/ebusd.in	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# $FreeBSD$
+# 
+# PROVIDE: ebusd
+# REQUIRE: LOGIN cleanvar
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable ebusd:
+#
+#ebusd_enable (bool): set to "YES" to start domotics at boot
+#ebusd_user (str):    Default to ebusd, user for starting ebusd
+#ebusd_group (str):   Default to ebusd, group for stating ebusd
+#ebusd_pidfile (str): Custum PID file path and name
+#                        Default to "/var/run/ebusd/${hostname}.pid".
+#ebusd_args (str):    Custom additional arguments to be passed
+#                        Default to "-d /dev/ttyU0 --scanconfig --localhost"
+
+. /etc/rc.subr
+
+name="ebusd"
+rcvar="ebusd_enable"
+
+load_rc_config $name
+
+: ${ebusd_user:=ebusd}
+: ${ebusd_group:=ebusd}
+: ${ebusd_enable:=NO}
+: ${ebusd_args:="-d /dev/ttyU0 --scanconfig --localhost"}
+
+pidfile=${ebusd_pidfile:-"/var/run/ebusd/${hostname}.pid"}
+
+command="%%PREFIX%%/bin/ebusd"
+command_args="--pidfile ${pidfile} ${ebusd_args}"
+
+run_rc_command "$1"

Added: head/comms/ebusd/files/patch-configure.ac
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/files/patch-configure.ac	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,19 @@
+--- configure.ac.orig	2018-12-26 15:38:15 UTC
++++ configure.ac
+@@ -36,6 +36,7 @@ AC_SUBST(EXTRA_LIBS)
+ AC_CHECK_FUNC([pselect], [AC_DEFINE(HAVE_PSELECT, [1], [Defined if pselect() is available.])])
+ AC_CHECK_FUNC([ppoll], [AC_DEFINE(HAVE_PPOLL, [1], [Defined if ppoll() is available.])])
+ AC_CHECK_HEADER([linux/serial.h], [AC_DEFINE(HAVE_LINUX_SERIAL, [1], [Defined if linux/serial.h is available.])])
++AC_CHECK_HEADER([dev/usb/uftdiio.h], [AC_DEFINE(HAVE_FREEBSD_UFTDI, [1], [Defined if dev/usb/uftdiio.h is available.])])
+ 
+ AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable code coverage tracking]), [CXXFLAGS+=" -coverage -O0"], [])
+ AC_ARG_WITH(contrib, AS_HELP_STRING([--without-contrib], [disable inclusion of contributed sources]), [], [with_contrib=yes])
+@@ -118,7 +119,7 @@ AM_COND_IF([CONTRIB], [AC_CONFIG_FILES([
+ 	])])
+ 
+ AC_DEFINE_UNQUOTED(PACKAGE_PIDFILE, LOCALSTATEDIR "/run/" PACKAGE ".pid", [The path and name of the PID file.])
+-AC_DEFINE_UNQUOTED(PACKAGE_LOGFILE, LOCALSTATEDIR "/log/" PACKAGE ".log", [The path and name of the log file.])
++AC_DEFINE_UNQUOTED(PACKAGE_LOGFILE, LOCALSTATEDIR "/log/" PACKAGE "/" PACKAGE ".log", [The path and name of the log file.])
+ AC_DEFINE(SCAN_VERSION, "[m4_esyscmd_s([sed -e 's#^\([0-9]*\.[0-9]*\).*#\1#' -e 's#\.\([0-9]\)$#0\1#' -e 's#\.##' VERSION])]", [The version of the package formatted for the scan result.])
+ AC_DEFINE(REVISION, "[m4_esyscmd_s([git describe --always 2>/dev/null || (date +p%Y%m%d)])]", [The revision of the package.])
+ 

Added: head/comms/ebusd/files/patch-src_lib_ebus_device.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/files/patch-src_lib_ebus_device.cpp	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,59 @@
+--- src/lib/ebus/device.cpp.orig	2018-12-26 15:38:15 UTC
++++ src/lib/ebus/device.cpp
+@@ -30,6 +30,9 @@
+ #ifdef HAVE_LINUX_SERIAL
+ #  include <linux/serial.h>
+ #endif
++#ifdef HAVE_FREEBSD_UFTDI
++#  include <dev/usb/uftdiio.h>
++#endif
+ #include <errno.h>
+ #ifdef HAVE_PPOLL
+ #  include <poll.h>
+@@ -192,7 +195,7 @@ result_t SerialDevice::open() {
+   struct termios newSettings;
+ 
+   // open file descriptor
+-  m_fd = ::open(m_name, O_RDWR | O_NOCTTY);
++  m_fd = ::open(m_name, O_RDWR | O_NOCTTY | O_NDELAY);
+ 
+   if (m_fd < 0) {
+     return RESULT_ERR_NOTFOUND;
+@@ -215,13 +218,24 @@ result_t SerialDevice::open() {
+   }
+ #endif
+ 
++#ifdef HAVE_FREEBSD_UFTDI
++  int param = 0;
++  // flush tx/rx and set low latency on uftdi device
++  if (ioctl(m_fd, UFTDIIOC_GET_LATENCY, &param) == 0) {
++    ioctl(m_fd, UFTDIIOC_RESET_IO, &param);
++    param = 1;
++    ioctl(m_fd, UFTDIIOC_SET_LATENCY, &param);
++  }
++#endif
++
+   // save current settings
+   tcgetattr(m_fd, &m_oldSettings);
+ 
+   // create new settings
+   memset(&newSettings, 0, sizeof(newSettings));
+ 
+-  newSettings.c_cflag |= (B2400 | CS8 | CLOCAL | CREAD);
++  cfsetspeed(&newSettings, B2400);
++  newSettings.c_cflag |= (CS8 | CLOCAL | CREAD);
+   newSettings.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);  // non-canonical mode
+   newSettings.c_iflag |= IGNPAR;  // ignore parity errors
+   newSettings.c_oflag &= ~OPOST;
+@@ -234,7 +248,10 @@ result_t SerialDevice::open() {
+   tcflush(m_fd, TCIFLUSH);
+ 
+   // activate new settings of serial device
+-  tcsetattr(m_fd, TCSAFLUSH, &newSettings);
++  if (tcsetattr(m_fd, TCSAFLUSH, &newSettings)) {
++    close();
++    return RESULT_ERR_DEVICE;
++  }
+ 
+   // set serial device into blocking mode
+   fcntl(m_fd, F_SETFL, fcntl(m_fd, F_GETFL) & ~O_NONBLOCK);

Added: head/comms/ebusd/files/patch-src_lib_ebus_device.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/files/patch-src_lib_ebus_device.h	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,10 @@
+--- src/lib/ebus/device.h.orig	2018-12-26 15:38:15 UTC
++++ src/lib/ebus/device.h
+@@ -22,6 +22,7 @@
+ #include <unistd.h>
+ #include <termios.h>
+ #include <arpa/inet.h>
++#include <netinet/in.h>
+ #include <netdb.h>
+ #include <iostream>
+ #include <fstream>

Added: head/comms/ebusd/files/patch-src_lib_utils_tcpsocket.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/files/patch-src_lib_utils_tcpsocket.h	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,10 @@
+--- src/lib/utils/tcpsocket.h.orig	2018-12-26 15:38:15 UTC
++++ src/lib/utils/tcpsocket.h
+@@ -21,6 +21,7 @@
+ 
+ #include <unistd.h>
+ #include <sys/socket.h>
++#include <netinet/in.h>
+ #include <sys/time.h>
+ #include <stdint.h>
+ #include <string>

Added: head/comms/ebusd/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/pkg-descr	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,8 @@
+ebusd is a daemon for handling communication with eBUS devices connected to a
+2-wire bus system ("energy bus" used by numerous heating systems).
+
+It is known to run fine on regular PC hardware as well as on smaller devices
+like Fritzbox and Raspberry Pi. In order to use it, a hardware interface is
+necessary.
+
+WWW: https://github.com/john30/ebusd/wiki

Added: head/comms/ebusd/pkg-message
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/pkg-message	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,21 @@
+[
+{
+  type: install
+  message: <<EOD
+To start ebusd as a daemon during startup, add
+
+    ebusd_enable="YES"
+
+to your /etc/rc.conf.
+
+Extra options can be found in startup script.
+
+To be able to access serial port from the ebusd daemon, you might want to
+add the following line:
+
+	add path 'ttyU0' mode 0660 group ebusd
+
+to your local devfs.rules(5) configuration.
+EOD
+}
+]

Added: head/comms/ebusd/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/comms/ebusd/pkg-plist	Fri Sep 27 00:38:02 2019	(r512996)
@@ -0,0 +1,6 @@
+bin/ebusd
+bin/ebusctl
+bin/ebusfeed
+@dir(%%USER%%,%%GROUP%%,750) %%RUNDIR%%
+@dir(%%USER%%,%%GROUP%%,750) %%LOGDIR%%
+@dir %%ETCDIR%%



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909270038.x8R0c2Vr080643>