Re: [Nut-upsuser] Support of amp; amp; quot; shutdown.returnamp; amp; quot; on a APC Back-UPS CS 500

2011-01-18 Thread Kevin
Arjen de Korte nut+users at de-korte.org writes:

 
 Citeren Kevin bakdong at gmail.com:
 
  Have you tried the latest version (nut-2.6.0) that was released only a
  couple of days ago? Chances are that it might just work, since we have
  seen reports about people running the CS 500 in recent years.
  Yes, I have now had a chance to try this version and can confirm that it 
does
  not work on either the Smart-1000 or the CS 500. It shuts them both  
  down, never
  to start up again without operator intervention.
 
 Please post the first 30 seconds worth of
 
  /path/to/usbhid-ups -DD -u root -a upsname  APC_CS500.txt 21
 
 here. Make sure to stop any running driver before doing so and be so  
 kind to zip the resulting logfile.
 
  (I should make it clear that I only use these in a server  
  environment, so I am
  only interested in the shutdown function for the PC and the sleep/hibernate
  commands for the UPS.)
 
  I have also done some experimenting with the working executables that I 
have,
  running them in debug mode. The output of the hidups indicated
  setvalue(0xff860077c,1) so I modified the code from nut-2.0.0 as follows:
 
  void upsdrv_shutdown(void)
  {
  /* XXX: replace with a proper shutdown function
  fatalx(shutdown not supported); */
 
  /* 1) set DelayBeforeStartup */
  if (getval (ondelay))
  ondelay = atoi (getval (ondelay));
 
  /* setvalue(UPS_WAKEDELAY, ondelay); */ /* commented out  
  this line for
  APC CS 500 */
 
  /* 2) set DelayBeforeShutdown */
  if (getval (offdelay))
  offdelay = atoi (getval (offdelay));
 
  /* setvalue(UPS_GRACEDELAY, offdelay); */
  setvalue(0xff86007c, 1);
  }
 
 This version is way too old to be of any use. We already know that  
 0xff86007c is APCDelayBeforeReboot and we already try that after the  
 shutdown.return command fails. Only if that one fails too, we use  
 load.off.delay.
 
  I haven't finished testing the Smart-1000 yet. I have code that works, and
  outputs the following:
 
  Initiating UPS shutdown
  upsdrv_shutdown...
  instcmd(shutdown.return, [NULL])
  find_nut_info: unknown info type: shutdown.return
 
  instcmd(load.on.delay, [NULL])
  find_nut_info: unknown info type: load.on.delay
 
  instcmd: info element unavailable load.on.delay
 
  instcmd(shutdown.reboot, [NULL])
  Report[set]: (4 bytes) = 13 0a 00 00
  upsdrv_cleanup...
 
 This is what the nut-2.6.0 usbhid-ups driver will do by default, so  
 I'm not surprised. Double check which version of the driver you're  
 running in your tests (preferably by checking with 'upsc'). I will not  
 answer further messages unless you make clear which version of the  
 driver you're running and whether or not you modified it.
 
 Best regards, Arjen


Hi Arjen,

I have some more results for you:

After a further day testing, I have found that the two devices behave 
differently.

To avoid any confusion, I ran the following:

wget http://www.networkupstools.org/source/2.6/nut-2.6.0.tar.gz
tar xvf nut-2.6.0.tar.gz (note: despite the name, this is not a gzipped 
file)
cd nut-2.6.0
./configure  --prefix= --sysconfdir=/etc/ups --with-statepath=/var/run/nut --
with-user=nut --with-group=uucp --without-serial
make
cd drivers/
./usbhid-ups -D -k -a apc1500


Last few lines of output:

   0.686042 Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, 
ReportID: 0x14, Offset: 0, Size: 8, Value: 2
   0.686059 send_to_all: ADDCMD beeper.disable
   0.686075 hid_lookup_usage: UPS - 00840004
   0.686092 hid_lookup_usage: PowerSummary - 00840024
   0.686107 hid_lookup_usage: AudibleAlarmControl - 0084005a
   0.686121 string_to_path: depth = 3
   0.686139 Report[buf]: (2 bytes) = 14 02
   0.686154 PhyMax = 0, PhyMin = 0, LogMax = 3, LogMin = 1
   0.686168 Unit = , UnitExp = 0
   0.686182 Exponent = 0
   0.686198 Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, 
ReportID: 0x14, Offset: 0, Size: 8, Value: 2
   0.686228 send_to_all: ADDCMD beeper.mute
   0.686250 send_to_all: ADDCMD load.off
   0.686274 send_to_all: ADDCMD load.on
   0.686293 send_to_all: ADDCMD shutdown.return
   0.686310 send_to_all: ADDCMD shutdown.stayoff
   0.686325 Initiating UPS shutdown
   0.686340 upsdrv_shutdown...
   0.686365 instcmd(shutdown.return, [NULL])
   0.686382 find_nut_info: unknown info type: shutdown.return
   0.686398 instcmd(load.on.delay, 30)
   0.686433 Unit = 1001, UnitExp = 0
   0.686450 Exponent = 0
   0.686464 PhyMax = 0, PhyMin = 0, LogMax = 32767, LogMin = -1
   0.690437 Report[set]: (3 bytes) = 28 1e 00
   0.690437 Set report succeeded
   0.690437 instcmd: SUCCEED

   0.690437 instcmd(load.off.delay, 20)
   0.690437 Unit = 1001, UnitExp = 0
   0.690437 Exponent = 0
   0.690437 PhyMax = 0, PhyMin = 0, LogMax = 32767, LogMin = -1
   0.695437  

Re: [Nut-upsuser] Support of amp; amp; quot; shutdown.returnamp; amp; quot; on a APC Back-UPS CS 500

2011-01-18 Thread Arjen de Korte

Citeren Kevin bakd...@gmail.com:


   0.686325 Initiating UPS shutdown
   0.686340 upsdrv_shutdown...
   0.686365 instcmd(shutdown.return, [NULL])
   0.686382 find_nut_info: unknown info type: shutdown.return


This is normal. Some UPS'es (models that have a HID layer around an  
essential serial interface) support a command that will result in what  
NUT calls 'shutdown.return', so that's what we try first. A true HID  
PDC UPS (like the APC models you have) don't, so this command is not  
found. This is exactly what we expect.



   0.686398 instcmd(load.on.delay, 30)
   0.686433 Unit = 1001, UnitExp = 0
   0.686450 Exponent = 0
   0.686464 PhyMax = 0, PhyMin = 0, LogMax = 32767, LogMin = -1
   0.690437 Report[set]: (3 bytes) = 28 1e 00
   0.690437 Set report succeeded
   0.690437 instcmd: SUCCEED


In a HID PDC UPS, you need to set both the timer for shutdown and  
(re)start independently. They start counting down immediately after  
setting the report, so we set the (re)start timer...



   0.690437 instcmd(load.off.delay, 20)
   0.690437 Unit = 1001, UnitExp = 0
   0.690437 Exponent = 0
   0.690437 PhyMax = 0, PhyMin = 0, LogMax = 32767, LogMin = -1
   0.695437 Report[set]: (3 bytes) = 12 14 00
   0.695437 Set report succeeded
   0.695437 instcmd: SUCCEED


...before the stop timer, so that we don't get stuck if the power is  
lost. In that case, the (re)start timer will have expired and a UPS  
will not start again.



APC CS 500
This shuts down the APC CS 500 after 20 seconds.  (and it stays shutdown)


This probably means the driver called 'load.off.delay 20', which is  
the last resort option for the usbhid-ups. It looks like it doesn't  
have a mapping for 'shutdown.reboot', which the logs you have produced  
should reveal.



APC Smart-UPS 1000
If the power is left on, switches to battery and back online after 2 seconds.


Either the HID PDC implementation in this UPS is broken or what you're  
seeing is 'shutdown.reboot'. The timers are in seconds and with mains  
present, the UPS should stop 20 seconds after running this command and  
resume again 10 (30-20) seconds later.


If the power is off, goes to sleep after 90 seconds. (and comes back  
on when the power is connected)


This is broken either way. There is nothing we can do about that.

Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser