UPS on FreeBSD

login at istop.com login at istop.com
Thu Oct 7 13:26:15 PDT 2004


Good afternoon,

I have attached a UPS to FreeBSD host using USB cable provided by APC.

Environment:

# uname -a
FreeBSD host.domain.com 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: 
Mon Feb 23 20:45:55 GMT 2004     root at wv1u.btc.adaptec.com:
/usr/obj/usr/src/sys/GENERIC  i386
# 

# usbdevs 
addr 1: UHCI root hub, Intel
addr 2: Back-UPS RS 1500 FW:8.g8 .D USB FW:g8, American Power Conversion
addr 1: UHCI root hub, Intel
addr 1: UHCI root hub, Intel
addr 1: UHCI root hub, Intel
# 

# usbdevs -v
Controller /dev/usb0:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel
(0x0000), rev 1.00
 port 1 powered
 port 2 addr 2: low speed, power 24 mA, config 1, Back-UPS RS 1500 
FW:8.g8 .D USB FW:g8(0x0002), 
 American Power Conversion(0x051d), rev 1.06
...
<snip>
...
#


This is Back-UPS RS 1500 and connected to FreeBSD server via usb port.

# dmesg | grep usb0
usb0: <Intel 82801EB (ICH5) USB controller USB-A> on uhci0
usb0: USB revision 1.0
#

# dmesg | grep ugen0
ugen0: American Power Conversion Back-UPS RS 1500 FW:8.g8 .D USB FW:g8, rev 
1.10/1.06, addr 2
#

# apcupsd -V
apcupsd 3.10.6 (28 October 2003) freebsd
#

# grep -v ^# apcupsd.conf
UPSCABLE usb
UPSTYPE dumb 
DEVICE /dev/usb0    <--- usb device
LOCKFILE /var/spool/lock
BATTERYLEVEL 5
MINUTES 3
TIMEOUT 30
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 0.0.0.0
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
UPSCLASS standalone
UPSMODE disable
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0
# 

# ps aux | grep apcupsd
root     967  0.0  0.3  2804 1400  ??  Ss    3:55PM   
0:00.01 /usr/local/sbin/apcupsd --kill-on-powerfail
# 


# /usr/local/etc/rc.d/apcupsd.sh status
or
# /usr/local/sbin/apcaccess

returns this output:

APC      : 001,019,0507
DATE     : Tue Oct 05 13:56:16 EDT 2004
HOSTNAME : host.domain.com
RELEASE  : 3.10.6
VERSION  : 3.10.6 (28 October 2003) freebsd
UPSNAME  : host.domain.com
CABLE    : USB Cable
MODEL    : DUMB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: Tue Oct 05 13:56:08 EDT 2004
STATUS   :
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 30 Seconds
NUMXFERS : 0
TONBATT  : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
STATFLAG : 0x02000000 Status Flag
END APC  : Tue Oct 05 18:01:53 EDT 2004
# 

Here is /var/log/message and apcupsd get started at boot time without any
problem.

Oct  7 16:19:42 bsd20 apcupsd[497]: apcupsd 3.10.6 (28 October 2003) freebsd 
startup succeeded

The STATUS is missing in the above status report. Other thing that by un-
plugging the UPS from the power outlet, the system does not shutdown 
gracefully neither display/wall any warning about the UPS. The output from 
the  /usr/local/etc/rc.d/apcupsd.sh status is same as above. Basically, 
system crashes since UPS is not getting any command to follow by 
the /usr/local/etc/apcupsd/apccontrol program.

By changing the DEVICE to /dev/uhid0 in the apcupsd.conf file, 
when starting the apcupsd, I get:

# /usr/local/etc/rc.d/apcupsd.sh start
 apcupsd
# apcupsd FATAL ERROR in dumbsetup.c at line 91
Cannot open UPS port /dev/uhid0: Device busy
#

Any thoughts and/or workaround to have UPS working on FreeBSD especially via 
USB cable? Thanks!

S. Mohammad [ login at istop.com ]


More information about the freebsd-questions mailing list