home *** CD-ROM | disk | FTP | other *** search
/ Dream 49 / Amiga_Dream_49.iso / beos / utils / powertrip_0.000 / PowerTrip_0.5b / PowerTrip.readme < prev   
Text File  |  1997-08-17  |  7KB  |  70 lines

  1. PowerTrip v0.50beta
  2. (c) 1997 Bob Maple - bmaple@burner.com
  3.  
  4. Introduction
  5. PowerTrip is a little daemon that runs in the background and monitors a APC SmartUPS (uninteruptable power supply).  When the power goes out, it monitors the situation and should the battery get below a certain level, it will call "shutdown" and safely shut the system down before the UPS goes completely dead.  (See the 'Quirks' section for more information).  It logs all it's activities to syslog so you can see what went on.  At the moment it's very basic; it does not pop up any GUI warning about what is happening, and it's only configurable by means of a text configuration file.  Future versions will have a more friendly GUI, and eventually I'll add other neat power monitoring features like load average graphs, spike/dip logging, etc. similar to the PowerChute software provided by APC for other platforms.
  6.  
  7.  
  8. Installation
  9. Copy the PowerTrip folder to somewhere of your choosing, and then open up the PowerTrip.cfg file in your favorite text editor and set the two options per the example.   The most important is the SerialPort option, which should be set to your preference as follows:
  10.  
  11.     BeBox hardware        serial1, serial2, serial3, or serial4
  12.     PowerMac hardware    modem or printer
  13.  
  14. To run PowerTrip, I suggest first starting it from Terminal so that in case you messed up the configuration file, you'll see the error messages.  Otherwise, double-click the PowerTrip icon.  Or, run it from your UserBootScript if you like (makes the most sense)
  15.  
  16.  
  17. Hardware Requirements
  18. This program currently only talks to the APC SmartUPS.  It might work with other APC UPSes, I don't know.  Any APC UPS which supports their intelligent remote command interface should work.  Personally, I use a SmartUPS 700.
  19.  
  20. Apparently APC supplies a variety of different cables to connect the 9-pin serial port on the back to the serial port of your computer, and each is different.  How or why, I'm not sure, but as far as I know the uniqueness would be on the APC side, not the computer serial port side.  My particular cable is the 940-0024C.  The pinout is:
  21.  
  22.     PC (9 pin)    APC (9 pin)
  23.     2 RxD        2
  24.     3 TxD        1
  25.     5 GND        9
  26.  
  27. NOTE that this pinout may or may not apply to your particular UPS!!!  Other APC supplied cables might work fine (like the 940+0024B).  As for how to roll one for PowerMac hardware running BeOS, you would have to ask someone else (sorry) or you might already have an APC supplied cable to fit Mac serial ports.
  28.  
  29.  
  30. Disclaimer
  31. The protocol that PowerTrip uses was gleaned from the Linux tool "apcd-2.5", available publically.  However, PowerTrip is in no way based on the apcd source code;  Only the APC protocol information was obtained from apcd.  From the apcupsd.c file:
  32.  
  33.  *  Parts of the code are from Miquel van Smoorenburg's powerd.c
  34.  *  Other parts are original from Christian Holtje <docwhat@uiuc.edu>
  35.  *  Smart-UPS code from Pavel Korensky's apcd.c and apcd.h
  36.  *  I believe that it is okay to say that this is Public Domain, just
  37.  *  give credit, where credit is due.
  38.  
  39. Thanks to whomever above figured out most of the UPS commands.  Also as mentioned in the header files which define the protocol:
  40.  
  41.  * The protocol description is not based on informations obtained from APC.
  42.  
  43. The protocol was figured out by someone who just sat there punching things into the UPS and seeing what came back out.  No APC non-disclosure agreements have been broken.
  44.  
  45. Finally, I do not supply any warranty for this program, either expressed or implied, and am not responsible for any damage caused by the use or mis-use of PowerTrip.  This is use-at-your-own-risk.
  46.  
  47.  
  48. Quirks
  49. At the moment, when the battery capacity goes below your specified percent, PowerTrip rather cheesily calls the 'shutdown' program to shut the system down.  This has a couple of consequences which I'm not quite sure what to do about.  First of all, if normal line power happens to come back on after the system shuts down but before the UPS runs completely out of battery power and shuts off, your system will just sit there with the "It is now safe to turn off your computer" business.  Once I figure out the best/correct way to do it, PowerTrip would shut down everything it could but leave it's self running so that it could restart the system if power gets restored.  Should the UPS go dead and shut it's self off, then you don't have a lot to worry about since when line power is restored, the computer will boot it's self.  
  50.  
  51. The other wierdness with doing it this way is that there is no standard way to force a program to quit, short of killing the thread.  So if you have other applications open with changed documents, but you don't happen to be around when the power goes off and the system shuts it's self down, you'll wind up with a screen full of "Do you wish to save your changes?"-type requestors from various apps.  Subsequently the system won't shut down and if the battery runs dead and shuts the computer off, it would have done so in shal we say a very unsafe manner.  Now, you and I both know that the Be filesystem is very solid and it probably won't make much of a difference, but now you've lost all of your unsaved-changes data in whatever apps were running.
  52.  
  53. Solution?  None that I'm aware of right now.. I think Be needs to create a new B_QUIT_REQUESTED type so that programs can be asked to terminate forcefully without any user intervention.  How each app would deal with that would be left up to the individual app;  I would think saving changes to a temporary file that could be detected the next time the program was run would be a good idea.. you know, sort of a "This document was open when I was forced to quit!  Do you wish to restore it?" kind of thing.
  54.  
  55. So, to summarize all of the above, the usefulness of PowerTrip is somewhat in question at the moment.  Suggestions are welcome.  One possible solution, if Be doesn't happen to come up with one, would be for 3rd-party apps to be able to send PowerTrip 'flattened' BMessages which could then be sent back to them when the system needed to be shut down.. that way they could deal with this new kind of "un-attended" quit request however they see fit.  I don't particularly like this idea, especially since it would make it specific to PowerTrip and not help out any other programs of this kind that might come out in the future.
  56.  
  57.  
  58. Support & Suggestions
  59. If you have any questions or suggestions, please email bmaple@burner.com.  As I said in the introduction, this is a very young program and I know it's not perfect.  It was written for fun and necessity, and I plan to update it's feature set in the future, so please don't give me any grief about the fact that it doesn't have a GUI on it and all that (it has a neat icon, what do you want?!)  Future plans include:
  60.  
  61.  * GUI for configuring the program
  62.  * GUI for warning you of your system's impending doom; IE "Power is out!" and "System is going
  63.     down soon!" messages
  64.  * Constant power monitoring;  Will be able to show dips/spikes in utility power, and show load
  65.     usage over time
  66.  * Better support for shutting the system down and starting it back up
  67.  * Support for sending messages to other PowerTrip 'clients' over a network (For instance if you
  68.     have two boxes hooked up to 1 UPS, the machine that the UPS is hooked up to can notify the
  69.     other machine over the network as if the UPS was hooked up to it directly)
  70.