~ubuntu-branches/ubuntu/saucy/nut/saucy

« back to all changes in this revision

Viewing changes to drivers/apc-hid.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-07-20 19:48:50 UTC
  • mto: (16.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050720194850-oo61wjr33rrx2mre
Tags: upstream-2.0.2
ImportĀ upstreamĀ versionĀ 2.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  mgehid.h - data to monitor MGE UPS SYSTEMS USB/HID devices with NUT
 
2
 *
 
3
 *  Copyright (C)  
 
4
 *      2003 - 2005     Arnaud Quette <arnaud.quette@free.fr>
 
5
 *      2005            John Stamp <kinsayder@hotmail.com>
 
6
 *
 
7
 *  Sponsored by MGE UPS SYSTEMS <http://www.mgeups.com>
 
8
 *
 
9
 *  This program is free software; you can redistribute it and/or modify
 
10
 *  it under the terms of the GNU General Public License as published by
 
11
 *  the Free Software Foundation; either version 2 of the License, or
 
12
 *  (at your option) any later version.
 
13
 *
 
14
 *  This program is distributed in the hope that it will be useful,
 
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 *  GNU General Public License for more details.
 
18
 *
 
19
 *
 
20
 *  You should have received a copy of the GNU General Public License
 
21
 *  along with this program; if not, write to the Free Software
 
22
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
23
 *
 
24
 */
 
25
 
 
26
#define APC_HID_VERSION "APC HID 0.7"
 
27
 
 
28
/* --------------------------------------------------------------- */
 
29
/*      Model Name formating entries                               */
 
30
/* --------------------------------------------------------------- */
 
31
 
 
32
models_name_t apc_models_names [] =
 
33
{
 
34
 
 
35
  { "BackUPS 500", "500", -1, "BackUPS 500" },
 
36
 
 
37
/*   { "BackUPS Pro", 11, NULL, "FW", 0 }, */
 
38
/*   { "Back-UPS ES", 11, NULL, "FW", 0 },  */
 
39
/*   { "Smart-UPS", 9, NULL, "FW",  0 }, */
 
40
/*   { "BackUPS ", 8, NULL, " ", 0 }, */
 
41
 
 
42
        /* end of structure. */
 
43
        { NULL, NULL, -1, "Generic MGE HID model" }
 
44
};
 
45
 
 
46
 
 
47
/* HID2NUT lookup table */
 
48
hid_info_t hid_apc[] = {
 
49
  /* Server side variables */
 
50
  { "driver.version.internal", ST_FLAG_STRING, 5, NULL, NULL,
 
51
    DRIVER_VERSION, HU_FLAG_ABSENT | HU_FLAG_OK, NULL },
 
52
  { "driver.version.data", ST_FLAG_STRING, 11, NULL, NULL,
 
53
    APC_HID_VERSION, HU_FLAG_ABSENT | HU_FLAG_OK, NULL },
 
54
  
 
55
  /* Battery page */
 
56
  { "battery.charge", 0, 1, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", HU_FLAG_OK, NULL },
 
57
  { "battery.charge.low", ST_FLAG_STRING, 5, "UPS.PowerSummary.RemainingCapacityLimit", NULL,
 
58
    "%.0f", HU_FLAG_OK, NULL }, /* Read only */
 
59
  { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", HU_FLAG_OK, NULL },
 
60
  { "battery.voltage",  0, 0, "UPS.PowerSummary.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
 
61
  { "battery.voltage.nominal", 0, 0, "UPS.Battery.ConfigVoltage", NULL,
 
62
    "%.1f", HU_FLAG_OK, NULL },
 
63
  { "battery.temperature", 0, 0,
 
64
    "UPS.Battery.Temperature", NULL, "%.1f", HU_FLAG_OK, NULL },
 
65
 
 
66
  /* UPS page */
 
67
  { "ups.load", 0, 1, "UPS.Output.PercentLoad", NULL, "%.0f", HU_FLAG_OK, NULL },
 
68
  { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
69
    "UPS.PowerSummary.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_OK, NULL},
 
70
  { "ups.test.result", 0, 0,
 
71
    "UPS.Battery.Test", NULL, "%s", HU_FLAG_OK, &test_read_info[0] },
 
72
  { "ups.temperature", 0, 0,
 
73
    "UPS.Battery.Temperature", NULL, "%.1f", HU_FLAG_OK, NULL },
 
74
 
 
75
  /* Special case: ups.status */
 
76
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.ACPresent", NULL,
 
77
    "%.0f", HU_FLAG_OK, &onbatt_info[0] },
 
78
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.Discharging",NULL, 
 
79
    "%.0f", HU_FLAG_OK, &discharging_info[0] },
 
80
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.Charging", NULL,
 
81
    "%.0f", HU_FLAG_OK, &charging_info[0] },
 
82
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL,
 
83
    "%.0f", HU_FLAG_OK, &lowbatt_info[0] },
 
84
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.OverLoad", NULL,
 
85
    "%.0f", HU_FLAG_OK, &overbatt_info[0] },
 
86
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL,
 
87
    "%.0f", HU_FLAG_OK, &replacebatt_info[0] },
 
88
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL,
 
89
    "%.0f", HU_FLAG_OK, &shutdownimm_info[0] },
 
90
 
 
91
  /* Input page */
 
92
  { "input.voltage", 0, 0, "UPS.Input.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
 
93
 
 
94
  /* Output page */
 
95
  { "output.voltage", 0, 0, "UPS.Output.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
 
96
  { "output.voltage.target.line", 0, 0,
 
97
    "UPS.Output.ConfigVoltage", NULL, "%.1f", HU_FLAG_OK, NULL },
 
98
 
 
99
  /* instant commands. */
 
100
  /* splited into subset while waiting for extradata support
 
101
   * ie: test.battery.start quick
 
102
   */
 
103
  { "test.battery.start.quick", 0, 0,
 
104
    "UPS.BatterySystem.Battery.Test", NULL, "1", /* point to good value */
 
105
    HU_TYPE_CMD | HU_FLAG_OK, &test_write_info[0] }, /* TODO: lookup needed? */
 
106
  { "test.battery.start.deep", 0, 0,
 
107
    "UPS.BatterySystem.Battery.Test", NULL, "2", /* point to good value */
 
108
    HU_TYPE_CMD | HU_FLAG_OK, &test_write_info[0] },
 
109
  { "test.battery.stop", 0, 0,
 
110
    "UPS.BatterySystem.Battery.Test", NULL, "3", /* point to good value */
 
111
    HU_TYPE_CMD | HU_FLAG_OK, &test_write_info[0] },
 
112
  { "load.off", 0, 0,
 
113
    "UPS.PowerSummary.DelayBeforeShutdown", NULL, "0", /* point to good value */
 
114
    HU_TYPE_CMD | HU_FLAG_OK, NULL },
 
115
  { "load.on", 0, 0,
 
116
    "UPS.PowerSummary.DelayBeforeStartup", NULL, "0", /* point to good value */
 
117
    HU_TYPE_CMD | HU_FLAG_OK, NULL },
 
118
 
 
119
        /* FIXME (@John): is it a good mapping considering the behaviour? */
 
120
        { "shutdown.return", 0, 0, "UPS.APC860052.APCForceShutdown",
 
121
                NULL, "1", /* point to good value */
 
122
                HU_TYPE_CMD | HU_FLAG_OK, NULL },
 
123
 
 
124
 
 
125
  /* TODO: beeper.on/off, bypass.start/stop, shutdown.return/stayoff/stop/reboot[.graceful] */
 
126
 
 
127
  /* end of structure. */
 
128
  { NULL, 0, 0, NULL, NULL, NULL, 0, NULL }
 
129
};