git: 7f625a5cf695 - main - sysutils/apcupsd: Add patch to increase the PCNET commlost timeout

From: Danilo G. Baio <dbaio_at_FreeBSD.org>
Date: Wed, 15 Jan 2025 19:44:48 UTC
The branch main has been updated by dbaio:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7f625a5cf6959cb84bb2f112583ea9cc6bb7c7fb

commit 7f625a5cf6959cb84bb2f112583ea9cc6bb7c7fb
Author:     Steven Stallion <sstallion@gmail.com>
AuthorDate: 2025-01-15 19:35:15 +0000
Commit:     Danilo G. Baio <dbaio@FreeBSD.org>
CommitDate: 2025-01-15 19:41:11 +0000

    sysutils/apcupsd: Add patch to increase the PCNET commlost timeout
    
    PR:             283900
    Reviewed by:    dbaio
---
 sysutils/apcupsd/Makefile                         | 12 +++++++-----
 sysutils/apcupsd/files/extra-patch-pcnet-commlost | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/sysutils/apcupsd/Makefile b/sysutils/apcupsd/Makefile
index 05ffa81769f8..993d5b9128ce 100644
--- a/sysutils/apcupsd/Makefile
+++ b/sysutils/apcupsd/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	apcupsd
 PORTVERSION=	3.14.14
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	sysutils
 MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}%20-%20Stable/${PORTVERSION}
 
@@ -29,10 +29,10 @@ SUB_FILES=	pkg-message
 CONFLICTS_INSTALL=	apcctrl
 
 OPTIONS_DEFINE=	APCDUMB_DRV APCSMART_DRV CGI CLIENT_ONLY GAPCMON MODBUS \
-		MODBUS_USB PCNET_DRV SHUTDOWN_POWEROFF SNMP_DRV SNMP_DRV_OLD \
-		TCP_WRAPPERS TEST_DRV USB_DRV USB_REPORTING
-OPTIONS_DEFAULT=	APCDUMB_DRV APCSMART_DRV MODBUS MODBUS_USB PCNET_DRV \
-		SNMP_DRV TCP_WRAPPERS USB_DRV
+		MODBUS_USB PCNET_COMMLOST PCNET_DRV SHUTDOWN_POWEROFF SNMP_DRV \
+		SNMP_DRV_OLD TCP_WRAPPERS TEST_DRV USB_DRV USB_REPORTING
+OPTIONS_DEFAULT=	APCDUMB_DRV APCSMART_DRV MODBUS MODBUS_USB PCNET_COMMLOST \
+		PCNET_DRV SNMP_DRV TCP_WRAPPERS USB_DRV
 OPTIONS_SUB=	yes
 
 APCDUMB_DRV_DESC=	Dumb UPS driver support
@@ -42,6 +42,7 @@ CLIENT_ONLY_DESC=	Only NIS client (no network server or drivers)
 GAPCMON_DESC=		Build GTK GUI front-end
 MODBUS_DESC=		MODBUS driver support
 MODBUS_USB_DESC=	MODBUS USB driver support
+PCNET_COMMLOST_DESC=	Experimental patch for faulty PCNET timeouts
 PCNET_DRV_DESC=		PowerChute Network Shutdown driver support
 SHUTDOWN_POWEROFF_DESC=	Shutdown behavior with Halt and Power off
 SNMP_DRV_DESC=		SNMP driver support
@@ -75,6 +76,7 @@ TCP_WRAPPERS_CONFIGURE_WITH=	libwrap=yes
 TEST_DRV_CONFIGURE_ENABLE=	test
 USB_DRV_CONFIGURE_ENABLE=	usb
 
+PCNET_COMMLOST_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-pcnet-commlost
 USB_REPORTING_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-usb-reporting
 
 .include <bsd.port.options.mk>
diff --git a/sysutils/apcupsd/files/extra-patch-pcnet-commlost b/sysutils/apcupsd/files/extra-patch-pcnet-commlost
new file mode 100644
index 000000000000..0cf5de3f977b
--- /dev/null
+++ b/sysutils/apcupsd/files/extra-patch-pcnet-commlost
@@ -0,0 +1,17 @@
+# https://sourceforge.net/p/apcupsd/mailman/apcupsd-users/thread/CAGGHmKEjHQfRkB1EvHdv5b54buNKwQpMVmQzznpB%2BWNx_nEvWw%40mail.gmail.com/#msg59114143
+# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283900
+--- src/drivers/pcnet/pcnet.c	(revision 2381)
++++ src/drivers/pcnet/pcnet.c	(working copy)
+@@ -32,10 +32,10 @@
+ 
+ /*
+  * Number of seconds with no data before we declare COMMLOST.
+- * UPS should report in every 25 seconds. We allow 2 missing
++ * UPS should report in every 25 seconds. We allow 3 missing
+  * reports plus a fudge factor.
+  */
+-#define COMMLOST_TIMEOUT   55
++#define COMMLOST_TIMEOUT   80
+ 
+ /* Win32 needs a special close for sockets */
+ #ifdef HAVE_MINGW