[Nut-upsuser] Megatec serial UPS woes

Angela Williams angie at eoh.co.za
Thu Feb 7 12:20:41 UTC 2008


Hi!
This is the weirdest problem I have found for a long time!
Using nut-2.0.5 and a Gentoo powered HP Proliant ML350
I setup the config files just the same as I always do and tried to get the 
megatec driver chatting to the UPS. It worked fine on a Windoze server with 
Upsilon2000 so I have a bit of confidence in cable etc!
When I ran upsc after starting upsd to complained about stale data! Most 
unfair!
I then shutdown upsd and upsdrv and ran megatec -a rossups -DDDDD 
I found horrid messages about 
UPS doesn't return any information about its status!

Asking for UPS status ("Q1" command)...
UPS doesn't return any information about its status.

In an attempt to see if later megatec drivers solved the problem I unmasked 
nut-2.2 release and tried that
megatec -a rossups -DDDDD  produced the same result!

gatekeeper drivers # /lib/nut/megatec -a rossups -DDDDD
Network UPS Tools 2.2.0- - Megatec protocol driver 1.5.4 [megatec]
Carlos Rodrigues (c) 2003-2007

debug level is '5'
Starting UPS detection process...
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
0 out of 5 detection attempts failed (minimum failures: 2).
Asking for UPS information ("I" command)...
UPS doesn't return any information about itself.
Megatec protocol UPS detected.
Asking for UPS power ratings ("F" command)...
UPS power ratings: #230.0 013 096.0 50.0
Asking for UPS status ("Q1" command)...
UPS status: (208.5 182.0 229.3 054 50.0 2.29 39.0 00000001
96.0V battery, interval [1.6V, 2.3V].
Done setting up the UPS.
Asking for UPS status ("Q1" command)...
UPS doesn't return any information about its status.
dstate_init: sock /var/lib/nut/megatec-rossups open on fd 6
Asking for UPS status ("Q1" command)...
UPS doesn't return any information about its status.
Asking for UPS status ("Q1" command)...
UPS doesn't return any information about its status.
Signal 2: exiting


I then decided the answer was to find out what was going up and down the 
serial cable so out came the old trusty Techtronix 834 serial line monitor 
and the correct replies come back from a Q1 command!
(208.5 182.0 230.7 054 50.0 2.29 39.0 00000001c/r

Just to go one step further I used minicom to chat with ttyS0 at 2400baud 8bit 
no parity no flow controls!
Q1 results in the correct result and F seems fine to with 
#230.0 013 096.0 50.0
So I assume the comms is good!

So I decided to hack the megatec.c source at line 338 which reads
upsdebugx(1, "UPS doesn't return any information about its status.");
by adding this line to see the contents of "buffer"

upsdebugx(3, "UPS status buffer: %s", buffer);

and do a manual install with ./configure && make && make install

So now I have 2 nuts to play with!

I then ran the modified megatec program!

gatekeeper etc # /usr/local/ups/bin/megatec -a rossups -DDDD -u nut
Network UPS Tools 2.2.0- - Megatec protocol driver 1.5.4 [megatec]
Carlos Rodrigues (c) 2003-2007

debug level is '4'
Starting UPS detection process...
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
Attempting to detect the UPS...
Sending "Q1" command...
"Q1" command successful.
0 out of 5 detection attempts failed (minimum failures: 2).
Asking for UPS information ("I" command)...
UPS doesn't return any information about itself.
Megatec protocol UPS detected.
Asking for UPS power ratings ("F" command)...
UPS power ratings: #230.0 013 096.0 50.0
Asking for UPS status ("Q1" command)...
UPS status: (208.5 182.0 230.7 054 50.0 2.29 39.0 00000001
96.0V battery, interval [1.6V, 2.3V].
Done setting up the UPS.
Asking for UPS status ("Q1" command)...
UPS doesn't return any information about its status.
UPS status buffer: NAK
dstate_init: sock /var/state/ups/megatec-rossups open on fd 6
Asking for UPS status ("Q1" command)...
UPS doesn't return any information about its status.
UPS status buffer: .3 054 50.0 2.29 39.0 00000001
Asking for UPS status ("Q1" command)...
UPS doesn't return any information about its status.
UPS status buffer: .3 054 50.0 2.29 39.0 00000001
Asking for UPS status ("Q1" command)...
UPS doesn't return any information about its status.
UPS status buffer: .3 055 50.0 2.29 39.0 00000001
Signal 2: exiting

I can now see what is in "buffer" and it looks like just a few leading 
characters might just be missing!

So now I am at a loss of how to resolve this problem!
I'm not the greatest C programmer. I can read it and it makes sense but 
writing it is a real plod!

Any ideas as to what to try next?

Cheers
Ang






-- 
Angela Williams				Enterprise Outsourcing
Unix/Linux & Cisco spoken here!		Bedfordview
awilliams at eoh.co.za			Gauteng South Africa

Smile!! Jesus Loves You!!



More information about the Nut-upsuser mailing list