From 8e7121041e0b90b057d47c783fc2c99034664ada Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 31 Jul 2023 13:35:48 +0200 Subject: [PATCH] drivers/cyberpower-mib.c, NEWS: extend support to devices which report the shorter Vendor OID as their sysOID [#1997] Closes: #1997 Signed-off-by: Jim Klimov --- NEWS | 2 ++ drivers/cyberpower-mib.c | 10 +++++++++- drivers/cyberpower-mib.h | 1 + drivers/snmp-ups.c | 3 ++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 11385cf61d..989e1bd8be 100644 --- a/NEWS +++ b/NEWS @@ -153,6 +153,8 @@ as part of https://github.com/networkupstools/nut/issues/1410 solution. driver [#1716] * `baytech-mib.c` subdriver: fixed `baytech_outlet_status_info[]` set of valid outlet status values [#1871] + * `cyberpower-mib.c` subdriver: support devices which report the shorter + Vendor OID as their sysOID, e.g. "CyberPower PowerPanel Personal" [#1997] - The `bestfortress` driver shutdown handling was fixed to use a non-trivial default timeout [#1820] diff --git a/drivers/cyberpower-mib.c b/drivers/cyberpower-mib.c index cff6d64d88..89574b8744 100644 --- a/drivers/cyberpower-mib.c +++ b/drivers/cyberpower-mib.c @@ -24,12 +24,17 @@ #include "cyberpower-mib.h" -#define CYBERPOWER_MIB_VERSION "0.52" +#define CYBERPOWER_MIB_VERSION "0.53" #define CYBERPOWER_OID_MODEL_NAME ".1.3.6.1.4.1.3808.1.1.1.1.1.1.0" /* CPS-MIB::ups */ #define CYBERPOWER_SYSOID ".1.3.6.1.4.1.3808.1.1.1" +/* Per https://github.com/networkupstools/nut/issues/1997 + * some CPS devices offer the shorter vendor OID as sysOID + */ +#define CYBERPOWER_SYSOID2 ".1.3.6.1.4.1.3808" + /* https://www.cyberpowersystems.com/products/software/mib-files/ */ /* Per CPS MIB 2.9 upsBaseOutputStatus OBJECT-TYPE: */ static info_lkp_t cyberpower_power_status[] = { @@ -177,3 +182,6 @@ static snmp_info_t cyberpower_mib[] = { mib2nut_info_t cyberpower = { "cyberpower", CYBERPOWER_MIB_VERSION, NULL, CYBERPOWER_OID_MODEL_NAME, cyberpower_mib, CYBERPOWER_SYSOID, NULL }; + +mib2nut_info_t cyberpower2 = { "cyberpower", CYBERPOWER_MIB_VERSION, NULL, + CYBERPOWER_OID_MODEL_NAME, cyberpower_mib, CYBERPOWER_SYSOID2, NULL }; diff --git a/drivers/cyberpower-mib.h b/drivers/cyberpower-mib.h index 9db422250e..f8a44d24bd 100644 --- a/drivers/cyberpower-mib.h +++ b/drivers/cyberpower-mib.h @@ -5,5 +5,6 @@ #include "snmp-ups.h" extern mib2nut_info_t cyberpower; +extern mib2nut_info_t cyberpower2; #endif /* CYBERPOWER_MIB_H */ diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c index a9073aaa62..558c72e61f 100644 --- a/drivers/snmp-ups.c +++ b/drivers/snmp-ups.c @@ -104,6 +104,7 @@ static mib2nut_info_t *mib2nut[] = { &bestpower, /* This struct comes from : bestpower-mib.c */ &compaq, /* This struct comes from : compaq-mib.c */ &cyberpower, /* This struct comes from : cyberpower-mib.c */ + &cyberpower2, /* This struct comes from : cyberpower-mib.c */ &delta_ups, /* This struct comes from : delta_ups-mib.c */ &eaton_ats16_nmc, /* This struct comes from : eaton-ats16-nmc-mib.c */ &eaton_ats16_nm2, /* This struct comes from : eaton-ats16-nm2-mib.c */ @@ -173,7 +174,7 @@ static const char *mibname; static const char *mibvers; #define DRIVER_NAME "Generic SNMP UPS driver" -#define DRIVER_VERSION "1.29" +#define DRIVER_VERSION "1.30" /* driver description structure */ upsdrv_info_t upsdrv_info = {