Skip to content

Commit

Permalink
sbhid-ups: fix Eaton/MGE mapping for beeper handling
Browse files Browse the repository at this point in the history
Two HID Paths exists for handling beeper status and commands. However, only one
historic was implement, which was not actually suitable for issuing the commands
on newer units (such as 3S, 5P*, ...) (reported by Sergey Talchuk)

Closes: networkupstools#9
  • Loading branch information
aquette committed Nov 16, 2016
1 parent 2ab76e8 commit 5079c03
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/mge-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Copyright (C)
* 2003 - 2015 Arnaud Quette <[email protected]>
* 2015 Arnaud Quette <[email protected]>
* 2015 - 2016 Eaton / Arnaud Quette <[email protected]>
*
* Sponsored by MGE UPS SYSTEMS <http://www.mgeups.com>
*
Expand Down Expand Up @@ -37,7 +37,7 @@
#include "usbhid-ups.h"
#include "mge-hid.h"

#define MGE_HID_VERSION "MGE HID 1.41"
#define MGE_HID_VERSION "MGE HID 1.42"

/* (prev. MGE Office Protection Systems, prev. MGE UPS SYSTEMS) */
/* Eaton */
Expand Down Expand Up @@ -1142,6 +1142,9 @@ static hid_info_t mge_hid2nut[] =
{ "ups.timer.reboot", 0, 0, "UPS.PowerSummary.DelayBeforeReboot", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL},
{ "ups.test.result", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "%s", 0, test_read_info },
{ "ups.test.interval", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.BatterySystem.Battery.TestPeriod", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL },
/* Duplicate data for some units (such as 3S) that use a different path
* Only the first valid one will be used */
{ "ups.beeper.status", 0 ,0, "UPS.BatterySystem.Battery.AudibleAlarmControl", NULL, "%s", HU_FLAG_SEMI_STATIC, beeper_info },
{ "ups.beeper.status", 0 ,0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "%s", HU_FLAG_SEMI_STATIC, beeper_info },
{ "ups.temperature", 0, 0, "UPS.PowerSummary.Temperature", NULL, "%s", 0, kelvin_celsius_conversion },
{ "ups.power", 0, 0, "UPS.PowerConverter.Output.ApparentPower", NULL, "%.0f", 0, NULL },
Expand Down Expand Up @@ -1338,8 +1341,13 @@ static hid_info_t mge_hid2nut[] =
{ "shutdown.reboot", 0, 0, "UPS.PowerSummary.DelayBeforeReboot", NULL, "10", HU_TYPE_CMD, NULL},
{ "beeper.off", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "1", HU_TYPE_CMD, NULL },
{ "beeper.on", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL },
/* Duplicate commands for some units (such as 3S) that use a different path
* Only the first valid one will be used */
{ "beeper.mute", 0, 0, "UPS.BatterySystem.Battery.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL },
{ "beeper.mute", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL },
{ "beeper.disable", 0, 0, "UPS.BatterySystem.Battery.AudibleAlarmControl", NULL, "1", HU_TYPE_CMD, NULL },
{ "beeper.disable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "1", HU_TYPE_CMD, NULL },
{ "beeper.enable", 0, 0, "UPS.BatterySystem.Battery.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL },
{ "beeper.enable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL },

/* Command for the outlet collection */
Expand Down

0 comments on commit 5079c03

Please sign in to comment.