Philip Taylor
2015-Mar-14 11:07 UTC
[Nut-upsuser] Problems with NUT 2.7.2 on CentOS 7 and using the Mini-Box OpenUPS
Charles, Thanks again for your help, and sorry I didn?t :cc - noted for the future! I?m suspicious that the OpenUPS doesn?t behave properly in a number of ways, of which the USB traffic is the one of immediate concern. It seems to me that NUT can read from it but probably not write to it: and the OpenUPS doesn?t flag ?low battery? conditions correctly either. It does shut itself down at a battery voltage I can configure (via MS windows) and it does provide a signal via a cable to the power button that will trigger a linux shutdown - but it won?t do this via USB. So it?s useable with that work-round but not as intended! It also reports spurious values - you spotted the 3.9 million seconds! When on input power, that?s what you get for runtime! A sensible value is passed when on battery. Whether that matters is questionable. Various other values aren?t good either, like battery current when running on battery. Again that?s not too important as battery voltage, output voltage and output current are OK. Mini-box support and documentation are very poor too - but you can?t help with that! I hope you can comment on the attached debug output which you requested. I?ve provided two - one on battery and the other on input power (which is 15v for my OpenUPS). (I have higher debug level options available but you asked for -DDD) The command I used to start the driver was /usr/sbin/usbhid-ups -DDD -a openups Finally, I?d be interested in the additional debug modes for usbhid-ups. This isn?t a ?production system? currently; it?s my home automation server and it?s getting rebuilt shortly as I?ve changed tack on a few things and it needs a clean out anyway! So I will try anything! Many thanks for your help. Philip. -------------- next part -------------- A non-text attachment was scrubbed... Name: openups_drv_start_lineon.gz Type: application/x-gzip Size: 8755 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20150314/f46ffa1e/attachment-0002.bin> -------------- next part -------------- A non-text attachment was scrubbed... Name: openups_drv_start_onbatt.gz Type: application/x-gzip Size: 8920 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20150314/f46ffa1e/attachment-0003.bin> -------------- next part --------------> On 13 Mar 2015, at 23:17, Charles Lepple <clepple at gmail.com> wrote: > > On Mar 13, 2015, at 10:14 AM, Rob Groner <rgroner at RTD.com> wrote: > >>> >>> The documentation isn't explicit about this, but 'upsdrvctl shutdown' is >>> meant to be run after all of the other processes on the system have been >>> killed, real filesystems have been unmounted, and the kernel shutdown >>> syscall is about to be called. Usually the init scripts will take care of this, >>> although I don't know how CentOS handles that specifically. >>> >>> If you want to test the low-battery shutdown procedure (where upsmon >>> tells the rest of the system to shut down, then tells the UPS to power off), >>> you can run 'upsmon -c fsd' (Forced ShutDown). The init scripts should call >>> 'upsdrvctl shutdown' implicitly when everything else has stopped. >> >> I wish it were explicit. :) > > Since that comment didn't come with any documentation patches attached, I'm going to act like it never happened :) > >> You say to use FSD for testing the system...what do I use for real? > > Let's back up. I was recommending the use of 'upsmon -c fsd' for simulating the low battery condition that upsmon reacts to. That allows testing of the low battery shutdown process without actually draining the battery. It sounds like you are describing a shutdown triggered by a sysadmin, rather than upsmon. > >> I thought I was supposed to call upsdrvctl shutdown with some delay, and THEN begin shutting down my PC, in the hopes I finish before the delay expires and the UPS shuts off of the power supply. > > You could, although there is no delay parameter to 'upsdrvctl shutdown' So you are at the mercy of whether the shutdown process finishes in time. >> >> When you say "the init scripts will take care of this", do you mean that if I execute a system shutdown, it will automatically send the "upsdrvctl shutdown" command at the end? >> > > IMHO, yes, this is the job of the distribution's packager: lining up the scripts such that typing 'poweroff' will both shut down the UPS after a delay, and shut down the computer (or halt it and wait for the UPS to cut power, if the BIOS latches the power off state). If the distribution doesn't do that, then I'd call it a misconfiguration or a bug (since at that point, the packages are doing little more than helping the compilation stage). And with the proliferation of init systems, configuration will probably be distribution-specific from that point on. > > See previous comments about not knowing what CentOS does. Debian (wheezy; not sure about jessie yet) and Ubuntu have a "poweroff" action in /etc/init.d/nut-client. > > -- > Charles Lepple > clepple at gmail > > > > > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Philip Taylor
2015-Mar-17 15:46 UTC
[Nut-upsuser] Problems with NUT 2.7.2 on CentOS 7 and using the Mini-Box OpenUPS
Charles, Did you get chance to look at the data I sent you, please? I?ve done some more work myself and the conclusion I?ve reached is that if the minibus OpenUPS doesn?t support instant commands, then sending ?upsdrvctl shutdown? won?t ever work, as it would need to send instant commands! Also from the trace I sent you, it appears that after the ?RunTimeToEmpty? query, the interface tries to read a Report b1 of size 248 which results in a broken pipe. Is that correct and what would need to be done to resolve this? Or is that simply the end of the useful data, after which anything else is discarded? I?m minded to stop spending time on trying to get NUT to shut down the OpenUPS, or the and then use the following sequence : 1) UPSMON keeps track of data from the OpenUPS - I can see voltages and currents etc. using ups. And it does notifications properly. 2) It notifies me when the input power goes off and battery level drops to a critical % - set in NUT, not the OpenUPS. At (say) 11.3V it flags this as critical but doesn?t shut anything down. 3)When the battery level reaches a defined voltage - say 11.2V - the OpenUPS toggles the motherboard power switch, which triggers a controlled shutdown of the system. Initiated by the UPS and communicated on a pair of wires - not USB which I can?t get to work! 4) The OpenUPS closes itself down then (even if the power comes back in the meantime - there doesn?t seem to be a race issue) 5) When input power returns, the hardware is configured to automatically start. This isn?t ideal in my mind as it should be possible using the USB cable alone and it should be controlled from the server (NUT) but I think it?s be best the OpenUPS will do. Any comments, please? My further searching shows Nicu Pavel of mini-box asked questions on this forum in 2012 but I don?t see any good answers! And mini-box so far haven?t replied to me. Many thanks for any help you can provide. Regards, Philip.> On 14 Mar 2015, at 11:07, Philip Taylor <philip at kelsotowers.co.uk> wrote: > > Charles, > > Thanks again for your help, and sorry I didn?t :cc - noted for the future! > > I?m suspicious that the OpenUPS doesn?t behave properly in a number of ways, of which the USB traffic is the one of immediate concern. It seems to me that NUT can read from it but probably not write to it: and the OpenUPS doesn?t flag ?low battery? conditions correctly either. It does shut itself down at a battery voltage I can configure (via MS windows) and it does provide a signal via a cable to the power button that will trigger a linux shutdown - but it won?t do this via USB. So it?s useable with that work-round but not as intended! > > It also reports spurious values - you spotted the 3.9 million seconds! When on input power, that?s what you get for runtime! A sensible value is passed when on battery. Whether that matters is questionable. Various other values aren?t good either, like battery current when running on battery. Again that?s not too important as battery voltage, output voltage and output current are OK. > > Mini-box support and documentation are very poor too - but you can?t help with that! > > I hope you can comment on the attached debug output which you requested. I?ve provided two - one on battery and the other on input power (which is 15v for my OpenUPS). (I have higher debug level options available but you asked for -DDD) > > The command I used to start the driver was /usr/sbin/usbhid-ups -DDD -a openups > > Finally, I?d be interested in the additional debug modes for usbhid-ups. This isn?t a ?production system? currently; it?s my home automation server and it?s getting rebuilt shortly as I?ve changed tack on a few things and it needs a clean out anyway! So I will try anything! > > Many thanks for your help. > > Philip. > <openups_drv_start_lineon.gz><openups_drv_start_onbatt.gz> > >> On 13 Mar 2015, at 23:17, Charles Lepple <clepple at gmail.com> wrote: >> >> On Mar 13, 2015, at 10:14 AM, Rob Groner <rgroner at RTD.com> wrote: >> >>>> >>>> The documentation isn't explicit about this, but 'upsdrvctl shutdown' is >>>> meant to be run after all of the other processes on the system have been >>>> killed, real filesystems have been unmounted, and the kernel shutdown >>>> syscall is about to be called. Usually the init scripts will take care of this, >>>> although I don't know how CentOS handles that specifically. >>>> >>>> If you want to test the low-battery shutdown procedure (where upsmon >>>> tells the rest of the system to shut down, then tells the UPS to power off), >>>> you can run 'upsmon -c fsd' (Forced ShutDown). The init scripts should call >>>> 'upsdrvctl shutdown' implicitly when everything else has stopped. >>> >>> I wish it were explicit. :) >> >> Since that comment didn't come with any documentation patches attached, I'm going to act like it never happened :) >> >>> You say to use FSD for testing the system...what do I use for real? >> >> Let's back up. I was recommending the use of 'upsmon -c fsd' for simulating the low battery condition that upsmon reacts to. That allows testing of the low battery shutdown process without actually draining the battery. It sounds like you are describing a shutdown triggered by a sysadmin, rather than upsmon. >> >>> I thought I was supposed to call upsdrvctl shutdown with some delay, and THEN begin shutting down my PC, in the hopes I finish before the delay expires and the UPS shuts off of the power supply. >> >> You could, although there is no delay parameter to 'upsdrvctl shutdown' So you are at the mercy of whether the shutdown process finishes in time. >>> >>> When you say "the init scripts will take care of this", do you mean that if I execute a system shutdown, it will automatically send the "upsdrvctl shutdown" command at the end? >>> >> >> IMHO, yes, this is the job of the distribution's packager: lining up the scripts such that typing 'poweroff' will both shut down the UPS after a delay, and shut down the computer (or halt it and wait for the UPS to cut power, if the BIOS latches the power off state). If the distribution doesn't do that, then I'd call it a misconfiguration or a bug (since at that point, the packages are doing little more than helping the compilation stage). And with the proliferation of init systems, configuration will probably be distribution-specific from that point on. >> >> See previous comments about not knowing what CentOS does. Debian (wheezy; not sure about jessie yet) and Ubuntu have a "poweroff" action in /etc/init.d/nut-client. >> >> -- >> Charles Lepple >> clepple at gmail >> >> >> >> >> _______________________________________________ >> Nut-upsuser mailing list >> Nut-upsuser at lists.alioth.debian.org >> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser >
Charles Lepple
2015-Mar-18 02:32 UTC
[Nut-upsuser] Problems with NUT 2.7.2 on CentOS 7 and using the Mini-Box OpenUPS
On Mar 17, 2015, at 11:46 AM, Philip Taylor <philip at kelsotowers.co.uk> wrote:> Charles, > > Did you get chance to look at the data I sent you, please? > > I?ve done some more work myself and the conclusion I?ve reached is that if the minibus OpenUPS doesn?t support instant commands, then sending ?upsdrvctl shutdown? won?t ever work, as it would need to send instant commands!You are correct; I don't see any HU_TYPE_CMD entries in openups-hid.c. I latched on to the other error you mentioned (about claiming the device). The other HID drivers seem to trigger shutdown by writing to the various timers (e.g. UPS.PowerSummary.DelayBeforeReboot). Your firmware seems to have UPS.PowerSummary.PresentStatus.ShutdownRequested, which according to the HID PDC spec, is read/write. I wonder if the firmware responds to this?> Also from the trace I sent you, it appears that after the ?RunTimeToEmpty? query, the interface tries to read a Report b1 of size 248 which results in a broken pipe. Is that correct and what would need to be done to resolve this? Or is that simply the end of the useful data, after which anything else is discarded?A bit of explanation on the debug output: the "Report Descriptor: (739 bytes)" hex dump is the HID representation of the individual reports available. NUT parses that out, and iterates over all of the "Usage IDs" (status variables, and settings). The values for the usages are grouped in Reports, each with a one-byte ID. For instance, the UPS.PowerSummary.PresentStatus.* usages are all one bit long, and they are grouped in the 16-bit ReportID 0x40. Usually, the Usage IDs are unique. For whatever reason, they use the same ff000001.ff000001 ID for several reports, so I suspect that these reports are accessed directly by their Report ID, instead of looking up the HID Usage IDs to find a report ID. That may mean that there is another protocol to get report 0xB1, for instance - it might involve writing something to one of the other reports first. At any rate, 0xff000 is the vendor-specific prefix, so unless Mini-Box has an advanced programming guide, I am not sure what you could do with that.> I?m minded to stop spending time on trying to get NUT to shut down the OpenUPS, or the and then use the following sequence : > > 1) UPSMON keeps track of data from the OpenUPS - I can see voltages and currents etc. using ups. And it does notifications properly.Out of curiosity, which notifications? In the openups_drv_start_onbatt log, the PresentStatus values look the same as the online log. Or do you mean you got that from the ignorelb configuration?> 2) It notifies me when the input power goes off and battery level drops to a critical % - set in NUT, not the OpenUPS. At (say) 11.3V it flags this as critical but doesn?t shut anything down. > 3)When the battery level reaches a defined voltage - say 11.2V - the OpenUPS toggles the motherboard power switch, which triggers a controlled shutdown of the system. Initiated by the UPS and communicated on a pair of wires - not USB which I can?t get to work! > 4) The OpenUPS closes itself down then (even if the power comes back in the meantime - there doesn?t seem to be a race issue) > 5) When input power returns, the hardware is configured to automatically start.Good that it doesn't have the race condition.> This isn?t ideal in my mind as it should be possible using the USB cable alone and it should be controlled from the server (NUT) but I think it?s be best the OpenUPS will do. > > Any comments, please? My further searching shows Nicu Pavel of mini-box asked questions on this forum in 2012 but I don?t see any good answers! And mini-box so far haven?t replied to me.I found those threads; that has been the only contact with Mini-Box that I am aware of.> Many thanks for any help you can provide. > > Regards, Philip. > > > >> On 14 Mar 2015, at 11:07, Philip Taylor <philip at kelsotowers.co.uk> wrote: >> >> Charles, >> >> Thanks again for your help, and sorry I didn?t :cc - noted for the future! >> >> I?m suspicious that the OpenUPS doesn?t behave properly in a number of ways, of which the USB traffic is the one of immediate concern. It seems to me that NUT can read from it but probably not write to it: and the OpenUPS doesn?t flag ?low battery? conditions correctly either. It does shut itself down at a battery voltage I can configure (via MS windows) and it does provide a signal via a cable to the power button that will trigger a linux shutdown - but it won?t do this via USB. So it?s useable with that work-round but not as intended! >> >> It also reports spurious values - you spotted the 3.9 million seconds! When on input power, that?s what you get for runtime! A sensible value is passed when on battery. Whether that matters is questionable. Various other values aren?t good either, like battery current when running on battery. Again that?s not too important as battery voltage, output voltage and output current are OK. >> >> Mini-box support and documentation are very poor too - but you can?t help with that! >> >> I hope you can comment on the attached debug output which you requested. I?ve provided two - one on battery and the other on input power (which is 15v for my OpenUPS). (I have higher debug level options available but you asked for -DDD) >> >> The command I used to start the driver was /usr/sbin/usbhid-ups -DDD -a openups >> >> Finally, I?d be interested in the additional debug modes for usbhid-ups. This isn?t a ?production system? currently; it?s my home automation server and it?s getting rebuilt shortly as I?ve changed tack on a few things and it needs a clean out anyway! So I will try anything! >> >> Many thanks for your help. >> >> Philip. >> <openups_drv_start_lineon.gz><openups_drv_start_onbatt.gz>-- Charles Lepple clepple at gmail
Maybe Matching Threads
- Problems with NUT 2.7.2 on CentOS 7 and using the Mini-Box OpenUPS
- Problems with NUT 2.7.2 on CentOS 7 and using the Mini-Box OpenUPS
- Problems with NUT 2.7.2 on CentOS 7 and using the Mini-Box OpenUPS
- Problems with NUT 2.7.2 on CentOS 7 and using the Mini-Box OpenUPS
- [PATCH][RFC] OpenUPS driver