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

« back to all changes in this revision

Viewing changes to drivers/mge-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 HID (USB and serial) devices
 
2
 *
 
3
 *  Copyright (C) 2003 - 2005
 
4
 *                      Arnaud Quette <arnaud.quette@mgeups.fr>
 
5
 *
 
6
 *  Sponsored by MGE UPS SYSTEMS <http://www.mgeups.com>
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License as published by
 
10
 *  the Free Software Foundation; either version 2 of the License, or
 
11
 *  (at your option) any later version.
 
12
 *
 
13
 *  This program is distributed in the hope that it will be useful,
 
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 *  GNU General Public License for more details.
 
17
 *
 
18
 *
 
19
 *  You should have received a copy of the GNU General Public License
 
20
 *  along with this program; if not, write to the Free Software
 
21
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
22
 *
 
23
 */
 
24
 
 
25
#define MGE_HID_VERSION "MGE HID 0.7"
 
26
 
 
27
/* --------------------------------------------------------------- */
 
28
/*      Model Name formating entries                               */
 
29
/* --------------------------------------------------------------- */
 
30
 
 
31
models_name_t mge_models_names [] =
 
32
{
 
33
        /* Ellipse models */
 
34
        { "ELLIPSE", "300", -1, "ellipse 300" },
 
35
        { "ELLIPSE", "500", -1, "ellipse 500" },
 
36
        { "ELLIPSE", "650", -1, "ellipse 650" },
 
37
        { "ELLIPSE", "800", -1, "ellipse 800" },
 
38
        { "ELLIPSE", "1200", -1, "ellipse 1200" },
 
39
        /* Ellipse Premium models */
 
40
        { "ellipse", "PR500", -1, "ellipse premium 500" },
 
41
        { "ellipse", "PR650", -1, "ellipse premium 650" },
 
42
        { "ellipse", "PR800", -1, "ellipse premium 800" },
 
43
        { "ellipse", "PR1200", -1, "ellipse premium 1200" },
 
44
        /* Ellipse "Pro" */
 
45
        { "ELLIPSE", "600", -1, "Ellipse 600" },
 
46
        { "ELLIPSE", "750", -1, "Ellipse 750" },
 
47
        { "ELLIPSE", "1000", -1, "Ellipse 1000" },
 
48
        { "ELLIPSE", "1500", -1, "Ellipse 1500" },
 
49
        /* Protection Center */
 
50
        { "PROTECTIONCENTER", "420", -1, "Protection Center 420" },
 
51
        { "PROTECTIONCENTER", "500", -1, "Protection Center 500" },
 
52
        { "PROTECTIONCENTER", "675", -1, "Protection Center 675" },
 
53
        /* Evolution models */
 
54
        { "Evolution", "500", -1, "Pulsar Evolution 500" },
 
55
        { "Evolution", "800", -1, "Pulsar Evolution 800" },
 
56
        { "Evolution", "1100", -1, "Pulsar Evolution 1100" },
 
57
        { "Evolution", "1500", -1, "Pulsar Evolution 1500" },
 
58
        { "Evolution", "2200", -1, "Pulsar Evolution 2200" },
 
59
        { "Evolution", "3000", -1, "Pulsar Evolution 3000" },
 
60
        { "Evolution", "3000XL", -1, "Pulsar Evolution 3000 XL" },
 
61
        /* NOVA models */       
 
62
        { "NOVA AVR", "600", -1, "NOVA 600 AVR" },
 
63
        { "NOVA AVR", "1100", -1, "NOVA 1100 AVR" },
 
64
        /* EXtreme C (EMEA) */
 
65
        { "EXtreme", "700C", -1, "Pulsar EXtreme 700C" },
 
66
        { "EXtreme", "1000C", -1, "Pulsar EXtreme 1000C" },
 
67
        { "EXtreme", "1500C", -1, "Pulsar EXtreme 1500C" },
 
68
        { "EXtreme", "1500CCLA", -1, "Pulsar EXtreme 1500C CLA" },
 
69
        { "EXtreme", "2200C", -1, "Pulsar EXtreme 2200C" },
 
70
        { "EXtreme", "3200C", -1, "Pulsar EXtreme 3200C" },
 
71
        /* EXtreme C (USA, aka "EX RT") */
 
72
        { "EX", "700RT", -1, "Pulsar EX 700 RT" },
 
73
        { "EX", "1000RT", -1, "Pulsar EX 1000 RT" },
 
74
        { "EX", "1500RT", -1, "Pulsar EX 1500 RT" },
 
75
        { "EX", "2200RT", -1, "Pulsar EX 2200 RT" },
 
76
        { "EX", "3200RT", -1, "Pulsar EX 3200 RT" },
 
77
        /* Comet EX RT */
 
78
        { "EX", "5RT", -1, "EX 5 RT" },
 
79
        { "EX", "7RT", -1, "EX 7 RT" },
 
80
        { "EX", "11RT", -1, "EX 11 RT" },
 
81
 
 
82
        /* Galaxy 3000 */
 
83
        { "GALAXY", "3000_10", -1, "Galaxy 3000 10 kVA" },
 
84
        { "GALAXY", "3000_15", -1, "Galaxy 3000 15 kVA" },
 
85
        { "GALAXY", "3000_20", -1, "Galaxy 3000 20 kVA" },
 
86
        { "GALAXY", "3000_30", -1, "Galaxy 3000 30 kVA" },
 
87
 
 
88
        /* FIXME: To be completed (Comet, Galaxy, Esprit, ...) */
 
89
 
 
90
        /* end of structure. */
 
91
        { NULL, NULL, -1, "Generic MGE HID model" }
 
92
};
 
93
 
 
94
/* --------------------------------------------------------------- */
 
95
/*                 Data lookup table (HID <-> NUT)                 */
 
96
/* --------------------------------------------------------------- */
 
97
 
 
98
hid_info_t hid_mge[] =
 
99
{
 
100
  /* Server side variables */
 
101
  { "driver.version.internal", ST_FLAG_STRING, 5, NULL, NULL,
 
102
    DRIVER_VERSION, HU_FLAG_ABSENT | HU_FLAG_OK, NULL },
 
103
  { "driver.version.data", ST_FLAG_STRING, 11, NULL, NULL,
 
104
    MGE_HID_VERSION, HU_FLAG_ABSENT | HU_FLAG_OK, NULL },
 
105
  
 
106
  /* Battery page */
 
107
  { "battery.charge", 0, 1, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", HU_FLAG_OK, NULL },
 
108
  { "battery.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 5, 
 
109
    "UPS.PowerSummary.RemainingCapacityLimitSetting", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
 
110
  { "battery.charge.low", ST_FLAG_STRING, 5, "UPS.PowerSummary.RemainingCapacityLimit", NULL,
 
111
    "%.0f", HU_FLAG_OK | HU_FLAG_STATIC , NULL }, /* Read only */
 
112
  { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", HU_FLAG_OK, NULL },
 
113
  { "battery.temperature", 0, 0, 
 
114
    "UPS.BatterySystem.Battery.Temperature", NULL, "%.1f", HU_FLAG_OK, NULL },
 
115
  { "battery.voltage",  0, 0, "UPS.PowerSummary.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
 
116
  { "battery.voltage.nominal", 0, 0, "UPS.BatterySystem.ConfigVoltage", NULL,
 
117
    "%.1f", HU_FLAG_OK, NULL },
 
118
 
 
119
  /* UPS page */
 
120
  { "ups.load", 0, 1, "UPS.PowerSummary.PercentLoad", NULL, "%.0f", HU_FLAG_OK, NULL },
 
121
  { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
122
    "UPS.PowerSummary.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL},
 
123
  { "ups.delay.reboot", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
124
    "UPS.PowerSummary.DelayBeforeReboot", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL},
 
125
  { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
126
    "UPS.PowerSummary.DelayBeforeStartup", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL},
 
127
  { "ups.test.result", 0, 0,
 
128
    "UPS.BatterySystem.Battery.Test", NULL, "%s", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, &test_read_info[0] },
 
129
  { "ups.test.interval", ST_FLAG_RW | ST_FLAG_STRING, 8,
 
130
    "UPS.BatterySystem.Battery.TestPeriod", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
 
131
  { "ups.temperature", 0, 0, 
 
132
    "UPS.PowerSummary.Temperature", NULL, "%.1f", HU_FLAG_OK, NULL },
 
133
  /* FIXME: miss ups.power */
 
134
  { "ups.power.nominal", ST_FLAG_STRING, 5, "UPS.Flow.[4].ConfigApparentPower",
 
135
        NULL, "%.0f",HU_FLAG_OK, NULL },
 
136
 
 
137
  /* Special case: ups.status */
 
138
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, 
 
139
    "%.0f", HU_FLAG_OK | HU_FLAG_QUICK_POLL, &onbatt_info[0] },
 
140
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.Discharging", NULL, 
 
141
    "%.0f", HU_FLAG_OK | HU_FLAG_QUICK_POLL, &discharging_info[0] },
 
142
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.Charging", NULL, 
 
143
    "%.0f", HU_FLAG_OK | HU_FLAG_QUICK_POLL, &charging_info[0] },
 
144
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL,
 
145
    "%.0f", HU_FLAG_OK, &lowbatt_info[0] },
 
146
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.OverLoad", NULL,
 
147
    "%.0f", HU_FLAG_OK, &overbatt_info[0] },
 
148
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL,
 
149
    "%.0f", HU_FLAG_OK, &replacebatt_info[0] },
 
150
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL,
 
151
    "%.0f", HU_FLAG_OK | HU_FLAG_QUICK_POLL, &shutdownimm_info[0] },
 
152
  { "ups.status", 0, 1, "UPS.PowerConverter.Input.[1].PresentStatus.Buck", NULL,
 
153
    "%.0f", HU_FLAG_OK, &trim_info[0] },
 
154
  { "ups.status", 0, 1, "UPS.PowerConverter.Input.[1].PresentStatus.Boost", NULL,
 
155
    "%.0f", HU_FLAG_OK, &boost_info[0] },
 
156
  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.Good", NULL,
 
157
    "%.0f", HU_FLAG_OK, &off_info[0] },  
 
158
  /* FIXME: extend ups.status for BYPASS: */
 
159
  /* Manual bypass */
 
160
  { "ups.status", 0, 1, "UPS.PowerConverter.Input[4].PresentStatus.Used", NULL,
 
161
    "%.0f", HU_FLAG_OK, &bypass_info[0] },  
 
162
  /* Automatic bypass */
 
163
  { "ups.status", 0, 1, "UPS.PowerConverter.Input[2].PresentStatus.Used", NULL,
 
164
    "%.0f", HU_FLAG_OK, &bypass_info[0] },
 
165
 
 
166
  /* Input page */
 
167
  { "input.voltage", 0, 0, "UPS.PowerConverter.Input.[1].Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
 
168
  { "input.frequency", 0, 0, "UPS.PowerConverter.Input.[1].Frequency", NULL, "%.1f", HU_FLAG_OK, NULL },
 
169
  /* same as "input.transfer.boost.low" */
 
170
  { "input.transfer.low", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
171
    "UPS.PowerConverter.Output.LowVoltageTransfer", NULL, "%.1f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
 
172
  { "input.transfer.boost.low", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
173
    "UPS.PowerConverter.Output.LowVoltageBoostTransfer", NULL, "%.1f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
 
174
  { "input.transfer.boost.high", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
175
    "UPS.PowerConverter.Output.HighVoltageBoostTransfer", NULL, "%.1f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
 
176
  { "input.transfer.trim.low", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
177
    "UPS.PowerConverter.Output.LowVoltageBuckTransfer", NULL, "%.1f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
 
178
  /* same as "input.transfer.trim.high" */
 
179
  { "input.transfer.high", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
180
    "UPS.PowerConverter.Output.HighVoltageTransfer", NULL, "%.1f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
 
181
  { "input.transfer.trim.high", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
182
    "UPS.PowerConverter.Output.HighVoltageBuckTransfer", NULL, "%.1f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
 
183
  
 
184
  /* Output page */
 
185
  { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
 
186
  { "output.current", 0, 0, "UPS.PowerConverter.Output.Current", NULL, "%.2f", HU_FLAG_OK, NULL },
 
187
  { "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", NULL, "%.1f", HU_FLAG_OK, NULL },
 
188
  { "output.voltage.target.line", 0, 0, 
 
189
    "UPS.PowerSummary.ConfigVoltage", NULL, "%.1f", HU_FLAG_OK, NULL },
 
190
  /* FIXME: not the good one! */
 
191
  { "output.voltage.target.battery", 0, 0,
 
192
    "UPS.PowerSummary.ConfigVoltage", NULL, "%.1f", HU_FLAG_OK, NULL },
 
193
  
 
194
        /* Outlet page (using MGE UPS SYSTEMS - PowerShare technology) */
 
195
        /* TODO: add an iterative semantic [%x] to factorise outlets */
 
196
        { "outlet.0.id", 0, 0, "UPS.OutletSystem.Outlet.[1].OutletID", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_STATIC, NULL },
 
197
        { "outlet.0.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[1].OutletID",
 
198
          NULL, "Main Outlet", HU_FLAG_ABSENT | HU_FLAG_OK | HU_FLAG_STATIC, NULL },
 
199
        { "outlet.0.switchable", 0, 0, "UPS.OutletSystem.Outlet.[1].PresentStatus.Switchable",
 
200
          NULL, "%.0f", HU_FLAG_OK | HU_FLAG_STATIC, NULL },
 
201
        { "outlet.1.id", 0, 0, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_STATIC, NULL },       
 
202
        { "outlet.1.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[2].OutletID",
 
203
          NULL, "PowerShare Outlet 1", HU_FLAG_ABSENT | HU_FLAG_OK | HU_FLAG_STATIC, NULL },
 
204
        { "outlet.1.switchable", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.Switchable",
 
205
          NULL, "%.0f", HU_FLAG_OK | HU_FLAG_STATIC, NULL },
 
206
        { "outlet.1.switch", ST_FLAG_RW | ST_FLAG_STRING, 2, "UPS.OutletSystem.Outlet.[2].PresentStatus.SwitchOn/Off",
 
207
          NULL, "%.0f", HU_FLAG_OK, NULL },
 
208
        /* For low end models, with 1 non backup'ed outlet */
 
209
        { "outlet.1.switch", ST_FLAG_RW | ST_FLAG_STRING, 2, "UPS.PowerSummary.PresentStatus.ACPresent",
 
210
          NULL, "%.0f", HU_FLAG_OK, NULL },
 
211
        { "outlet.1.autoswitch.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 3,
 
212
          "UPS.OutletSystem.Outlet.[2].RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_OK, NULL },
 
213
        { "outlet.1.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
214
          "UPS.OutletSystem.Outlet.[2].DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_OK, NULL },
 
215
        { "outlet.1.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
216
          "UPS.OutletSystem.Outlet.[2].DelayBeforeStartup", NULL, "%.0f", HU_FLAG_OK, NULL },
 
217
        { "outlet.2.id", 0, 0, "UPS.OutletSystem.Outlet.[3].OutletID", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_STATIC, NULL },       
 
218
        { "outlet.2.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[3].OutletID",
 
219
          NULL, "PowerShare Outlet 2", HU_FLAG_ABSENT | HU_FLAG_OK | HU_FLAG_STATIC, NULL },
 
220
        { "outlet.2.switchable", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable",
 
221
          NULL, "%.0f", HU_FLAG_OK | HU_FLAG_STATIC, NULL },
 
222
        { "outlet.2.switch", ST_FLAG_RW | ST_FLAG_STRING, 2, "UPS.OutletSystem.Outlet.[3].PresentStatus.SwitchOn/Off",
 
223
          NULL, "%.0f", HU_FLAG_OK, NULL },
 
224
        { "outlet.2.autoswitch.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 3,
 
225
          "UPS.OutletSystem.Outlet.[3].RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_OK, NULL },
 
226
        { "outlet.2.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
227
          "UPS.OutletSystem.Outlet.[3].DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_OK, NULL },
 
228
        { "outlet.2.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 5,
 
229
          "UPS.OutletSystem.Outlet.[3].DelayBeforeStartup", NULL, "%.0f", HU_FLAG_OK, NULL },
 
230
 
 
231
  /* instant commands. */
 
232
  /* splited into subset while waiting for extradata support
 
233
   * ie: test.battery.start quick
 
234
   */
 
235
  { "test.battery.start.quick", 0, 0,
 
236
    "UPS.BatterySystem.Battery.Test", NULL, "1", /* point to good value */
 
237
    HU_TYPE_CMD | HU_FLAG_OK, &test_write_info[0] }, /* TODO: lookup needed? */
 
238
  { "test.battery.start.deep", 0, 0,
 
239
    "UPS.BatterySystem.Battery.Test", NULL, "2", /* point to good value */
 
240
    HU_TYPE_CMD | HU_FLAG_OK, &test_write_info[0] },
 
241
  { "test.battery.stop", 0, 0,
 
242
    "UPS.BatterySystem.Battery.Test", NULL, "3", /* point to good value */
 
243
    HU_TYPE_CMD | HU_FLAG_OK, &test_write_info[0] },
 
244
  { "load.off", 0, 0,
 
245
    "UPS.PowerSummary.DelayBeforeShutdown", NULL, "0", /* point to good value */
 
246
    HU_TYPE_CMD | HU_FLAG_OK, NULL },
 
247
  { "load.on", 0, 0,
 
248
    "UPS.PowerSummary.DelayBeforeStartup", NULL, "0", /* point to good value */
 
249
    HU_TYPE_CMD | HU_FLAG_OK, NULL },
 
250
 
 
251
  /* TODO: beeper.on/off, bypass.start/stop, shutdown.return/stayoff/stop/reboot[.graceful] */
 
252
 
 
253
  /* end of structure. */
 
254
  { NULL, 0, 0, NULL, NULL, NULL, 0, NULL }
 
255
};