<html>
<body>
Returned to office right now... :-( <br>
Now I will take a look to your corrections.<br><br>
.&nbsp;&nbsp;&nbsp; best regards<br>
_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Elio Corbolante.<br><br>
At 23:54 2009/02/05 +0100, Kjell Claesson wrote:<br>
<blockquote type=cite class=cite cite="">onsdag 04 februari 2009 23:24:11
skrev&nbsp; Arjen de Korte:<br>
Hi Arjen,<br><br>
(Sorry for the bottom quote of original mail)<br><br>
As I put it in the trunk I feel that I have to fix some of the code.<br>
Send a copy of the mail to Elio. I have made some changes to the
code,<br>
as you suggested. But I leave it up to Elio to check it out.<br><br>
I don't want to make to may changes. But it is in the trunk now.<br><br>
regards<br>
/Kjell<br><br>
P.S. Made some comments in the rest of the mail.<br>
&gt; Citeren Arnaud Quette &lt;aquette.dev@gmail.com&gt;:<br>
&gt; &gt; Author: keyson-guest<br>
&gt; &gt; Date: Wed Feb&nbsp; 4 15:03:36 2009<br>
&gt; &gt; New Revision: 1765<br>
&gt; &gt;<br>
&gt; &gt; Log:<br>
&gt; &gt; - Added mocrodowell.c/h into drivers/. add man/microdowell.8.
Adjusted<br>
&gt; &gt; drivers/Makefile.am and man/makefile.am. Adjusted the code for
2.4.0 in<br>
&gt; &gt; the microdowell.c.<br>
&gt;<br>
&gt; Besides the things already mentioned by others and the obvious<br>
&gt;<br>
&gt; formatting issue, just a couple of nits to pick:<br>
&gt; &gt; 93 <x-tab>&nbsp;</x-tab>static char *ErrMessages[] = {<br>
&gt;<br>
&gt; [...]<br>
&gt;<br>
&gt; &gt; 187
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>}<br>
Not done anything about this as....<br><br>
&gt;<br>
&gt; Consider returning the error message through something like<br>
&gt;<br>
&gt; &gt; 124
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>case
ERR_NO_ERROR:<br>
&gt; &gt; 125
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>return
&quot;OK&quot;;<br>
&gt;<br>
&gt; instead of doing this indirectly through an index in an array of
error<br>
&gt; strings. This makes sure these don't get out of sync.<br>
&gt;<br>
..it depends on how this is handled.<br>
Leave this to Elio</blockquote><br>
I will check it out<br><br>
<br>
<blockquote type=cite class=cite cite="">&gt; &gt; 547
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
dstate_setinfo(&quot;ups.StatusUPS&quot;, &quot;%08lX&quot;,<br>
&gt; &gt; ups.StatusUPS) ;<br>
&gt; &gt; 548
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
dstate_setinfo(&quot;ups.ShortStatus&quot;, &quot;%04X&quot;,<br>
&gt; &gt; ups.ShortStatus) ;<br>
&gt;<br>
&gt; Don't 'invent' new variables without discussing this on the<br>
&gt; development mailinglist. Since these are probably useful only
for<br>
&gt; debugging purposes, they shouldn't be exposed to the
server/clients<br>
&gt; anyway.<br><br>
Changed this to debug statements.</blockquote><br>
OK<br><br>
<br><br>
<blockquote type=cite class=cite cite="">&gt;<br>
&gt; &gt; 629
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
dstate_setinfo(&quot;ups.realpower&quot;, &quot;%d&quot;,<br>
&gt; &gt; (int)((float)(p[4]*256 + p[5]) * 0.6)) ;<br>
&gt;<br>
&gt; This suggests a fixed relationship between apparent and active
power.<br>
&gt; This might be the case for the nominal values, but this is not true
in<br>
&gt; the general case. So don't export 'ups.realpower' unless it is
truly<br>
&gt; measured (which is not the case here).<br><br>
Made a comment that it is calculated. Can this be
measured?</blockquote><br>
Yes, the relation between the VA and W is fixed as in the most UPS sold
on the market:<br>
Very few UPS have a cos phi of 1.0. <br>
This particular line of UPSs has a cos phi of 0.6 and the calculation of
the VA value is made integrating the current measurement (10 samples for
a half sine) so the result is very near to an RMS value.<br>
The output in W is 0.6 * VA<br><br>
<br><br>
<blockquote type=cite class=cite cite="">&gt;<br>
&gt; &gt; 645
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; poll_interval = 2;<br>
&gt;<br>
&gt; Any particular reason to hardcode this? This might surprise
people<br>
&gt; that attempt to override this value, so unless there is a real
good<br>
&gt; reason to do this, it will be confusing.<br><br>
I leave it in. Have you any good reason to have it hardcoded
Elio?</blockquote><br>
No, there were no particular reason.<br>
It can be any value but I thought that 2 seconds was reasonable.<br><br>
<br><br>
<blockquote type=cite class=cite cite="">&gt;<br>
&gt; &gt; 899
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
dstate_setinfo(&quot;ups.StatusUPS&quot;, &quot;%08lX&quot;,<br>
&gt; &gt; ups.StatusUPS) ;<br>
&gt; &gt; 900
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
dstate_setinfo(&quot;ups.ShortStatus&quot;, &quot;%04X&quot;,<br>
&gt; &gt; ups.ShortStatus) ;<br>
&gt; &gt; 905
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
dstate_setinfo(&quot;ups.time&quot;, &quot;%02d:%02d:%02d&quot;,<br>
&gt; &gt; p[6], p[7], p[8]) ;<br>
&gt;<br>
&gt; The above is a waste of effort. By the time upsdrv_shutdown()
runs,<br>
&gt; the server won't be listening anymore.<br>
&gt;<br>
Changed the status to debug messages. And removed the ups.time her,<br>
as the daemon would not get it anyway.</blockquote><br>
The UPS timer countinue to work by itself even if the computer is turned
off: if you need, you can program/enable up to 6 weekly schedules in the
UPS and it will turn ON/OFF without requiring any attached computer to
it!!!<br><br>
<br><br>
<blockquote type=cite class=cite cite="">&gt; &gt; 958
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; addvar(VAR_VALUE,
&quot;ups.delay.shutdown&quot;, &quot;Override<br>
&gt; &gt; shutdown delay (120s)&quot;);<br>
&gt; &gt; 959
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; addvar(VAR_VALUE,
&quot;ups.delay.start&quot;, &quot;Override restart<br>
&gt; &gt; delay (10s)&quot;);<br>
&gt;<br>
&gt; This doesn't work without using getval() somewhere in the
driver.<br>
Fixed this and moved some code. This can now be set from ups.conf.<br>
And as before changed during runtime.</blockquote><br>
OK<br><br>
<br><br>
<blockquote type=cite class=cite cite="">&gt; &gt; 971
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ioctl(upsfd, TIOCMBIC,
&amp;rts_bit);<br>
&gt; &gt; 972
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ioctl(upsfd, TIOCMBIC,
&amp;dtr_bit);<br>
&gt;<br>
&gt; We have library functions in serial.c to handle this. Use
them.</blockquote><br>
Unfortunately (even for the debugging functions) when I wrote the driver
(if I remember correctly) there were NO official documentation on the
OFFICIAL functions to be used in the developement of the drivers.
<br><br>
<br><br>
.&nbsp;&nbsp;&nbsp;&nbsp; best regards<br>
_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Elio Corbolante.<br><br>
<br>
<x-sigsep><p></x-sigsep>
<font face="Arial, Helvetica">Elio Corbolante<br>
e-mail:
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
eliocor@microdowell.com <br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
research@microdowell.com <br>
</font><font face="Arial, Helvetica" size=5 color="#808080"><b>Micro<i>
dowell</i> S.p.A.<br>
</b></font><font face="Arial, Helvetica" size=2>Via dei Boschi, 2<br>
33040 - Pradamano (UD) - Italia<br>
Tel. +39-0432-671758<br>
Tel. +39-0432-640142 (Assistenza Tecnica)<br>
Fax. +39-0432-671760<br>
<a href="http://www.microdowell.com/">http://www.microdowell.com</a>
</font>&nbsp;&nbsp; <br>
</body>
</html>