Bug#674081: apcupsd: serial UPS connection fails on kfreebsd-*
Justification: fails to build from source (but built successfully in the
On GNU/kFreeBSD, apcupsd fails to connect to a serial smart UPS, e.g.
/dev/cuau0, with "Communications with UPS lost" logged about a minute
Debugging with apctest showed a successful initial connection, but
becoming unresponsive after a few bytes had been exchanged with the UPS.
Hours later, I stumbled upon the cause of this; the autoconf script
did not define HAVE_FREEBSD_OS. This resulted in two lines of code
being skipped, where values for c_ispeed and c_ospeed should have been
set in the termio structure. This either meant that tcsetattr() would
de-assert modem control, or possibly it was failing silently without
setting some other necessary parameter on the serial line.
Please see my attached patch which has got my serial smart UPS
functioning, and apcupsd working as a NIS master.
I don't know how to properly regenerate ./configure in this package so I
altered it directly in my patch.
--- apcupsd-3.14.10.orig/autoconf/configure.in 2012-05-22 23:02:44.000000000 +0100
+++ apcupsd-3.14.10/autoconf/configure.in 2012-05-22 23:02:58.465449378 +0100
@@ -349,6 +349,7 @@
*-*-hpux*) AC_DEFINE(HAVE_HPUX_OS) ;;
*-*-linux*) AC_DEFINE(HAVE_LINUX_OS) ;;
*-*-freebsd*) AC_DEFINE(HAVE_FREEBSD_OS) ;;
+ *-*-kfreebsd*)AC_DEFINE(HAVE_FREEBSD_OS) ;;
*-*-netbsd*) AC_DEFINE(HAVE_NETBSD_OS) ;;
*-*-openbsd*) AC_DEFINE(HAVE_OPENBSD_OS) ;;
*-*-bsdi*) AC_DEFINE(HAVE_BSDI_OS) ;;
--- apcupsd-3.14.10.orig/configure 2012-05-22 23:04:47.645447000 +0100
+++ apcupsd-3.14.10/configure 2012-05-22 23:05:25.409449524 +0100
@@ -9509,6 +9509,10 @@
#define HAVE_FREEBSD_OS 1
+ *-*-kfreebsd*) cat >>confdefs.h <<\_ACEOF
+#define HAVE_FREEBSD_OS 1
*-*-netbsd*) cat >>confdefs.h <<\_ACEOF
#define HAVE_NETBSD_OS 1