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

« back to all changes in this revision

Viewing changes to docs/commands.txt

  • 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
1
Desc: Commands sent to the UPS drivers
2
2
File: commands.txt
3
 
Date: 30 June 2003
 
3
Date: 9 January 2004
4
4
Auth: Russell Kroll <rkroll@exploits.org>
5
5
 
6
6
upsd can call drivers to store values in read/write variables and to kick
7
7
off instant commands.  This is how you register handlers for those events.
8
8
 
9
 
upscommon has a structure called upsh.  You should populate it with
10
 
function pointers in your upsdrv_initinfo() function.  Right now, there
11
 
are only two possibilities:
12
 
 
13
 
Note: these have "new_" in front as a temporary measure to allow old
14
 
drivers and new drivers to coexist in the tree for a little while.  The 
15
 
final names will not have that prefix, and this note will disappear from
16
 
this file.
17
 
 
18
 
        - new_setvar  = setting UPS variables (SET VAR protocol command)
19
 
        - new_instcmd = instant UPS commands (INSTCMD protocol command)
 
9
The driver core (drivers/main.c) has a structure called upsh.  You
 
10
should populate it with function pointers in your upsdrv_initinfo()
 
11
function.  Right now, there are only two possibilities:
 
12
 
 
13
        - setvar  = setting UPS variables (SET VAR protocol command)
 
14
        - instcmd = instant UPS commands (INSTCMD protocol command)
20
15
 
21
16
SET
22
17
---
24
19
If your driver's function for handling variable set events is called 
25
20
my_ups_set(), then you'd do this to add the pointer:
26
21
 
27
 
        upsh.new_setvar = my_ups_set;
 
22
        upsh.setvar = my_ups_set;
28
23
 
29
24
my_ups_set() will receive two parameters:
30
25
 
41
36
This works just like the set process, with slightly different values
42
37
arriving from the server.
43
38
 
44
 
        upsh.new_instcmd = my_ups_cmd;
 
39
        upsh.instcmd = my_ups_cmd;
45
40
 
46
41
Your function will receive two args:
47
42
 
48
43
        const char * - the command name
49
44
        const char * - (reserved)
50
45
 
51
 
You should return eeither STAT_INSTCMD_HANDLED or STAT_INSTCMD_UNKNOWN
 
46
You should return either STAT_INSTCMD_HANDLED or STAT_INSTCMD_UNKNOWN
52
47
depending on whether your driver can handle the requested command.
53
48
 
54
49
Notes