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

« back to all changes in this revision

Viewing changes to drivers/cpsups.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
/* cpsups.h - Lookup tables for CyberPower text protocol UPSes
 
2
 
 
3
   Copyright (C) 2003  Walt Holman <waltabbyh@comcast.net>
 
4
   with thanks to Russell Kroll <rkroll@exploits.org>
 
5
 
 
6
   This program is free software; you can redistribute it and/or modify
 
7
   it under the terms of the GNU General Public License as published by
 
8
   the Free Software Foundation; either version 2 of the License, or
 
9
   (at your option) any later version.
 
10
 
 
11
   This program is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
   GNU General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU General Public License
 
17
   along with this program; if not, write to the Free Software
 
18
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
19
*/
 
20
 
 
21
#include "main.h"
 
22
#include "serial.h"
 
23
 
 
24
struct {
 
25
        int begin;
 
26
        int end;
 
27
}       pollstatusmap[] = {
 
28
        {  2, 6 },              /* Input Voltage */
 
29
        {  8, 12 },             /* Output Voltage */
 
30
        { 14, 16 },             /* Current Load */
 
31
        { 18, 20 },             /* Battery Charge % */
 
32
        { 22, 24 },             /* Temperature in C */
 
33
        { 26, 30 },             /* Frequency in Hz */
 
34
        { 32, 32 },
 
35
        { 33, 33 },
 
36
        { 34, 34 },
 
37
        {  0,  0 }
 
38
};
 
39
 
 
40
#define POLL_UPSSTATUS  6
 
41
 
 
42
#define ENDCHAR         13      /* replies end with CR */
 
43
#define MAXTRIES 5
 
44
#define UPSDELAY 50000  /* 50 ms delay required for reliable operation */
 
45
#define SER_WAIT_SEC    3       /* allow 3.0 sec for ser_get calls */
 
46
#define SER_WAIT_USEC   10
 
47
 
 
48
#define CPS_STAT_CAL    8
 
49
#define CPS_STAT_LB     32
 
50
#define CPS_STAT_OB     64
 
51
#define CPS_STAT_OL     144