On Sun, Jun 22, 2003 at 07:54:28AM +1000, Chris Barnes wrote: > Hi everyone, > The other day my boss bought a UPS which was on special at Dick Smith > Electronics for $100 (400Va, 9pin Serial-to-pc, 6 minutes @ half-load), > an ok price i guess.
yep, a good little buy. I'm not sure why they even bothered with that Linux software, and of course it's 386 only, sigh. I've 'reversed engineered' the protocol and have some software that talks to it, but it's not complete as yet (I of course want it to do everything under the sun ... ). (excuse me just copying and pasting bits of the program below) Basically, to get it going send the following 4 strings char ups_init1[] = {0x4D,0x0D,0x4D,0x0D}; char ups_init2[] = {0x4D, 0x0D}; char ups_init3[] = {0x49, 0x0D, 0x49, 0x0D, 0x51, 0x31, 0x0D}; char ups_init4[] = {0x46, 0x0D}; that sets it up and puts it in a mode where you can poll it with char ups_status[] = {0x51, 0x31, 0x0D}; You'll get back something that can be parsed by scanf as #define SSCANF_STATUS(buf,status) \ sscanf(buf,"(%lf %lf %lf %lf %lf %lf %lf %u", \ status->in_volts, status->unknown1, \ status->out_volts, status->load, status->out_frequency, \ status->unknown2, status->temperature, status->flag) I don't know what unknown1 and unknown2 actually mean, but flag changes like : #define FLAG_NORMAL 1000 #define FLAG_POWER_SMOOTH 101000 #define FLAG_POWER_FAIL 10001000 I might make a sourceforge page if a lot of people have bought these things. -i -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug