Arnaud,
On May 13, 2011 8:21am, Arnaud Quette <[email protected]> wrote:
> I've just merged your patch (r2984), with just one change: the driver
> revision was already 0.12, since I've bumped to 0.13, along with your comment.
> As a side note, could you please check to improve upsdrv_help() and
> upsdrv_makevartable() output.
>
> These should fit on a 80 column terminal, to ensure it is useful in all
> possible cases.
>
> This so needs some more formating, probably simplification and reference to
> the manual page.
I reformatted these two support function as requested. I also fixed
up the powercom man page, but can't attest to its "man page"
correctness. The attached patch file has the fixes.
Keven
Index: docs/man/powercom.txt
===================================================================
--- docs/man/powercom.txt (revision 2984)
+++ docs/man/powercom.txt (working copy)
@@ -24,84 +24,85 @@
linkman:ups.conf[5] file:
*linevoltage*='value'::
-An integer specifying the mains voltage. It can't be auto detected.
-Acceptable values are in the range of 110--120 or 220--240. The default
-is '230'.
+An integer specifying the line voltage. It can't be auto detected. Acceptable
+values are in the range of 110-120 or 220-240. The default is '230'.
*manufacturer*='name'::
-Specify the manufacturer name, which also can't be auto detected. This is
-a user defined string, so any name is acceptable. The default is
-'PowerCom'.
+Specify the manufacturer name, which also can't be auto detected. This is a
+user defined string, so any name is acceptable. The default is 'PowerCom'.
*modelname*='name'::
-Specify the model name, which also can't be auto detected. This is a
-user defined string, so any name is acceptable. The default is
-'Unknown'.
+Specify the model name, which also can't be auto detected. This is a user
+defined string, so any name is acceptable. The default is 'Unknown'.
*serialnumber*='value'::
-Like modelname above, but for the serial number. The default is
-'Unknown'.
+Like modelname above, but for the serial number. The default is 'Unknown'.
*type*='name'::
-The exact type of the communication protocol within the powercom family,
-that will be used to communicate with the UPS. The type is named after
-the first modelname that was coded with that protocol. The acceptable
-names are 'KP625AP', 'Trust', 'Egys', 'KIN', 'BNT', 'IMP' and 'BNT-other'. The
-default is 'Trust'.
+The exact type of the communication protocol within the powercom family, that
+will be used to communicate with the UPS. The type is named after the first
+modelname that was coded with that protocol. The acceptable names are
+'Trust', 'Egys', 'KP625AP', 'IMP', 'KIN', 'BNT', and 'BNT-other'.
+The default is 'Trust'.
+
-'BNT-other' is a special type for BNT 100-120V models.
-For this type you can (I think must!) specify voltage, batteryPercentage,
-loadPercentage and validationSequence.
+'BNT-other' is a special type for other BNT models (such as the 1500A at 120V
+and can be used to override ALL models using ALL of the following values.
+*shutdownArguments*={{'minutes','seconds'},'whether_minutes_should_be_used'}::
+The minutes and seconds that the UPS should wait between receiving the
+shutdown command and actually shutting off. The other argument should be set
+to the character 'n' only when the minutes value should be skipped and not
+sent to the UPS. The default is type-dependent and is given below. The braces
+and commas are mandatory. Note that there should be no whitespace characters.
+
*numOfBytesFromUPS*='value'::
-The number of bytes in a UPS frame. The default is type-dependent and
-is given below.
+The number of bytes in a UPS frame: 16 is common, 11 for 'Trust'. The default
+is type-dependent and is given below.
*methodOfFlowControl*='name'::
-The method of serial communication flow control that is engaged by the
-UPS. The default is type-dependent and is given below. Acceptable names
-are 'dtr0rts1', 'dtr1' or 'no_flow_control'.
+The method of serial communication flow control that is engaged by the UPS.
+The default is type-dependent and is given below. Acceptable names are
+'dtr0rts1', 'dtr1' or 'no_flow_control'.
-*shutdownArguments*={{'minutes','seconds'},'whether_minutes_should_be_used'}::
-The minutes and seconds that the UPS should wait between receiving the
-shutdown command and actually shutting off. The other argument should
-be set to the character 'n' only when the minutes value should be
-skipped and not sent to the UPS. The default is type-dependent and is
-given below. The braces and commas are mandatory. Note that there should
-be no whitespace characters.
+*validationSequence*={{'index1','value1'},{'index2','value2'},{'index3','value3'}}::
+(Only for types KP625AP, Trust, Egys.)
+3 pairs to be used for validating the UPS by comparing bytes of the raw data
+with constant values. The index selects the byte from the UPS (see
+numOfBytesFromUPS) and the value is for matching to the byte. The default is
+type-dependent and is given below. The braces and commas are mandatory, as
+the lack of white space characters.
-*voltage*={'coefficient1','coefficient2','coefficient3','coefficient4'}::
-(Only for types KP625AP, Trust, Egys, BNT-other.)
-A quad that is used convert the raw data to a human-readable voltage
-reading. The default is type-dependent and is given below. Do note that
-the braces and commas are mandatory, as well as the lack of whitespace
-characters.
-
-*frequency*={'coefficient1','coefficient2'}::
+*frequency*={'A','B'}::
(Only for types KP625AP, Trust, Egys.)
-A pair to convert the raw data to a human-readable frequency reading. The
-default is type-dependent and is given below. Do note that the braces
-and commas are mandatory as well, as the lack of whitespace characters.
+A pair to convert the raw frequency data to a human-readable frequency
+reading using the function 1/(A*x+B). If the raw value x IS the frequency,
+then set A=1/(x^2) and B=0. The default is type-dependent and is given below.
+Do note that the braces and commas are mandatory as well, as the lack of
+whitespace characters.
-*batteryPercentage*={'coefficient1','coefficient2','coefficient3','coefficient4','coefficient5'}::
-(Only for KP625AP, Trust, Egys, BNT-other.)
-A 5 tuple to convert the raw data to a human-readable battery percentage
-reading. The default is type-dependent and is given below. Do note that
+*loadPercentage*={'BatteryA','BatteryB','LineA','LineB'}::
+(Only for types KP625AP, Trust, Egys.)
+A quad to convert the raw load data to human readable load percentage reading
+using the function A*x+B. If the raw value x IS the Load Percent, then set
+A=1 and B=0. The default is type-dependent and is given below. Do note that
the braces and commas are mandatory, as the lack of white space
characters.
-*loadPercentage*={'coefficient1','coefficient2','coefficient3','coefficient4'}::
-(Only for types KP625AP, Trust, Egys, BNT-other.)
-A quad to convert the raw data to human readable load percentage
-reading. The default is type-dependent and is given below. Do note that
-the braces and commas are mandatory, as the lack of white space
+*batteryPercentage*={'Battery1','Battery2','Battery3','Line4','Line5'}::
+(Only for KP625AP, Trust, Egys.)
+A 5 tuple to convert the raw battery and line data to a human-readable
+battery and line percentage reading using the functions (Battery)
+A*x+B*y+C and (Line) D*x+E. If the raw value x IS the Battery Percent, then
+set A=1, B=0, C=0, D=1, E=0. The default is type-dependent and is given below.
+Do note that the braces and commas are mandatory, as the lack of white space
characters.
-*validationSequence*={{'index1','value1'},{'index2','value2'},{'index3','value3'}}::
-(Only for types KP625AP, Trust, Egys, BNT-other.)
-3 pairs to be used for validating the UPS by comparing bytes of the raw
-data with constant values. The default is type-dependent and is given
-below. The braces and commas are mandatory, as the lack of white space
+*voltage*={'240A','240B','120A','120B'}::
+(Only for types KP625AP, Trust, Egys.)
+A quad that is used convert the raw voltage data to a human-readable voltage
+reading using the function A*x+B. If the raw value x IS HALF the Voltage,
+then set A=2, B=0. The default is type-dependent and is given below. Do note
+that the braces and commas are mandatory, as well as the lack of whitespace
characters.
DEFAULT VALUES FOR THE EXTRA ARGUMENTS
@@ -112,7 +113,9 @@
serialnumber = Unknown
type = Trust
-The rest of the default values for the extra arguments are type-dependent:
+The rest of the default values for the extra arguments are type-dependent.
+However, 'BNT-other' is a special type that can be used to override ALL
+values for ALL models.
Trust
~~~~~
@@ -136,10 +139,8 @@
batteryPercentage = {5.0000,0.3268,-825.00,4.5639,-835.82}
voltage = {1.9216,-0.0977,0.9545,0.0000}
-
Egys
~~~~
-
numOfBytesFromUPS = 16
methodOfFlowControl = no_flow_control
validationSequence = {{5,0x80},{7,0},{8,0}}
@@ -149,49 +150,43 @@
batteryPercentage = {5.0000,0.3268,-825.00,2.2105,-355.37}
voltage = {1.9216,-0.0977,0.9545,0.0000}
-
IMP
~~~
-
numOfBytesFromUPS = 16
methodOfFlowControl = no_flow_control
validationSequence = {{5,0xFF},{7,0},{8,0}}
shutdownArguments = {{1,30},y}
-
KIN
~~~
-
numOfBytesFromUPS = 16
methodOfFlowControl = no_flow_control
validationSequence = {{11,0x4b},{8,0},{8,0}}
shutdownArguments = {{1,30},y}
-
BNT
~~~
-
numOfBytesFromUPS = 16
methodOfFlowControl = no_flow_control
validationSequence = {{11,0x42},{8,0},{8,0}}
shutdownArguments = {{1,30},y}
-
BNT-other
~~~~~~~~~
-
numOfBytesFromUPS = 16
methodOfFlowControl = no_flow_control
validationSequence = {{8,0},{8,0},{8,0}}
shutdownArguments = {{1,30},y}
- loadPercentage = {1.4474,0.0,0.8594,0.0}
- batteryPercentage = {5.0000,0.3268,-825.00,0.46511,0}
- voltage = {1.9216,-0.0977,0.82857,0.0000}
+ frequency = {0.00027778,0.0000}
+ loadPercentage = {1.0000,0.0,1.0000,0.0}
+ batteryPercentage = {1.0000,0.0000,0.0000,1.0000,0.0000}
+ voltage = {2.0000,0.0000,2.0000,0.0000}
AUTHOR
------
Peter Bieringer <[email protected]>,
Alexey Sidorov <[email protected]>
+Keven L. Ates <[email protected]>
SEE ALSO
--------
Index: drivers/powercom.c
===================================================================
--- drivers/powercom.c (revision 2984)
+++ drivers/powercom.c (working copy)
@@ -958,35 +958,46 @@
/* display help */
void upsdrv_help(void)
{
+ // 1 2 3 4 5 6 7 8
+ // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 MAX
printf("\n");
printf("Specify UPS information in the ups.conf file.\n");
- printf(" type: Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT','BNT-other' (default: 'Trust')\n");
- printf(" 'BNT-other' is a special type intended for BNT 100-120V models, but can be used to override ALL models.\n");
+ printf(" type: Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT',\n");
+ printf(" 'BNT-other' (default: 'Trust')\n");
+ printf(" 'BNT-other' is a special type intended for BNT 100-120V models,\n");
+ printf(" but can be used to override ALL models.\n");
printf("You can additional specify these variables:\n");
- printf(" manufacturer: Manufacturer name (default: 'PowerCom')\n");
- printf(" modelname: Model name (default: 'Unknown' or autodetected)\n");
- printf(" serialnumber: Serial number (default: Unknown)\n");
- printf(" shutdownArguments: 3 delay arguments for the shutdown operation: {{Minutes,Seconds},UseMinutes?}\n");
- printf(" where Minutes and Seconds are integer, UseMinutes? is either 'y' or 'n'.\n");
- printf("You can specify these variables if not automagically detected for types 'IMP','KIN','BNT'\n");
- printf(" linevoltage: Line voltage: 110-120 or 220-240 (default: 230)\n");
- printf(" numOfBytesFromUPS: Number of bytes in a UPS frame: 16 is common, 11 for 'Trust'\n");
- printf(" methodOfFlowControl: Flow control method for UPS: 'dtr0rts1' or 'no_flow_control'\n");
- printf(" validationSequence: 3 pairs of validation values: {{I,V},{I,V},{I,V}}\n");
- printf(" where I is the index into BytesFromUPS (see numOfBytesFromUPS)\n");
- printf(" and V is the value for the ByteIndex to match.\n");
- printf(" frequency: Input & Output Frequency conversion values: {A, B}\n");
- printf(" used in function: 1/(A*x+B)\n");
- printf(" If the raw value x IS the frequency, then A=1/(raw^2), B=0\n");
- printf(" loadPercentage: Load conversion values for Battery and Line load: {BA,BB,LA,LB}\n");
- printf(" used in function: A*x+B\n");
- printf(" If the raw value x IS the Load Percent, then A=1, B=0\n");
- printf(" batteryPercentage: Battery conversion values for Battery and Line power: {A,B,C,D,E}\n");
- printf(" used in functions: (Battery) A*x+B*y+C, (Line) D*x+E\n");
- printf(" If the raw value x IS the Battery Percent, then A=1, B=0, C=0, D=1, E=0\n");
- printf(" voltage: Voltage conversion values for 240 and 120 voltage: {240A,240B,120A,120B}\n");
- printf(" Function: A*x+B\n");
- printf(" If the raw value x IS HALF the Voltage, then A=2, B=0\n\n");
+ printf(" manufacturer: Manufacturer name (default: 'PowerCom')\n");
+ printf(" modelname: Model name (default: 'Unknown' or autodetected)\n");
+ printf(" serialnumber: Serial number (default: Unknown)\n");
+ printf(" shutdownArguments: 3 delay arguments for the shutdown operation:\n");
+ printf(" {{Minutes,Seconds},UseMinutes?}\n");
+ printf(" where Minutes and Seconds are integer, UseMinutes? is either\n");
+ printf(" 'y' or 'n'.\n");
+ printf("You can specify these variables if not automagically detected for types\n");
+ printf(" 'IMP','KIN','BNT'\n");
+ printf(" linevoltage: Line voltage: 110-120 or 220-240 (default: 230)\n");
+ printf(" numOfBytesFromUPS: Number of bytes in a UPS frame: 16 is common, 11 for 'Trust'\n");
+ printf(" methodOfFlowControl: Flow control method for UPS:\n");
+ printf(" 'dtr0rts1', 'dtr1' or 'no_flow_control'\n");
+ printf(" validationSequence: 3 pairs of validation values: {{I,V},{I,V},{I,V}}\n");
+ printf(" where I is the index into BytesFromUPS (see numOfBytesFromUPS)\n");
+ printf(" and V is the value for the ByteIndex to match.\n");
+ printf(" frequency: Input & Output Frequency conversion values: {A, B}\n");
+ printf(" used in function: 1/(A*x+B)\n");
+ printf(" If the raw value x IS the frequency, then A=1/(x^2), B=0\n");
+ printf(" loadPercentage: Load conversion values for Battery and Line load: {BA,BB,LA,LB}\n");
+ printf(" used in function: A*x+B\n");
+ printf(" If the raw value x IS the Load Percent, then A=1, B=0\n");
+ printf(" batteryPercentage: Battery conversion values for Battery and Line power:\n");
+ printf(" {A,B,C,D,E}\n");
+ printf(" used in functions: (Battery) A*x+B*y+C, (Line) D*x+E\n");
+ printf(" If the raw value x IS the Battery Percent, then\n");
+ printf(" A=1, B=0, C=0, D=1, E=0\n");
+ printf(" voltage: Voltage conversion values for 240 and 120 voltage:\n");
+ printf(" {240A,240B,120A,120B}\n");
+ printf(" used in function: A*x+B\n");
+ printf(" If the raw value x IS HALF the Voltage, then A=2, B=0\n\n");
printf("Example for BNT1500AP in ups.conf:\n");
printf("[BNT1500AP]\n");
@@ -1029,20 +1040,36 @@
/* define possible arguments */
void upsdrv_makevartable(void)
{
- addvar(VAR_VALUE, "type", "Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT','BNT-other' (default: 'Trust')");
- addvar(VAR_VALUE, "manufacturer", "Manufacturer name (default: 'PowerCom')");
- addvar(VAR_VALUE, "modelname", "Model name [cannot be detected] (default: Unknown)");
- addvar(VAR_VALUE, "serialnumber", "Serial number [cannot be detected] (default: Unknown)");
- addvar(VAR_VALUE, "shutdownArguments", "Delay values for shutdown: Minutes, Seconds, UseMinutes?'y'or'n'");
- addvar(VAR_VALUE, "linevoltage", "Line voltage 110-120 or 220-240 V (default: 230)");
- addvar(VAR_VALUE, "numOfBytesFromUPS", "The number of bytes in a UPS frame");
- addvar(VAR_VALUE, "methodOfFlowControl", "Flow control method for UPS: 'dtr0rts1' or 'no_flow_control'");
- addvar(VAR_VALUE, "validationSequence", "Validation values: ByteIndex, ByteValue x 3");
+ // 1 2 3 4 5 6 7 8
+ //2345678901234567890123456789012345678901234567890123456789012345678901234567890 MAX
+ addvar(VAR_VALUE, "type",
+ "Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT','BNT-other'\n"
+ " (default: 'Trust')");
+ addvar(VAR_VALUE, "manufacturer",
+ "Manufacturer name (default: 'PowerCom')");
+ addvar(VAR_VALUE, "modelname",
+ "Model name [cannot be detected] (default: Unknown)");
+ addvar(VAR_VALUE, "serialnumber",
+ "Serial number [cannot be detected] (default: Unknown)");
+ addvar(VAR_VALUE, "shutdownArguments",
+ "Delay values for shutdown: Minutes, Seconds, UseMinutes?'y'or'n'");
+ addvar(VAR_VALUE, "linevoltage",
+ "Line voltage 110-120 or 220-240 V (default: 230)");
+ addvar(VAR_VALUE, "numOfBytesFromUPS",
+ "The number of bytes in a UPS frame");
+ addvar(VAR_VALUE, "methodOfFlowControl",
+ "Flow control method for UPS: 'dtr0rts1' or 'no_flow_control'");
+ addvar(VAR_VALUE, "validationSequence",
+ "Validation values: ByteIndex, ByteValue x 3");
if ( strcmp(types[type].name, "KIN") && strcmp(types[type].name, "BNT") && strcmp(types[type].name, "IMP")) {
- addvar(VAR_VALUE, "frequency", "Frequency conversion values: FreqFactor, FreqConst");
- addvar(VAR_VALUE, "loadPercentage", "Load conversion values: OffFactor, OffConst, OnFactor, OnConst");
- addvar(VAR_VALUE, "batteryPercentage", "Battery conversion values: OffFactor, LoadFactor, OffConst, OnFactor, OnConst");
- addvar(VAR_VALUE, "voltage", "Voltage conversion values: 240VFactor, 240VConst, 120VFactor, 120VConst");
+ addvar(VAR_VALUE, "frequency",
+ "Frequency conversion values: FreqFactor, FreqConst");
+ addvar(VAR_VALUE, "loadPercentage",
+ "Load conversion values: OffFactor, OffConst, OnFactor, OnConst");
+ addvar(VAR_VALUE, "batteryPercentage",
+ "Battery conversion values: OffFactor, LoadFactor, OffConst, OnFactor, OnConst");
+ addvar(VAR_VALUE, "voltage",
+ "Voltage conversion values: 240VFactor, 240VConst, 120VFactor, 120VConst");
}
}
_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev