🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.archives
Article #175

[comp.windows.x.apps] XUPS update available

#175
From: Dan Lentz
Date: Sat, 25 Jul 1992 09:39
202 lines
8159 bytes
Archive-name: auto/comp.windows.x.apps/XUPS-update-available


	Forgot to crosspost...

	A new version of xups is available for ftp from ftp.scripps.edu and
ftp.math.psu.edu.  The new version includes substantial new features which
I describe very crypticly in the readme file below. :)  

  ---------------------------------------------------------------------------

			       X U P S

			     Version 1.4B


	 An XView based UPS monitor for the X Window system.
			     By Dan Lentz

			       7/22/92

mail lance@diu.cms.udel.edu to get on the mailing list.
---------------------------------------------------------------------------

0.0 CHANGES TO XUPS:

	o This version uses heiroglyphics for the buttons.  It's not my 
	  favourite way to do things, but it did allow me to get two
	  more buttons on without using any extra real estate.  

	o ANOTHER STATUS WINDOW.  This one shows you what's going on in 
	  the Alarm Status Register (battery charge, temperature 
	  conditions) as well as other useful information.

	o Nicer About Box.  An ego thing.

	o I decided to keep the feature that the xups client will run a
	  script when the inverter comes on; I didn't move it to the
	  daemon BUT...

0.1 CHANGES TO UPSD

	o Added multi script calling feature.  Now, the daemon will
	  run a script when the inverter clicks on.  It will call a
	  different script (to be used for shutting down) when the
	  inverter is still on and the run time remaining has gotten
	  low (configurable---see config.h). THE DAEMON QUITS AFTER
	  RUNNING THE SHUTDOWN SCRIPT. 

	o Cleaned up a couple of things that caused an infinite blocking
	  state on some machines.  

0.9 WHO YOU SHOULD BE

	You need to be a person who has access to an X station
complete with the XView libraries.  You also need to have a BEST MD
series UPS, or compatible hooked up to the serial port as described in
the manual.  This program can be modified, or course, to run with
other UPS's.  I'll talk about that later.
	And also you need your kernel configured for shared memory.
This program is untested, except on a SPARC IPX running SunOS 4.1.1.
I didn't do anything terribly bizarre, though, so any changes that
need to be made should be minimal.
	

1.0 THE PURPOSE 

	The xups package is basically something designed so that you can
have yet another nifty window on your desktop.  Other than that, it
allows you to monitor the status of the UPS and create a shell script
to be executed for different purposes:

	- One that the xups client will call if the inverter clicks on.
	  This shouldn't do anything really important, since at any given
	  time the client may not be running.

	- One that the daemon runs if the inverter clicks on.  This should
	  probably be set up to send mail to the superuser, or append 
	  something to a log file, or whatever. 

	- One that the daemon runs if the inverter is still on and the
	  run time remaining is low.  This should shut down the system.

1.1 THE NATURE OF THE BEAST

	This package works in two parts: UPSD and XUPS.  UPSD runs in
the background all the time.  It allocates 81 bytes of shared memory
to hold the 80 character hex status string that the UPS sends back.
Then, once a second it polls the UPS and updates that status string.
Once per minute it writes some stats to a logfile.  As mentioned
above, it has the ability to call two different scripts depending on
the situation.  XUPS is the front end.  It sets ups a timer to parse
that 81 character shared memory string once per second, and update the
display.  It also executes a shell script (specified in config.h) when
the inverter goes on, and draws a new bitmap in the base window.
	Xups was created using ansi C (compiled with sun CC) and sun's
devguide 3.0. 

2.0 INSTALLATION

	First, edit config.h to reflect your local setup.  

	Make sure that you specify sane scripts to run, edit mine, or
just leave them like they are.

	Decide now if your UPS is set up for 4800 baud transmission.
If not, you can either change the UPS's baud setting, or go into ups.c
and alter the function open_port to set it up for some other data
rate. For example, for 1200 baud, change B4800 to B1200.  Pretty
straightforward, really.  My UPS's entry in the /etc/ttytab looks like
this:

ttyb    "/usr/etc/getty std.9600"       unknown         off local secure

A good test is that if you can edit your /etc/remote and add a line
something like:

			ups:dv=/dev/ttyb:br#4800:

and then                tip ups
and get connected and interact with it, then you're ok.  If you can't,
chances are that it isn't set up correctly.  If everything works ok,
then you may proceed:

		  make -f Makefile.upsd 
	Then      make
	Then 	  make clean


	If you happen to be that sort of person, everything will be
working at this point.  Start the upsd, let it run for a second and
then you're free to start as many xups windows as you like.  Just one
is recommended, but more won't hurt.  Just remember that each copy
will execute the shell script if the inverter clicks on.   


	On the other hand, you may not be compatible with me UPS-wise.
If that happens, then first decide if you know how to program or not.
If you have some experience with C, than it shouldn't be too hard to
change the program to be compatible with your UPS.  You need to edit
the files ups.c and upsd.c and change the annotated parts which query
the ups, and parse the return string.  Other than that, once you get
the values from your ups into my UpsData struct, everything should
work ok.

2.1 FEATURES TO BE ADDED

	If I ever get around to it, I was thinking about a couple of
things:


	o	Another set of bitmaps, for the discriminating user

	o	Something so that you could actually change the
		settings of the UPS from this interface.  That
		wouldn't be too hard, I don't think, but would make
		the program even more BEST MD specific.  

	o	The BEST MD gives you a nice waveform when you type P.
		So, I was thinking about opening up another canvas and
		painting that, but it seems to be a lot of trouble for
		nothing, really.  I might do it anyway, though, for
		the play value...

	o	Maybe support for other UPS's? 


	o 	

2.1 FEATURES NOT TO BE ADDED

	o	A built-in WYSIWYG typesetter

	o	A patch to make your sparc twelve times as fast when it is
		running this program.

	o	Yet another xbiff 

	o	VI mode


2.2 WHAT ARE YOU WAITING FOR? GO COMPILE THE DAMN THING

	Any questions need to be sent to me: lance@diu.cms.udel.edu.
If you change anything, you need to contact me.  Esp if you set it up
for another UPS, get in touch with me and I'll add it in.  There's a
bunch of standard stuff that I'm sure you're aware of.  The software
is copywrite 1992 by the University of Delaware, it can't be used for
commerical gain, or included in any commercial product without prior
written consent from me.  This software may be freely distributed in
the original form.  You may modify this for your own use, but may not
distribute modified copies.  

	NEITHER I NOR THE UNIVERSITY OF DELAWARE IS REPONSIBLE FOR 
ANY DAMAGES, INCIDENTAL OR CONSEQUENTIAL, RESULTING FROM THE USE OF 
THIS PROGRAM.  THIS SOFTWARE IS SUPPLIED WITHOUT GUARENTEE OF ANY KIND.
USE IT AT YOUR OWN RISK.  

(My boss made me add that)


This is BeerWare.  If you like it, send me some Guinness Extra Stout. 
Technical Details
Message-ID: <14r7ggINNqd2@agate.berkeley.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!agate!agate!usenet
References: <Brx0D9.G4D@news.udel.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!agate!agate!usenet
From: lance@diu.cms.udel.edu (Dan Lentz)
Newsgroups: comp.archives
Subject: [comp.windows.x.apps] XUPS update available
Followup-To: comp.windows.x.apps
Date: 25 Jul 1992 09:39:28 GMT
Organization: U of Delaware, College of Marine Studies / Lewes
Lines: 207
Approved: adam@soda.berkeley.edu
Distribution: world
Message-ID: <14r7ggINNqd2@agate.berkeley.edu>
References: <Brx0D9.G4D@news.udel.edu>
Reply-To: lance@diu.cms.udel.edu
NNTP-Posting-Host: soda.berkeley.edu
X-Original-Newsgroups: comp.windows.x.apps
X-Original-Date: Fri, 24 Jul 1992 22:41:32 GMT