From 52ccc91844721d61e045de5ed365e00887962523 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Mon, 23 Sep 2024 14:12:28 +0200 Subject: [PATCH 1/7] EATON HID: add missing usages and paths Signed-off-by: Arnaud Quette --- drivers/mge-hid.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 5c9e6b33e4..2a1e008632 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -871,10 +871,11 @@ static info_lkp_t eaton_converter_online_info[] = { /* Eaton / MGE HID usage table */ static usage_lkp_t mge_usage_lkp[] = { { "Undefined", 0xffff0000 }, - { "STS", 0xffff0001 }, + { "STS", 0xffff0001 }, { "Environment", 0xffff0002 }, - { "Statistic", 0xffff0003 }, + { "Statistic", 0xffff0003 }, { "StatisticSystem", 0xffff0004 }, + { "USB", 0xffff0005 }, /* 0xffff0005-0xffff000f => Reserved */ { "Phase", 0xffff0010 }, { "PhaseID", 0xffff0011 }, @@ -1014,8 +1015,12 @@ static usage_lkp_t mge_usage_lkp[] = { { "Reset", 0xffff00ad }, { "WatchdogReset", 0xffff00ae }, /* 0xffff00af-0xffff00df => Reserved */ + { "iDesignator", 0xffff00ba }, { "COPIBridge", 0xffff00e0 }, - /* 0xffff00e1-0xffff00ef => Reserved */ + { "Gateway", 0xffff00e1 }, + { "System", 0xffff00e5 }, + { "Status", 0xffff00e9 }, + /* 0xffff00ee-0xffff00ef => Reserved */ { "iModel", 0xffff00f0 }, { "iVersion", 0xffff00f1 }, { "iTechnicalLevel", 0xffff00f2 }, @@ -1253,6 +1258,7 @@ static hid_info_t mge_hid2nut[] = /* Device collection */ /* Just declared to call *hid2info */ { "device.country", ST_FLAG_STRING, 20, "UPS.PowerSummary.Country", NULL, "Europe", HU_FLAG_STATIC, eaton_check_country_info }, + /* { "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, },*/ /* Battery page */ { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, @@ -1287,6 +1293,7 @@ static hid_info_t mge_hid2nut[] = { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.PresentStatus.Used", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_enabled_legacy_info }, */ /* This data is the actual ABM status information */ { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.Mode", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_status_info }, + /* FIXME: should better use UPS.BatterySystem.Charger.Status */ /* UPS page */ { "ups.efficiency", 0, 0, "UPS.PowerConverter.Output.Efficiency", NULL, "%.0f", 0, NULL }, @@ -1476,6 +1483,7 @@ static hid_info_t mge_hid2nut[] = { "outlet.1.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "PowerShare Outlet 1", HU_FLAG_ABSENT, NULL }, { "outlet.1.switchable", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.Switchable", NULL, "%s", HU_FLAG_STATIC, yes_no_info }, { "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.SwitchOn/Off", NULL, "%s", 0, on_off_info }, + /* FIXME: should better use UPS.OutletSystem.Outlet.[1].Status? */ /* For low end models, with 1 non backup'ed outlet */ { "outlet.1.status", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, "%s", 0, on_off_info }, /* FIXME: change to outlet.1.battery.charge.low, as in mge-xml.c?! */ @@ -1486,6 +1494,8 @@ static hid_info_t mge_hid2nut[] = { "outlet.1.realpower", 0, 0, "UPS.OutletSystem.Outlet.[2].ActivePower", NULL, "%.0f", 0, NULL }, { "outlet.1.current", 0, 0, "UPS.OutletSystem.Outlet.[2].Current", NULL, "%.2f", 0, NULL }, { "outlet.1.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[2].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */ + /* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info + { "outlet.1.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[2].ECOControl", NULL, "%.2f", 0, NULL },*/ /* Second outlet */ { "outlet.2.id", 0, 0, "UPS.OutletSystem.Outlet.[3].OutletID", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "outlet.2.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[3].OutletID", NULL, "PowerShare Outlet 2", HU_FLAG_ABSENT, NULL }, @@ -1495,6 +1505,7 @@ static hid_info_t mge_hid2nut[] = /* Generic version (RO) for other models */ { "outlet.2.switchable", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable", NULL, "%s", 0, yes_no_info }, { "outlet.2.status", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.SwitchOn/Off", NULL, "%s", 0, on_off_info }, + /* FIXME: should better use UPS.OutletSystem.Outlet.[1].Status? */ { "outlet.2.autoswitch.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.OutletSystem.Outlet.[3].RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.2.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[3].ShutdownTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.2.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[3].StartupTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, @@ -1502,6 +1513,8 @@ static hid_info_t mge_hid2nut[] = { "outlet.2.realpower", 0, 0, "UPS.OutletSystem.Outlet.[3].ActivePower", NULL, "%.0f", 0, NULL }, { "outlet.2.current", 0, 0, "UPS.OutletSystem.Outlet.[3].Current", NULL, "%.2f", 0, NULL }, { "outlet.2.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[3].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */ + /* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info + { "outlet.2.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[3].ECOControl", NULL, "%.2f", 0, NULL },*/ /* instant commands. */ /* splited into subset while waiting for extradata support From 7d1082c49653db3ae259a932c1a5fce0f201a17d Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Mon, 23 Sep 2024 15:46:04 +0200 Subject: [PATCH 2/7] EATON HID: completion on examples Signed-off-by: Arnaud Quette --- drivers/mge-hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 2a1e008632..3c838b3ee0 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -1258,7 +1258,7 @@ static hid_info_t mge_hid2nut[] = /* Device collection */ /* Just declared to call *hid2info */ { "device.country", ST_FLAG_STRING, 20, "UPS.PowerSummary.Country", NULL, "Europe", HU_FLAG_STATIC, eaton_check_country_info }, - /* { "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, },*/ + /* { "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, stringid_conversion },*/ /* Battery page */ { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, From e5463b7d131504ea0b833bdcf760c64d69db8698 Mon Sep 17 00:00:00 2001 From: DaRK AnGeL Date: Mon, 23 Sep 2024 21:05:40 +0300 Subject: [PATCH 3/7] first trying to add values Signed-off-by: DaRK AnGeL --- drivers/mge-hid.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 3c838b3ee0..2d0d3d388b 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -1258,8 +1258,10 @@ static hid_info_t mge_hid2nut[] = /* Device collection */ /* Just declared to call *hid2info */ { "device.country", ST_FLAG_STRING, 20, "UPS.PowerSummary.Country", NULL, "Europe", HU_FLAG_STATIC, eaton_check_country_info }, - /* { "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, stringid_conversion },*/ - + { "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */ + { "device.usb.mode", ST_FLAG_STRING, 20, "UPS.System.USB.Mode", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */ + { "device.gateway.power.rate", ST_FLAG_STRING, 20, "UPS.System.Gateway.PowerRate", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */ + /* Battery page */ { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, { "battery.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerSummary.RemainingCapacityLimitSetting", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, @@ -1292,7 +1294,7 @@ static hid_info_t mge_hid2nut[] = /* Refer to Note 1 (This point will need more clarification!) { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.PresentStatus.Used", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_enabled_legacy_info }, */ /* This data is the actual ABM status information */ - { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.Mode", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_status_info }, + { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.Status", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_status_info }, /* FIXME: should better use UPS.BatterySystem.Charger.Status */ /* UPS page */ @@ -1482,8 +1484,9 @@ static hid_info_t mge_hid2nut[] = { "outlet.1.id", 0, 0, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "outlet.1.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "PowerShare Outlet 1", HU_FLAG_ABSENT, NULL }, { "outlet.1.switchable", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.Switchable", NULL, "%s", HU_FLAG_STATIC, yes_no_info }, - { "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.SwitchOn/Off", NULL, "%s", 0, on_off_info }, + { "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[1].Status", NULL, "%s", 0, on_off_info }, /* FIXME: should better use UPS.OutletSystem.Outlet.[1].Status? */ + { "outlet.1.idesignator", 0, 0, "UPS.OutletSystem.Outlet.[1].iDesignator", NULL, "%s", 0, on_off_info }, /* needs to check */ /* For low end models, with 1 non backup'ed outlet */ { "outlet.1.status", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, "%s", 0, on_off_info }, /* FIXME: change to outlet.1.battery.charge.low, as in mge-xml.c?! */ @@ -1494,8 +1497,8 @@ static hid_info_t mge_hid2nut[] = { "outlet.1.realpower", 0, 0, "UPS.OutletSystem.Outlet.[2].ActivePower", NULL, "%.0f", 0, NULL }, { "outlet.1.current", 0, 0, "UPS.OutletSystem.Outlet.[2].Current", NULL, "%.2f", 0, NULL }, { "outlet.1.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[2].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */ - /* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info - { "outlet.1.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[2].ECOControl", NULL, "%.2f", 0, NULL },*/ + /* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info */ + { "outlet.1.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[2].ECOControl", NULL, "%.2f", 0, NULL }, /* Second outlet */ { "outlet.2.id", 0, 0, "UPS.OutletSystem.Outlet.[3].OutletID", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "outlet.2.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[3].OutletID", NULL, "PowerShare Outlet 2", HU_FLAG_ABSENT, NULL }, @@ -1504,8 +1507,7 @@ static hid_info_t mge_hid2nut[] = { "outlet.2.switchable", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable", NULL, "%s", HU_FLAG_SEMI_STATIC, pegasus_yes_no_info }, /* Generic version (RO) for other models */ { "outlet.2.switchable", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable", NULL, "%s", 0, yes_no_info }, - { "outlet.2.status", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.SwitchOn/Off", NULL, "%s", 0, on_off_info }, - /* FIXME: should better use UPS.OutletSystem.Outlet.[1].Status? */ + { "outlet.2.status", 0, 0, "UPS.OutletSystem.Outlet.[1].Status", NULL, "%s", 0, on_off_info }, { "outlet.2.autoswitch.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.OutletSystem.Outlet.[3].RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.2.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[3].ShutdownTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.2.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[3].StartupTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, @@ -1513,8 +1515,8 @@ static hid_info_t mge_hid2nut[] = { "outlet.2.realpower", 0, 0, "UPS.OutletSystem.Outlet.[3].ActivePower", NULL, "%.0f", 0, NULL }, { "outlet.2.current", 0, 0, "UPS.OutletSystem.Outlet.[3].Current", NULL, "%.2f", 0, NULL }, { "outlet.2.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[3].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */ - /* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info - { "outlet.2.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[3].ECOControl", NULL, "%.2f", 0, NULL },*/ + /* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info */ + { "outlet.2.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[3].ECOControl", NULL, "%.2f", 0, NULL }, /* instant commands. */ /* splited into subset while waiting for extradata support From 57604b2f58f7477d2c7a46c9fe37b913aa0e7a9e Mon Sep 17 00:00:00 2001 From: DaRK AnGeL Date: Tue, 24 Sep 2024 09:55:40 +0300 Subject: [PATCH 4/7] some typo fix Signed-off-by: DaRK AnGeL --- drivers/mge-hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 2d0d3d388b..a2cda9ec2b 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -1484,9 +1484,9 @@ static hid_info_t mge_hid2nut[] = { "outlet.1.id", 0, 0, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "outlet.1.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "PowerShare Outlet 1", HU_FLAG_ABSENT, NULL }, { "outlet.1.switchable", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.Switchable", NULL, "%s", HU_FLAG_STATIC, yes_no_info }, - { "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[1].Status", NULL, "%s", 0, on_off_info }, /* FIXME: should better use UPS.OutletSystem.Outlet.[1].Status? */ - { "outlet.1.idesignator", 0, 0, "UPS.OutletSystem.Outlet.[1].iDesignator", NULL, "%s", 0, on_off_info }, /* needs to check */ + { "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[1].Status", NULL, "%s", 0, on_off_info }, + { "outlet.1.designator", 0, 0, "UPS.OutletSystem.Outlet.[1].iDesignator", NULL, "%s", 0, on_off_info }, /* needs to check */ /* For low end models, with 1 non backup'ed outlet */ { "outlet.1.status", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, "%s", 0, on_off_info }, /* FIXME: change to outlet.1.battery.charge.low, as in mge-xml.c?! */ From 97603cdde464e2dc11369baa89f79f449cd34f20 Mon Sep 17 00:00:00 2001 From: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:14:02 +0300 Subject: [PATCH 5/7] some of the fixes Signed-off-by: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> --- drivers/mge-hid.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index a2cda9ec2b..86b9fbb20f 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -689,6 +689,12 @@ static info_lkp_t pegasus_yes_no_info[] = { { 0, NULL, NULL, NULL } }; +static info_lkp_t eco_pegasus_yes_no_info[] = { + { 0, "The outlet is not ECO controlled", pegasus_yes_no_info_fun, pegasus_yes_no_info_nuf }, + { 1, "The outlet is ECO controlled", pegasus_yes_no_info_fun, pegasus_yes_no_info_nuf }, + { 0, NULL, NULL, NULL } +}; + /* Determine country using UPS.PowerSummary.Country. * If not present: * if PowerConverter.Output.Voltage >= 200 => "Europe" @@ -864,6 +870,13 @@ static info_lkp_t eaton_converter_online_info[] = { { 0, NULL, NULL, NULL } }; +static info_lkp_t eaton_outlet_status_enable_disable_info[] = { + { 0, "not powered", NULL, NULL }, + { 1, "not protected", NULL, NULL }, + { 2, "protected", NULL, NULL }, + { 0, NULL, NULL, NULL } +}; + /* --------------------------------------------------------------- */ /* Vendor-specific usage table */ /* --------------------------------------------------------------- */ @@ -1259,8 +1272,8 @@ static hid_info_t mge_hid2nut[] = /* Just declared to call *hid2info */ { "device.country", ST_FLAG_STRING, 20, "UPS.PowerSummary.Country", NULL, "Europe", HU_FLAG_STATIC, eaton_check_country_info }, { "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */ - { "device.usb.mode", ST_FLAG_STRING, 20, "UPS.System.USB.Mode", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */ - { "device.gateway.power.rate", ST_FLAG_STRING, 20, "UPS.System.Gateway.PowerRate", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */ + /* { "device.usb.mode", ST_FLAG_STRING, 20, "UPS.System.USB.Mode", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* not a string (1 to set in bootloader ) */ + /*{ "device.gateway.power.rate", ST_FLAG_STRING, 20, "UPS.System.Gateway.PowerRate", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* not a string (level of power provided by the UPS to the network card */ /* Battery page */ { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, @@ -1294,8 +1307,10 @@ static hid_info_t mge_hid2nut[] = /* Refer to Note 1 (This point will need more clarification!) { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.PresentStatus.Used", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_enabled_legacy_info }, */ /* This data is the actual ABM status information */ + { "battery.charger.mode", 0, 0, "UPS.BatterySystem.Charger.Mode", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_status_info }, /* needs both ? from https://github.com/networkupstools/nut/pull/2637#discussion_r1772730590 */ { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.Status", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_status_info }, - /* FIXME: should better use UPS.BatterySystem.Charger.Status */ + /* FIXME: should better use UPS.BatterySystem.Charger.Status should work on 9E Models */ + /* UPS page */ { "ups.efficiency", 0, 0, "UPS.PowerConverter.Output.Efficiency", NULL, "%.0f", 0, NULL }, @@ -1485,8 +1500,9 @@ static hid_info_t mge_hid2nut[] = { "outlet.1.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "PowerShare Outlet 1", HU_FLAG_ABSENT, NULL }, { "outlet.1.switchable", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.Switchable", NULL, "%s", HU_FLAG_STATIC, yes_no_info }, /* FIXME: should better use UPS.OutletSystem.Outlet.[1].Status? */ - { "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[1].Status", NULL, "%s", 0, on_off_info }, - { "outlet.1.designator", 0, 0, "UPS.OutletSystem.Outlet.[1].iDesignator", NULL, "%s", 0, on_off_info }, /* needs to check */ + { "outlet.1.switch.status", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.SwitchOn/Off", NULL, "%s", 0, on_off_info }, + { "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[1].Status", NULL, "%s", 0, eaton_outlet_status_enable_disable_info }, + { "outlet.1.designator", 0, 0, "UPS.OutletSystem.Outlet.[1].iDesignator", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */ /* For low end models, with 1 non backup'ed outlet */ { "outlet.1.status", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, "%s", 0, on_off_info }, /* FIXME: change to outlet.1.battery.charge.low, as in mge-xml.c?! */ @@ -1498,7 +1514,7 @@ static hid_info_t mge_hid2nut[] = { "outlet.1.current", 0, 0, "UPS.OutletSystem.Outlet.[2].Current", NULL, "%.2f", 0, NULL }, { "outlet.1.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[2].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */ /* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info */ - { "outlet.1.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[2].ECOControl", NULL, "%.2f", 0, NULL }, + { "outlet.1.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[2].ECOControl", NULL, "%s", HU_FLAG_SEMI_STATIC, eco_pegasus_yes_no_info}, /* Second outlet */ { "outlet.2.id", 0, 0, "UPS.OutletSystem.Outlet.[3].OutletID", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "outlet.2.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[3].OutletID", NULL, "PowerShare Outlet 2", HU_FLAG_ABSENT, NULL }, @@ -1507,7 +1523,8 @@ static hid_info_t mge_hid2nut[] = { "outlet.2.switchable", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable", NULL, "%s", HU_FLAG_SEMI_STATIC, pegasus_yes_no_info }, /* Generic version (RO) for other models */ { "outlet.2.switchable", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable", NULL, "%s", 0, yes_no_info }, - { "outlet.2.status", 0, 0, "UPS.OutletSystem.Outlet.[1].Status", NULL, "%s", 0, on_off_info }, + { "outlet.2.status", 0, 0, "UPS.OutletSystem.Outlet.[1].Status", NULL, "%s", 0, on_off_info }, + /* FIXME: should better use UPS.OutletSystem.Outlet.[1].Status? */ { "outlet.2.autoswitch.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.OutletSystem.Outlet.[3].RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.2.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[3].ShutdownTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.2.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[3].StartupTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, From 4dbd3ab6f1c45194d885f768a97f8f6ae2465bca Mon Sep 17 00:00:00 2001 From: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:30:17 +0300 Subject: [PATCH 6/7] fix typo in comments Signed-off-by: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> --- drivers/mge-hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 86b9fbb20f..957ec12e9a 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -1272,8 +1272,8 @@ static hid_info_t mge_hid2nut[] = /* Just declared to call *hid2info */ { "device.country", ST_FLAG_STRING, 20, "UPS.PowerSummary.Country", NULL, "Europe", HU_FLAG_STATIC, eaton_check_country_info }, { "device.usb.version", ST_FLAG_STRING, 20, "UPS.System.USB.iVersion", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* FIXME */ - /* { "device.usb.mode", ST_FLAG_STRING, 20, "UPS.System.USB.Mode", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* not a string (1 to set in bootloader ) */ - /*{ "device.gateway.power.rate", ST_FLAG_STRING, 20, "UPS.System.Gateway.PowerRate", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, /* not a string (level of power provided by the UPS to the network card */ + /* { "device.usb.mode", ST_FLAG_STRING, 20, "UPS.System.USB.Mode", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, */ /* not useful ,not a string (1 to set in bootloader ) */ + /*{ "device.gateway.power.rate", ST_FLAG_STRING, 20, "UPS.System.Gateway.PowerRate", NULL, NULL, HU_FLAG_STATIC, stringid_conversion }, */ /* not useful , not a string (level of power provided by the UPS to the network card */ /* Battery page */ { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, From 408d5fdbdf652aeb24e81362221d25a710acdf53 Mon Sep 17 00:00:00 2001 From: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:59:44 +0300 Subject: [PATCH 7/7] add 'eco_pegasus_yes_no_info' func to uotlet.2.ecocontrol Signed-off-by: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> --- drivers/mge-hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 957ec12e9a..ce8aa4dfaa 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -1533,7 +1533,7 @@ static hid_info_t mge_hid2nut[] = { "outlet.2.current", 0, 0, "UPS.OutletSystem.Outlet.[3].Current", NULL, "%.2f", 0, NULL }, { "outlet.2.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[3].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */ /* 0: The outlet is not ECO controlled. / 1 : The outlet is ECO controlled. => Readonly! use some yes_no_info */ - { "outlet.2.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[3].ECOControl", NULL, "%.2f", 0, NULL }, + { "outlet.2.ecocontrol", 0, 0, "UPS.OutletSystem.Outlet.[3].ECOControl", NULL, "%s", HU_FLAG_SEMI_STATIC, eco_pegasus_yes_no_info}, /* instant commands. */ /* splited into subset while waiting for extradata support