10
10
function pointers in your upsdrv_initinfo() function. Right now, there
11
11
are only two possibilities:
13
- setvar = setting UPS variables (SET protocol command)
14
- instcmd = instant UPS commands (INSTCMD protocol command)
16
If your module's function for handling variable set events is called
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
18
- new_setvar = setting UPS variables (SET VAR protocol command)
19
- new_instcmd = instant UPS commands (INSTCMD protocol command)
24
If your driver's function for handling variable set events is called
17
25
my_ups_set(), then you'd do this to add the pointer:
19
upsh.setvar = my_ups_set;
21
my_ups_set() will receive three parameters:
23
int - the type being set, see shared.h for the values
25
*char - pointer to the actual value that should be set
27
If you configure a handler for instcmd, it will receive the instant
28
command type (CMD_*) in the first int. The other two variables are
29
not currently used for instant commands, and any values found in them
27
upsh.new_setvar = my_ups_set;
29
my_ups_set() will receive two parameters:
31
const char * - the variable being changed
32
const char * - the new value
34
You should return either STAT_SET_HANDLED if your driver recognizes the
35
command, or STAT_SET_UNKNOWN if it doesn't. Other possibilities will be
36
added at some point in the future.
41
This works just like the set process, with slightly different values
42
arriving from the server.
44
upsh.new_instcmd = my_ups_cmd;
46
Your function will receive two args:
48
const char * - the command name
49
const char * - (reserved)
51
You should return eeither STAT_INSTCMD_HANDLED or STAT_INSTCMD_UNKNOWN
52
depending on whether your driver can handle the requested command.
57
Use strcasecmp. The command names arriving from upsd should be treated
58
without regards to case.