OpenWrt Forum Archive

Topic: apcupsd package

The content of this topic has been archived on 1 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I would like to use apcupsd on a WL-500gP running Kamikaze to monitor the UPS (an APC BACK-UPS CS  650 with USB).

I have done many searches and I have found some references in  subversion repository for patches but no package .

However, I cannot find any apcupsd packages for Kamikaze.
Help.

To use apcupsd on Asus WL500gPwith  kamikaze kernel 2.4 & APC Back-UPS CS 650 usb cable:
(sorry for my english...)

1.
I've flashed this firmware http://downloads.x-wrt.org/xwrt/kamikaz … uashfs.trx
(snapshot from 26 june 2008 )
Configure your router for networking,ssh,usb,mc , etc.

2.
download from this page http://www.dd-wrt.com/phpBB2/viewtopic.php?t=33079
     hid-linux-2.4.35-mips.tar.gz
it contains a precompiled module hid.o.
copy hid.o  to  /lib/modules/2.4.35.4/

3.
create a file to load the module:
#echo hid >/etc/modules.d/60-usb-hid

4.
install optware
* See http://forum.openwrt.org/viewtopic.php?id=15286

5.
#ipkg-opt update
#mkdir -p /opt/var/lock
#ipkg-opt install apcupsd

6.
without rebooting You should see something like this:
#insmod hid
Warning: loading hid will taint the kernel: no license
  See http://www.tux.org/lkml/#export-tainted for information about tainted modules

#dmesg
...
usb.c: registered new driver hiddev
usb.c: registered new driver hid
hiddev0: USB HID v1.10 Device [American Power Conversion Back-UPS CS 650 FW:817.v2.I USB FW:v2] on usb4:5.0
hid-core.c: v1.8.1 Andreas Gal, Vojtech Pavlik <vojtech@suse.cz>
hid-core.c: USB HID support drivers

# lsusb
Bus 004 Device 001: ID 0000:0000
Bus 004 Device 002: ID 0409:0056 NEC Corp.
Bus 004 Device 003: ID 04b4:6560 Cypress Semiconductor Corp. CY7C65640 USB-2.0 "TetraHub"
Bus 004 Device 004: ID 0b05:1715 ASUSTek Computer, Inc.
Bus 004 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 004 Device 006: ID 0557:2006 ATEN International Co., Ltd UC-1284B Printer Port
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

# cat /proc/bus/usb/devices |grep ^[SI] 
...
S:  Manufacturer=American Power Conversion
S:  Product=Back-UPS CS 650 FW:817.v2.I USB FW:v2
S:  SerialNumber=QB0445137434
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=hid
...
Without driver installed last line would show something like this:
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)

7.
configure apcupsd for usb(defaults are for serial smart-ups)

#mcedit /opt/etc/apcupsd/apcupsd.conf
a. give it a name :
ex.    UPSNAME apc
b. set ups cable type:
ex.    UPSCABLE usb
c. define ups type:
ex.    UPSTYPE usb
d. comment  DEVICE=/dev/ttyS0
ex.    #DEVICE=/dev/ttyS0

Those are minimum needed.

8.
Test
#apctest
2008-06-27 11:23:46 apctest 3.14.4 (18 May 2008) unknown
Checking configuration ...
Attached to driver: usb
sharenet.type = DISABLE
cable.type = USB_CABLE

You are using a USB cable type, so I'm entering USB test mode
mode.type = USB_UPS
Setting up the port ...
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing USB UPSes.

Getting UPS capabilities...SUCCESS

Please select the function you want to perform.

1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  Change battery date
5)  View battery date
6)  View manufacturing date
7)  Set alarm behavior
8)  Set sensitivity
9)  Set low transfer voltage
10) Set high transfer voltage
11) Quit

Select function number:     

9.
Remove apctest.output created in working directory.

10.
Reboot

11.
yet to be done :
-persuade developers to add kmod-usb-hid & apcupsd (or nut http://www.networkupstools.org/ eventually,or both) to kamikaze
-configure router to shutdown gracefully when power events occurs.
-configure apcupsd to shutdown over network my desktop pc if it is on
and turn it back on(wol) when power comes back.

Well...

Sadly this doesn't work for me. I cannot get my router to recognize the device on the USB port.

When I try lsusb I get :
Bus 001 Device 001: ID 0000:0000

and  gives me :
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 4
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.04
S:  Manufacturer=Linux 2.4.34 ehci_hcd
S:  Product=PCI device 1106:3104
S:  SerialNumber=01:02.2
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=256ms

the driver is supposed to be hid, not hub!?

My kernel version is 2.4.34 while I think hid.o was for 2.4.35, could that be a problem ?

Ive tried another hid.o for 2.4.30 and it said :
insmod: unresolved symbol input_register_device
insmod: unresolved symbol input_unregister_device
insmod: unresolved symbol input_event


Thanks,

Chandi Bernier

chandi, apparently you have only the ehci-hcd driver loaded, and therefore only high-speed devices are recognized. You need to load either uhci or usb-ohci in addition (which one - depends on your exact router model, e.g., WL-500gP V1 needs uhci, but V2, AFAIK, uses usb-ohci).

I noticed that apcupsd is included in 8.9rc1 and I installed it. The only thing is I get the following error while trying to start it:

Apcupsd driver usb not found.
The available apcupsd drivers are:
dumb
apcsmart
net
pcnet

Most likely, you need to add --enable-usb to your ./configure options.

apcupsd FATAL ERROR in apcupsd.c at line 259
Apcupsd cannot continue without a valid driver.

I wonder if there's some usb specific config I miss for it to work, or if the provided version should indeed be compiled with --enable-usb ? Anybody have some experience with that ?

I would try compiling it myself, but I didnt find imagebuilder nor SDK for rc1.

Possibly I should post it as a feature request, let me know where I should do so.

The discussion might have continued from here.