Hi guys,<br><br>I would like switch to battery from online my ups.<br>Is it possible?exist something command that I do it? <br><br>Thanks your help.<br><br><div class="gmail_quote">2010/4/9 Robert Jobbagy <span dir="ltr">&lt;<a href="mailto:jobbagy.robert@gmail.com">jobbagy.robert@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Arjen!<br><br>This is the my last patch to Liebert GXT2 driver.<div><div></div><div class="h5">
<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Robert Jobbagy</b> <span dir="ltr">&lt;<a href="mailto:jobbagy.robert@gmail.com" target="_blank">jobbagy.robert@gmail.com</a>&gt;</span><br>

Date: 2010/4/7<br>Subject: Re: [Nut-upsdev] Liebert GXT2 NUT driver<br>To: NUT Developers &lt;<a href="mailto:nut-upsdev@lists.alioth.debian.org" target="_blank">nut-upsdev@lists.alioth.debian.org</a>&gt;<br><br><br>Hi Guys,<br>
<br>I tested this driver and I found a bug,<br>
<br>The wrong output:<br><br>device.serial: GXT2MR15D<br>ups.firmware: 12OCT04<br>ups.mfr.date: 0428100126AF041<br>ups.serial: GXT2MR15D<br><br>The right output:<br>
<br>device.serial: 0428100126AF041<br>ups.firmware: GXT2MR15D<br>ups.mfr.date: 12OCT04<br>ups.serial: 0428100126AF041<br><br>I fix it and attached the patch.<br><br><div class="gmail_quote">2010/4/7 Spiros Ioannou <span dir="ltr">&lt;<a href="mailto:sivann@gmail.com" target="_blank">sivann@gmail.com</a>&gt;</span><div>

<div></div><div><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On the battery issue:<br>I did some tests:<br>BATTERY_CAPACITY is always 94%, no matter its charge, probably indicating its decay. <br>


BATTERY_CHARGED is always NO for me<br>BATTERY_CURRENT does actually indicate when battery is charging or discharging. In the case of discharging (ups on battery) a negative value is indicated.<br>

The correct value  can be calculated as follows:<br><br><span style="font-family: courier new,monospace;"> float f;<br> f=(signed short int)(256*H+L)/(float)100; //100 is the divider to convert value to Amperes.<br></span><br>




The actual value of BATTERY_CURRENT in Amperes need to be divided by 100:<br><b>CHARGING:</b><br><span style="font-family: courier new,monospace;"># ./upsesp2 /dev/ttyS0  BATTERY_CURRENT          </span><br style="font-family: courier new,monospace;">




<span style="font-family: courier new,monospace;">SendingM: 001,095,002,001,003,09C       BATTERY_CURRENT,bit/divider:100</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">READ    : 001,095,004,001,003, 001,056 (001 086), 0F5</span>  (returned values H,L are decimal 001 086)<br style="font-family: courier new,monospace;">




<span style="font-family: courier new,monospace;">BATTERY_CURRENT: 3.4</span><br><br><b>DISCHARGING (on battery)</b><br><span style="font-family: courier new,monospace;"># ./upsesp2 /dev/ttyS0  BATTERY_CURRENT</span><br style="font-family: courier new,monospace;">




<span style="font-family: courier new,monospace;">SendingM: 001,095,002,001,003,09C       BATTERY_CURRENT,bit/divider:100</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">READ    : 001,095,004,001,003, 0FC,020 (252 032), 0BA</span><br style="font-family: courier new,monospace;">




<span style="font-family: courier new,monospace;">BATTERY_CURRENT: -9.9</span><br><br>-9.9 comes from (255-252)*256 + (255-032) or by casting to signed short int which does the same.<br><br>After the power comes back on, between discharging and charging there is a period of no battery current (0 Amp) for a few seconds.<br>


<font color="#888888">

<br>-S<br><br></font><div class="gmail_quote"><div><div></div><div>On Tue, Apr 6, 2010 at 9:12 PM, Spiros Ioannou <span dir="ltr">&lt;<a href="mailto:sivann@gmail.com" target="_blank">sivann@gmail.com</a>&gt;</span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>

Hi,<br>I managed to find another Liebert UPS, this time a Liebert NXe 20KVA unit, so I can help with the driver again.<br>This one has 2 serial ports, one gets disabled if you connect the ethernet module. The other port is @9600bps. The 9600 is the one I use.<br>





<br>I applied Richard&#39;s patch with the bit correction, and tried the driver (after changing the bitrate), but it failed at startup because Liebert NXe doesn&#39;t provide its Serial Number. It seems when trying to read the initial UPS model,SN etc, the UPS replies an invalid 5-byte reply instead of the usual 8-byte one. I attach a debug output (hex)  from my upsesp2.c for comparison. Look at line 109 of dbg_hex.txt.<br>





<br><span style="font-family: courier new,monospace;">The solution is to replace         </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        for (i = 0; i &lt; 37; i++) {</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">with </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        for (i = 0; i &lt; 15; i++) {</span><br><br>to just check for MODEL_NAME<br>





<br>As for the CHARGED, it seems that in my case the battery BATTERY_CHARGED is always NO perhaps because the UPS uses a percentage battery charge indicator (BATTERY_CAPACITY). I&#39;m not sure I follow your logic with ANDing with the OL flag. The Charging could probably be deducted from the BATTERY_CURRENT value.This could be negative if the battery is charging, but I cannot test it right now.<br>





<br><span style="font-family: courier new,monospace;">./liebertgxt2 -a nxe -DD</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Network UPS Tools - Liebert GXT2 serial UPS driver 0.02 (2.4.3-2420)</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">Warning: This is an experimental driver.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Some features may not function correctly.</span><br>





<br>  <span style="font-family: courier new,monospace;"> 0.000000     debug level is &#39;2&#39;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.000737     send: (6 bytes) =&gt; 01 88 02 01 04 90</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.072087     read: (8 bytes) =&gt; 01 88 04 01 04 69 4c 47</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.072216     send: (6 bytes) =&gt; 01 88 02 01 05 91</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.136206     read: (8 bytes) =&gt; 01 88 04 01 05 62 65 5a</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.136343     send: (6 bytes) =&gt; 01 88 02 01 06 92</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.202086     read: (8 bytes) =&gt; 01 88 04 01 06 72 65 6b</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.202209     send: (6 bytes) =&gt; 01 88 02 01 07 93</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.266083     read: (8 bytes) =&gt; 01 88 04 01 07 20 74 29</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.266205     send: (6 bytes) =&gt; 01 88 02 01 08 94</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.328099     read: (8 bytes) =&gt; 01 88 04 01 08 58 4e 3c</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.328222     send: (6 bytes) =&gt; 01 88 02 01 09 95</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.402090     read: (8 bytes) =&gt; 01 88 04 01 09 00 20 b7</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.402212     send: (6 bytes) =&gt; 01 88 02 01 0a 96</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.468096     read: (8 bytes) =&gt; 01 88 04 01 0a 00 00 98</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.468220     send: (6 bytes) =&gt; 01 88 02 01 0b 97</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.559082     read: (8 bytes) =&gt; 01 88 04 01 0b 00 00 99</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.559205     send: (6 bytes) =&gt; 01 88 02 01 0c 98</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.623082     read: (8 bytes) =&gt; 01 88 04 01 0c 00 00 9a</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.623204     send: (6 bytes) =&gt; 01 88 02 01 0d 99</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.687179     read: (8 bytes) =&gt; 01 88 04 01 0d 00 00 9b</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.687316     send: (6 bytes) =&gt; 01 88 02 01 0e 9a</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.753149     read: (8 bytes) =&gt; 01 88 04 01 0e 00 00 9c</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.753285     send: (6 bytes) =&gt; 01 88 02 01 0f 9b</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.818205     read: (8 bytes) =&gt; 01 88 04 01 0f 00 00 9d</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.818342     send: (6 bytes) =&gt; 01 88 02 01 10 9c</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.880087     read: (8 bytes) =&gt; 01 88 04 01 10 00 00 9e</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.880210     send: (6 bytes) =&gt; 01 88 02 01 11 9d</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   0.972080     read: (8 bytes) =&gt; 01 88 04 01 11 00 00 9f</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   0.972203     send: (6 bytes) =&gt; 01 88 02 01 12 9e</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.052085     read: (8 bytes) =&gt; 01 88 04 01 12 00 00 a0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.052211     send: (6 bytes) =&gt; 01 88 02 01 13 9f</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.116147     read: (8 bytes) =&gt; 01 88 04 01 13 31 49 1b</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.116283     send: (6 bytes) =&gt; 01 88 02 01 14 a0</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.180087     read: (8 bytes) =&gt; 01 88 04 01 14 30 37 09</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.180210     send: (6 bytes) =&gt; 01 88 02 01 15 a1</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.263082     read: (8 bytes) =&gt; 01 88 04 01 15 31 52 26</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.263205     send: (6 bytes) =&gt; 01 88 02 01 16 a2</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.329086     read: (8 bytes) =&gt; 01 88 04 01 16 30 35 09</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.329210     send: (6 bytes) =&gt; 01 88 02 01 17 a3</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.395086     read: (8 bytes) =&gt; 01 88 04 01 17 32 4d 24</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.395208     send: (6 bytes) =&gt; 01 88 02 01 18 a4</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.469080     read: (8 bytes) =&gt; 01 88 04 01 18 30 36 0c</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.469202     send: (6 bytes) =&gt; 01 88 02 01 19 a5</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.533086     read: (8 bytes) =&gt; 01 88 04 01 19 00 00 a7</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.533209     send: (6 bytes) =&gt; 01 88 02 01 1a a6</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.597114     read: (8 bytes) =&gt; 01 88 04 01 1a 00 00 a8</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.597239     send: (6 bytes) =&gt; 01 88 02 01 1b a7</span><br style="font-family: courier new,monospace;">





<span style="font-family: courier new,monospace;">   1.662085     read: truncated: (5 bytes) =&gt; 01 37 01 04 3d</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   1.662194     GTX2 capable UPS not detected</span><br style="font-family: courier new,monospace;">





<br><br><br></div></div><div class="gmail_quote"><div><div></div><div><div><div></div><div>On Tue, Apr 6, 2010 at 4:32 PM, Richard Gregory <span dir="ltr">&lt;<a href="mailto:R.Gregory@liverpool.ac.uk" target="_blank">R.Gregory@liverpool.ac.uk</a>&gt;</span> wrote:<br>




</div></div></div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div><div><div></div><div>
Hi All,<br>
<br>
There were other byte swap issues with the driver, making all the bit field flags wrong. Have swapped them and can confirm the OL, OB and CHRG flags work. CHaRGing is not the inverse of Liebert&#39;s BATTERY_CHARGED flag as that means CHRG is set when the UPS is on battery. Is it reasonable to correct for this by ANDing with the OL flag?<br>






<br>
Byte swapping patch attached.<br>
<br>
<br>
Richard<br>
<br>
+--                               --+<br>
|  Biological Sciences, Room 231    |<br>
|  <a href="http://www.csc.liv.ac.uk/%7Egreg" target="_blank">http://www.csc.liv.ac.uk/~greg</a>   |<br>
+--                               --+<br>
<br>
Arjen de Korte wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Citeren Robert Jobbagy &lt;<a href="mailto:jobbagy.robert@gmail.com" target="_blank">jobbagy.robert@gmail.com</a>&gt;:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The trouble  was in the command reply buffer use.<br>
You compute the value that value = reply[6]*256+reply[5]  &lt;- it&#39;s wrong<br>
<br>
The right solution: value = reply[5] * 256 + reply[6];<br>
</blockquote>
<br>
Thanks for this patch. I just committed it to the development version.  But please note that this is an experimental driver. Most of the  functions are untested (since nobody took the time to try it out and  post the results back to the mailing list).<br>






<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
And other bug,<br>
<br>
battery.runtime compute, you divide this value 60 &lt;- it&#39;s wrong<br>
<br>
right value: divide 1.0<br>
</blockquote>
<br>
Probably not. Per the NUT standard, the &#39;battery.runtime&#39; value is  reported in seconds. As far as I understand, the UPS reports runtime  remaining in minutes, so we need to multiply by 60 here. See  &#39;docs/new-names.txt&#39; for a listing of (almost) all variables supported  in NUT.<br>






<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I continue the work on this driver,and I will write if I make a something<br>
new.<br>
</blockquote>
<br>
Please do. It should be trivial to add additional commands and  variables to the existing ones.<br>
<br>
Best regards, Arjen<br>
</blockquote>
<br></div></div></div></div><div>_______________________________________________<br>
Nut-upsdev mailing list<br>
<a href="mailto:Nut-upsdev@lists.alioth.debian.org" target="_blank">Nut-upsdev@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev</a><br></div></blockquote></div><br>
</blockquote></div><br>
<br>_______________________________________________<br>
Nut-upsdev mailing list<br>
<a href="mailto:Nut-upsdev@lists.alioth.debian.org" target="_blank">Nut-upsdev@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev</a><br></blockquote></div></div></div><br><br clear="all"><br>-- <br>Best Regards,<br>

<font color="#888888"><br>
Robert <br>
</font></div><br><br clear="all"><br></div></div>-- <br>Best Regards,<br><font color="#888888"><br>Robert <br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Best Regards,<br><br>Robert <br>