summaryrefslogtreecommitdiff
path: root/sysutils/nut-devel/files
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/nut-devel/files')
-rw-r--r--sysutils/nut-devel/files/nut.in56
-rw-r--r--sysutils/nut-devel/files/nut.newsyslog7
-rw-r--r--sysutils/nut-devel/files/nut.syslog2
-rw-r--r--sysutils/nut-devel/files/nut_upslog.in37
-rw-r--r--sysutils/nut-devel/files/nut_upsmon.in47
-rw-r--r--sysutils/nut-devel/files/patch-drivers_blazer__usb.c79
-rw-r--r--sysutils/nut-devel/files/patch-drivers_libshut.c23
-rw-r--r--sysutils/nut-devel/files/patch-drivers_libusb.c65
-rw-r--r--sysutils/nut-devel/files/patch-drivers_libusb.h27
-rw-r--r--sysutils/nut-devel/files/patch-drivers_nutdrv__qx.c79
-rw-r--r--sysutils/nut-devel/files/patch-drivers_riello__usb.c53
-rw-r--r--sysutils/nut-devel/files/patch-drivers_tripplite__usb.c20
-rw-r--r--sysutils/nut-devel/files/patch-drivers_usbhid-ups.c74
-rw-r--r--sysutils/nut-devel/files/patch-scripts_Makefile8
14 files changed, 577 insertions, 0 deletions
diff --git a/sysutils/nut-devel/files/nut.in b/sysutils/nut-devel/files/nut.in
new file mode 100644
index 000000000000..5b04aaf713ab
--- /dev/null
+++ b/sysutils/nut-devel/files/nut.in
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: nut
+# REQUIRE: NETWORKING
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+
+# Define these nut_* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/nut
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+nut_enable=${nut_enable:-"NO"}
+nut_prefix=${nut_prefix:-"%%PREFIX%%"}
+nut_upsshut=${nut_upsshut:-"NO"}
+
+. /etc/rc.subr
+
+name="nut"
+rcvar=nut_enable
+
+load_rc_config $name
+
+required_dirs="%%STATEDIR%%"
+required_files="${nut_prefix}/etc/nut/ups.conf ${nut_prefix}/etc/nut/upsd.conf ${nut_prefix}/etc/nut/upsd.users"
+command="${nut_prefix}/sbin/upsd"
+pidfile="%%STATEDIR%%/upsd.pid"
+
+start_precmd="nut_prestart"
+stop_postcmd="nut_poststop"
+
+nut_prestart() {
+ ${nut_prefix}/sbin/upsdrvctl start
+}
+
+nut_poststop() {
+ if ${nut_prefix}/sbin/upsdrvctl stop && checkyesno nut_upsshut; then
+ if ${nut_prefix}/sbin/upsmon -K; then
+ ${nut_prefix}/sbin/upsdrvctl shutdown
+ fi
+ fi
+
+}
+
+extra_commands=reload
+reload()
+{
+ kill -HUP `cat $pidfile`
+}
+
+run_rc_command "$1"
diff --git a/sysutils/nut-devel/files/nut.newsyslog b/sysutils/nut-devel/files/nut.newsyslog
new file mode 100644
index 000000000000..fc50b6c1be32
--- /dev/null
+++ b/sysutils/nut-devel/files/nut.newsyslog
@@ -0,0 +1,7 @@
+# configuration file for newsyslog for nut
+#
+# see newsyslog.conf(5) for details
+#
+# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
+/var/log/nut/upsd.log uucp:uucp 644 7 100 * J /var/db/nut/upslog.pid
+
diff --git a/sysutils/nut-devel/files/nut.syslog b/sysutils/nut-devel/files/nut.syslog
new file mode 100644
index 000000000000..c9587148aab1
--- /dev/null
+++ b/sysutils/nut-devel/files/nut.syslog
@@ -0,0 +1,2 @@
+!upsmon
+*.* /var/log/nut/upsd.log
diff --git a/sysutils/nut-devel/files/nut_upslog.in b/sysutils/nut-devel/files/nut_upslog.in
new file mode 100644
index 000000000000..7f65bd866982
--- /dev/null
+++ b/sysutils/nut-devel/files/nut_upslog.in
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: nut_upslog
+# REQUIRE: NETWORKING nut
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+
+# Define these nut_upslog* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/nut_upslog
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+nut_upslog_enable=${nut_upslog_enable:-"NO"}
+nut_upslog_prefix=${nut_upslog_prefix:-"%%PREFIX%%"}
+nut_upslog_logfile=${nut_upslog_logfile:-"/var/log/nut/ups.log"}
+nut_upslog_interval=${nut_upslog_interval:-"300"}
+nut_upslog_ups=${nut_upslog_ups:-"myups@localhost"}
+# nut_upslog_format
+
+. /etc/rc.subr
+
+name="nut_upslog"
+rcvar=nut_upslog_enable
+
+load_rc_config $name
+
+required_dirs="%%STATEDIR%%"
+command="${nut_upslog_prefix}/bin/upslog"
+pidfile="%%STATEDIR%%/upslog.pid"
+nut_upslog_flags=${nut_upslog_flags:-"-s ${nut_upslog_ups} -l ${nut_upslog_logfile} -i ${nut_upslog_interval} ${nut_upslog_format:+-f \"${nut_upslog_format}\"}"}
+
+run_rc_command "$1"
diff --git a/sysutils/nut-devel/files/nut_upsmon.in b/sysutils/nut-devel/files/nut_upsmon.in
new file mode 100644
index 000000000000..9562f056faed
--- /dev/null
+++ b/sysutils/nut-devel/files/nut_upsmon.in
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: nut_upsmon
+# REQUIRE: NETWORKING nut
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+
+# Define these nut_upsmon* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/nut_upsmon
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+nut_upsmon_enable=${nut_upsmon_enable:-"NO"}
+nut_upsmon_prefix=${nut_upsmon_prefix:-"%%PREFIX%%"}
+
+. /etc/rc.subr
+
+name="nut_upsmon"
+rcvar=nut_upsmon_enable
+
+load_rc_config $name
+
+required_dirs="%%STATEDIR%%"
+required_files="${nut_upsmon_prefix}/etc/nut/upsmon.conf"
+command="${nut_upsmon_prefix}/sbin/upsmon"
+pidfile="%%STATEDIR%%/upsmon.pid"
+nut_upsmon_flags=${nut_upsmon_flags:-"localhost"}
+
+extra_commands=reload
+stop_cmd="upsmon_stop"
+
+reload()
+{
+ ${command} -c reload
+}
+
+upsmon_stop()
+{
+ ${command} -c stop
+}
+
+run_rc_command "$1"
diff --git a/sysutils/nut-devel/files/patch-drivers_blazer__usb.c b/sysutils/nut-devel/files/patch-drivers_blazer__usb.c
new file mode 100644
index 000000000000..ccb0be8a0fb3
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-drivers_blazer__usb.c
@@ -0,0 +1,79 @@
+--- drivers/blazer_usb.c.orig 2015-12-29 12:08:34 UTC
++++ drivers/blazer_usb.c
+@@ -118,9 +118,9 @@ static int phoenix_command(const char *cmd, char *buf,
+ */
+ switch (ret)
+ {
+- case -EPIPE: /* Broken pipe */
++ case LIBUSB_ERROR_PIPE: /* Broken pipe */
+ usb_clear_halt(udev, 0x81);
+- case -ETIMEDOUT: /* Connection timed out */
++ case LIBUSB_ERROR_TIMEOUT: /* Connection timed out */
+ break;
+ }
+
+@@ -188,7 +188,7 @@ static int ippon_command(const char *cmd, char *buf, s
+ 0x09, 0x2, 0, &tmp[i], 8, 1000);
+
+ if (ret <= 0) {
+- upsdebugx(3, "send: %s", (ret != -ETIMEDOUT) ? usb_strerror() : "Connection timed out");
++ upsdebugx(3, "send: %s", (ret != LIBUSB_ERROR_TIMEOUT) ? usb_strerror() : "Connection timed out");
+ return ret;
+ }
+ }
+@@ -203,7 +203,7 @@ static int ippon_command(const char *cmd, char *buf, s
+ * will happen after successfully writing a command to the UPS)
+ */
+ if (ret <= 0) {
+- upsdebugx(3, "read: %s", (ret != -ETIMEDOUT) ? usb_strerror() : "Connection timed out");
++ upsdebugx(3, "read: %s", (ret != LIBUSB_ERROR_TIMEOUT) ? usb_strerror() : "Connection timed out");
+ return ret;
+ }
+
+@@ -423,38 +423,28 @@ int blazer_command(const char *cmd, char *buf, size_t
+
+ switch (ret)
+ {
+- case -EBUSY: /* Device or resource busy */
++ case LIBUSB_ERROR_BUSY: /* Device or resource busy */
+ fatal_with_errno(EXIT_FAILURE, "Got disconnected by another driver");
+
+- case -EPERM: /* Operation not permitted */
+- fatal_with_errno(EXIT_FAILURE, "Permissions problem");
+-
+- case -EPIPE: /* Broken pipe */
++ case LIBUSB_ERROR_PIPE: /* Broken pipe */
+ if (usb_clear_halt(udev, 0x81) == 0) {
+ upsdebugx(1, "Stall condition cleared");
+ break;
+ }
+-#ifdef ETIME
+- case -ETIME: /* Timer expired */
+-#endif
+ if (usb_reset(udev) == 0) {
+ upsdebugx(1, "Device reset handled");
+ }
+- case -ENODEV: /* No such device */
+- case -EACCES: /* Permission denied */
+- case -EIO: /* I/O error */
+- case -ENXIO: /* No such device or address */
+- case -ENOENT: /* No such file or directory */
++ case LIBUSB_ERROR_NO_DEVICE: /* No such device */
++ case LIBUSB_ERROR_ACCESS: /* Permission denied */
++ case LIBUSB_ERROR_IO: /* I/O error */
++ case LIBUSB_ERROR_NOT_FOUND: /* No such file or directory */
+ /* Uh oh, got to reconnect! */
+ usb->close(udev);
+ udev = NULL;
+ break;
+
+- case -ETIMEDOUT: /* Connection timed out */
+- case -EOVERFLOW: /* Value too large for defined data type */
+-#ifdef EPROTO
+- case -EPROTO: /* Protocol error */
+-#endif
++ case LIBUSB_ERROR_TIMEOUT: /* Connection timed out */
++ case LIBUSB_ERROR_OVERFLOW: /* Value too large for defined data type */
+ default:
+ break;
+ }
diff --git a/sysutils/nut-devel/files/patch-drivers_libshut.c b/sysutils/nut-devel/files/patch-drivers_libshut.c
new file mode 100644
index 000000000000..b925c8948250
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-drivers_libshut.c
@@ -0,0 +1,23 @@
+--- drivers/libshut.c.orig 2015-12-29 12:08:34 UTC
++++ drivers/libshut.c
+@@ -37,6 +37,7 @@
+ #include "nut_stdint.h" /* for uint8_t, uint16_t, uint32_t */
+
+ #include "serial.h"
++#include "libusb.h"
+ #include "libshut.h"
+ #include "common.h" /* for xmalloc, upsdebugx prototypes */
+
+@@ -809,10 +810,10 @@ int shut_get_string_simple(int upsfd, int index,
+ return ret;
+
+ if (tbuf[1] != USB_DT_STRING)
+- return -EIO;
++ return LIBUSB_ERROR_IO;
+
+ if (tbuf[0] > ret)
+- return -EFBIG;
++ return LIBUSB_ERROR_OVERFLOW;
+
+ /* skip the UTF8 zero'ed high bytes */
+ for (di = 0, si = 2; si < tbuf[0]; si += 2)
diff --git a/sysutils/nut-devel/files/patch-drivers_libusb.c b/sysutils/nut-devel/files/patch-drivers_libusb.c
new file mode 100644
index 000000000000..743e2440412a
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-drivers_libusb.c
@@ -0,0 +1,65 @@
+--- drivers/libusb.c.orig 2015-12-29 12:08:34 UTC
++++ drivers/libusb.c
+@@ -428,26 +428,21 @@ static int libusb_strerror(const int ret, const char *
+
+ switch(ret)
+ {
+- case -EBUSY: /* Device or resource busy */
+- case -EPERM: /* Operation not permitted */
+- case -ENODEV: /* No such device */
+- case -EACCES: /* Permission denied */
+- case -EIO: /* I/O error */
+- case -ENXIO: /* No such device or address */
+- case -ENOENT: /* No such file or directory */
+- case -EPIPE: /* Broken pipe */
+- case -ENOSYS: /* Function not implemented */
++ case LIBUSB_ERROR_BUSY: /* Device or resource busy */
++ case LIBUSB_ERROR_NO_DEVICE: /* No such device */
++ case LIBUSB_ERROR_ACCESS: /* Permission denied */
++ case LIBUSB_ERROR_IO: /* I/O error */
++ case LIBUSB_ERROR_NOT_FOUND: /* No such file or directory */
++ case LIBUSB_ERROR_PIPE: /* Broken pipe */
++ case LIBUSB_ERROR_NOT_SUPPORTED: /* Function not implemented */
+ upslogx(LOG_DEBUG, "%s: %s", desc, usb_strerror());
+ return ret;
+
+- case -ETIMEDOUT: /* Connection timed out */
++ case LIBUSB_ERROR_TIMEOUT: /* Connection timed out */
+ upsdebugx(2, "%s: Connection timed out", desc);
+ return 0;
+
+- case -EOVERFLOW: /* Value too large for defined data type */
+-#ifdef EPROTO
+- case -EPROTO: /* Protocol error */
+-#endif
++ case LIBUSB_ERROR_OVERFLOW: /* Value too large for defined data type */
+ upsdebugx(2, "%s: %s", desc, usb_strerror());
+ return 0;
+
+@@ -478,7 +473,7 @@ static int libusb_get_report(usb_dev_handle *udev, int
+ 0, raw_buf, ReportSize, USB_TIMEOUT);
+
+ /* Ignore "protocol stall" (for unsupported request) on control endpoint */
+- if (ret == -EPIPE) {
++ if (ret == LIBUSB_ERROR_PIPE) {
+ return 0;
+ }
+
+@@ -500,7 +495,7 @@ static int libusb_set_report(usb_dev_handle *udev, int
+ 0, raw_buf, ReportSize, USB_TIMEOUT);
+
+ /* Ignore "protocol stall" (for unsupported request) on control endpoint */
+- if (ret == -EPIPE) {
++ if (ret == LIBUSB_ERROR_PIPE) {
+ return 0;
+ }
+
+@@ -532,7 +527,7 @@ static int libusb_get_interrupt(usb_dev_handle *udev,
+ ret = usb_interrupt_read(udev, 0x81, (char *)buf, bufsize, timeout);
+
+ /* Clear stall condition */
+- if (ret == -EPIPE) {
++ if (ret == LIBUSB_ERROR_PIPE) {
+ ret = usb_clear_halt(udev, 0x81);
+ }
+
diff --git a/sysutils/nut-devel/files/patch-drivers_libusb.h b/sysutils/nut-devel/files/patch-drivers_libusb.h
new file mode 100644
index 000000000000..bbf53e102eaa
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-drivers_libusb.h
@@ -0,0 +1,27 @@
+--- drivers/libusb.h.orig 2015-12-29 12:08:34 UTC
++++ drivers/libusb.h
+@@ -36,6 +36,24 @@
+
+ #include <usb.h> /* libusb header file */
+
++/* libusb 1.0 errors used by FreeBSD */
++enum libusb_error {
++ LIBUSB_SUCCESS = 0,
++ LIBUSB_ERROR_IO = -1,
++ LIBUSB_ERROR_INVALID_PARAM = -2,
++ LIBUSB_ERROR_ACCESS = -3,
++ LIBUSB_ERROR_NO_DEVICE = -4,
++ LIBUSB_ERROR_NOT_FOUND = -5,
++ LIBUSB_ERROR_BUSY = -6,
++ LIBUSB_ERROR_TIMEOUT = -7,
++ LIBUSB_ERROR_OVERFLOW = -8,
++ LIBUSB_ERROR_PIPE = -9,
++ LIBUSB_ERROR_INTERRUPTED = -10,
++ LIBUSB_ERROR_NO_MEM = -11,
++ LIBUSB_ERROR_NOT_SUPPORTED = -12,
++ LIBUSB_ERROR_OTHER = -99,
++};
++
+ extern upsdrv_info_t comm_upsdrv_info;
+
+ /*!
diff --git a/sysutils/nut-devel/files/patch-drivers_nutdrv__qx.c b/sysutils/nut-devel/files/patch-drivers_nutdrv__qx.c
new file mode 100644
index 000000000000..fc27279f3ec8
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-drivers_nutdrv__qx.c
@@ -0,0 +1,79 @@
+--- drivers/nutdrv_qx.c.orig 2016-03-08 12:01:11 UTC
++++ drivers/nutdrv_qx.c
+@@ -561,9 +561,9 @@ static int phoenix_command(const char *cmd, char *buf,
+ * In order to read correct replies we need to flush the output buffers of the converter until we get no more data (ie, it times out). */
+ switch (ret)
+ {
+- case -EPIPE: /* Broken pipe */
++ case LIBUSB_ERROR_PIPE: /* Broken pipe */
+ usb_clear_halt(udev, 0x81);
+- case -ETIMEDOUT: /* Connection timed out */
++ case LIBUSB_ERROR_TIMEOUT: /* Connection timed out */
+ break;
+ }
+
+@@ -635,7 +635,7 @@ static int ippon_command(const char *cmd, char *buf, s
+ ret = usb_control_msg(udev, USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x09, 0x2, 0, &tmp[i], 8, 1000);
+
+ if (ret <= 0) {
+- upsdebugx(3, "send: %s (%d)", (ret != -ETIMEDOUT) ? usb_strerror() : "Connection timed out", ret);
++ upsdebugx(3, "send: %s (%d)", (ret != LIBUSB_ERROR_TIMEOUT) ? usb_strerror() : "Connection timed out", ret);
+ return ret;
+ }
+
+@@ -648,7 +648,7 @@ static int ippon_command(const char *cmd, char *buf, s
+
+ /* Any errors here mean that we are unable to read a reply (which will happen after successfully writing a command to the UPS) */
+ if (ret <= 0) {
+- upsdebugx(3, "read: %s (%d)", (ret != -ETIMEDOUT) ? usb_strerror() : "Connection timed out", ret);
++ upsdebugx(3, "read: %s (%d)", (ret != LIBUSB_ERROR_TIMEOUT) ? usb_strerror() : "Connection timed out", ret);
+ return ret;
+ }
+
+@@ -2124,38 +2124,28 @@ static int qx_command(const char *cmd, char *buf, size
+
+ switch (ret)
+ {
+- case -EBUSY: /* Device or resource busy */
++ case LIBUSB_ERROR_BUSY: /* Device or resource busy */
+ fatal_with_errno(EXIT_FAILURE, "Got disconnected by another driver");
+
+- case -EPERM: /* Operation not permitted */
+- fatal_with_errno(EXIT_FAILURE, "Permissions problem");
+-
+- case -EPIPE: /* Broken pipe */
++ case LIBUSB_ERROR_PIPE: /* Broken pipe */
+ if (usb_clear_halt(udev, 0x81) == 0) {
+ upsdebugx(1, "Stall condition cleared");
+ break;
+ }
+- #ifdef ETIME
+- case -ETIME: /* Timer expired */
+- #endif /* ETIME */
+ if (usb_reset(udev) == 0) {
+ upsdebugx(1, "Device reset handled");
+ }
+- case -ENODEV: /* No such device */
+- case -EACCES: /* Permission denied */
+- case -EIO: /* I/O error */
+- case -ENXIO: /* No such device or address */
+- case -ENOENT: /* No such file or directory */
++ case LIBUSB_ERROR_NO_DEVICE: /* No such device */
++ case LIBUSB_ERROR_ACCESS: /* Permission denied */
++ case LIBUSB_ERROR_IO: /* I/O error */
++ case LIBUSB_ERROR_NOT_FOUND: /* No such file or directory */
+ /* Uh oh, got to reconnect! */
+ usb->close(udev);
+ udev = NULL;
+ break;
+
+- case -ETIMEDOUT: /* Connection timed out */
+- case -EOVERFLOW: /* Value too large for defined data type */
+-#ifdef EPROTO
+- case -EPROTO: /* Protocol error */
+-#endif
++ case LIBUSB_ERROR_TIMEOUT: /* Connection timed out */
++ case LIBUSB_ERROR_OVERFLOW: /* Value too large for defined data type */
+ default:
+ break;
+ }
diff --git a/sysutils/nut-devel/files/patch-drivers_riello__usb.c b/sysutils/nut-devel/files/patch-drivers_riello__usb.c
new file mode 100644
index 000000000000..759aa91ff62a
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-drivers_riello__usb.c
@@ -0,0 +1,53 @@
+--- drivers/riello_usb.c.orig 2015-12-29 12:08:34 UTC
++++ drivers/riello_usb.c
+@@ -346,42 +346,28 @@ int riello_command(uint8_t *cmd, uint8_t *buf, uint16_
+
+ switch (ret)
+ {
+- case -EBUSY: /* Device or resource busy */
++ case LIBUSB_ERROR_BUSY: /* Device or resource busy */
+ fatal_with_errno(EXIT_FAILURE, "Got disconnected by another driver");
+
+- case -EPERM: /* Operation not permitted */
+- fatal_with_errno(EXIT_FAILURE, "Permissions problem");
+-
+- case -EPIPE: /* Broken pipe */
++ case LIBUSB_ERROR_PIPE: /* Broken pipe */
+ if (usb_clear_halt(udev, 0x81) == 0) {
+ upsdebugx(1, "Stall condition cleared");
+ break;
+ }
+-#ifdef ETIME
+- case -ETIME: /* Timer expired */
+-#endif
+ if (usb_reset(udev) == 0) {
+ upsdebugx(1, "Device reset handled");
+ }
+- case -ENODEV: /* No such device */
+- case -EACCES: /* Permission denied */
+- case -EIO: /* I/O error */
+- case -ENXIO: /* No such device or address */
+- case -ENOENT: /* No such file or directory */
++ case LIBUSB_ERROR_NO_DEVICE: /* No such device */
++ case LIBUSB_ERROR_ACCESS: /* Permission denied */
++ case LIBUSB_ERROR_IO: /* I/O error */
++ case LIBUSB_ERROR_NOT_FOUND: /* No such file or directory */
+ /* Uh oh, got to reconnect! */
+ usb->close(udev);
+ udev = NULL;
+ break;
+
+- case -ETIMEDOUT: /* Connection timed out */
+- upsdebugx (3, "riello_command err: Resource temporarily unavailable");
+-
+-
+- case -EOVERFLOW: /* Value too large for defined data type */
+-#ifdef EPROTO
+- case -EPROTO: /* Protocol error */
+-#endif
+- break;
++ case LIBUSB_ERROR_TIMEOUT: /* Connection timed out */
++ case LIBUSB_ERROR_OVERFLOW: /* Value too large for defined data type */
+ default:
+ break;
+ }
diff --git a/sysutils/nut-devel/files/patch-drivers_tripplite__usb.c b/sysutils/nut-devel/files/patch-drivers_tripplite__usb.c
new file mode 100644
index 000000000000..4c98dfb41c84
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-drivers_tripplite__usb.c
@@ -0,0 +1,20 @@
+--- drivers/tripplite_usb.c.orig 2015-12-29 12:08:34 UTC
++++ drivers/tripplite_usb.c
+@@ -499,7 +499,7 @@ void usb_comm_fail(int res, const char *msg)
+ static int try = 0;
+
+ switch(res) {
+- case -EBUSY:
++ case LIBUSB_ERROR_BUSY:
+ upslogx(LOG_WARNING, "%s: Device claimed by another process", msg);
+ fatalx(EXIT_FAILURE, "Terminating: EBUSY");
+ break;
+@@ -907,7 +907,7 @@ void upsdrv_initinfo(void)
+ if(tl_model != TRIPP_LITE_SMARTPRO ) {
+ ret = send_cmd(w_msg, sizeof(w_msg), w_value, sizeof(w_value)-1);
+ if(ret <= 0) {
+- if(ret == -EPIPE) {
++ if(ret == LIBUSB_ERROR_PIPE) {
+ fatalx(EXIT_FAILURE, "Could not reset watchdog. Please check and"
+ "see if usbhid-ups(8) works with this UPS.");
+ } else {
diff --git a/sysutils/nut-devel/files/patch-drivers_usbhid-ups.c b/sysutils/nut-devel/files/patch-drivers_usbhid-ups.c
new file mode 100644
index 000000000000..620b60c0baf1
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-drivers_usbhid-ups.c
@@ -0,0 +1,74 @@
+--- drivers/usbhid-ups.c.orig 2015-12-29 12:08:34 UTC
++++ drivers/usbhid-ups.c
+@@ -30,6 +30,7 @@
+ #define DRIVER_VERSION "0.41"
+
+ #include "main.h"
++#include "libusb.h"
+ #include "libhid.h"
+ #include "usbhid-ups.h"
+ #include "hidparser.h"
+@@ -790,22 +790,14 @@ void upsdrv_updateinfo(void)
+ /* Get HID notifications on Interrupt pipe first */
+ if (use_interrupt_pipe == TRUE) {
+ evtCount = HIDGetEvents(udev, event, MAX_EVENT_NUM);
+- switch (evtCount)
+- {
+- case -EBUSY: /* Device or resource busy */
+- upslog_with_errno(LOG_CRIT, "Got disconnected by another driver");
+- case -EPERM: /* Operation not permitted */
+- case -ENODEV: /* No such device */
+- case -EACCES: /* Permission denied */
+- case -EIO: /* I/O error */
+- case -ENXIO: /* No such device or address */
+- case -ENOENT: /* No such file or directory */
++ if (evtCount < 0) {
++ if (evtCount == LIBUSB_ERROR_BUSY) {
++ upslog_with_errno(LOG_CRIT, "Got disconnected by another driver");
++ }
+ /* Uh oh, got to reconnect! */
+ hd = NULL;
+- return;
+- default:
++ } else {
+ upsdebugx(1, "Got %i HID objects...", (evtCount >= 0) ? evtCount : 0);
+- break;
+ }
+ } else {
+ evtCount = 0;
+@@ -1280,14 +1272,12 @@ static bool_t hid_ups_walk(walkmode_t mode)
+
+ switch (retcode)
+ {
+- case -EBUSY: /* Device or resource busy */
++ case LIBUSB_ERROR_BUSY: /* Device or resource busy */
+ upslog_with_errno(LOG_CRIT, "Got disconnected by another driver");
+- case -EPERM: /* Operation not permitted */
+- case -ENODEV: /* No such device */
+- case -EACCES: /* Permission denied */
+- case -EIO: /* I/O error */
+- case -ENXIO: /* No such device or address */
+- case -ENOENT: /* No such file or directory */
++ case LIBUSB_ERROR_NO_DEVICE: /* No such device */
++ case LIBUSB_ERROR_ACCESS: /* Permission denied */
++ case LIBUSB_ERROR_IO: /* I/O error */
++ case LIBUSB_ERROR_NOT_FOUND: /* No such file or directory */
+ /* Uh oh, got to reconnect! */
+ hd = NULL;
+ return FALSE;
+@@ -1298,12 +1288,9 @@ static bool_t hid_ups_walk(walkmode_t mode)
+ case 0:
+ continue;
+
+- case -ETIMEDOUT: /* Connection timed out */
+- case -EOVERFLOW: /* Value too large for defined data type */
+-#ifdef EPROTO
+- case -EPROTO: /* Protocol error */
+-#endif
+- case -EPIPE: /* Broken pipe */
++ case LIBUSB_ERROR_TIMEOUT: /* Connection timed out */
++ case LIBUSB_ERROR_OVERFLOW: /* Value too large for defined data type */
++ case LIBUSB_ERROR_PIPE: /* Broken pipe */
+ default:
+ /* Don't know what happened, try again later... */
+ continue;
diff --git a/sysutils/nut-devel/files/patch-scripts_Makefile b/sysutils/nut-devel/files/patch-scripts_Makefile
new file mode 100644
index 000000000000..0fb15d83ac33
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-scripts_Makefile
@@ -0,0 +1,8 @@
+--- scripts/Makefile.am.orig 2020-02-09 10:44:01.000000000 -0800
++++ scripts/Makefile.am 2020-03-24 19:40:01.084978000 -0700
+@@ -25,4 +25,4 @@
+ Windows/halt.c \
+ Windows/Makefile
+
+-SUBDIRS = augeas devd hotplug python systemd udev Solaris upsdrvsvcctl
++SUBDIRS = augeas devd hotplug python udev upsdrvsvcctl