Harrkev
Posts: 22
Joined: Mon Feb 27, 2012 4:56 pm

APCUPSD and /proc/bus/usb

Mon Aug 13, 2012 4:00 pm

Hi. I am trying to get the "APCUPSD" package running (connects the Pi to an APC uninerruptable power supply). The purpose is to have the Pi allow me to remotely monitor and power up/down the UPS.

Documentation here: http://www.apcupsd.org/manual/manual.html

The problem is that it just plain fails. (on Red Hat x86, it was plug-n-play). The documentation mentions checking /proc/bus/usb -- which does not exist!!! IThe manual also states:
On Linux-2.6.x, make sure the sysfs filesystem is mounted on /sys and do:
ls -l /sys/bus/usb/drivers/
Now, I *DO* have this, but according to uname, I am using kernal 3.1.9+. However, the documentation is not clear enough to tell me what to do with the USB drivers located in that directory, as things get confusing once I look in /sys/bus/usb/drivers/usbhid.

Here is some interesting parts of my dmesg log:

Code: Select all

[    6.845553] usb 1-1.3: new low speed USB device number 4 using dwc_otg
[    7.047244] usb 1-1.3: New USB device found, idVendor=051d, idProduct=0002
[    7.063515] usb 1-1.3: New USB device strings: Mfr=3, Product=1, SerialNumber=2
[    7.079853] usb 1-1.3: Product: Back-UPS RS 1500 LCD FW:839.H10 .D USB FW:H10 
[    7.097590] usb 1-1.3: Manufacturer: American Power Conversion
[    7.112546] usb 1-1.3: SerialNumber: 3B1021X00829  
[    8.327475] generic-usb 0003:051D:0002.0001: hiddev0: USB HID v1.10 Device [American Power Conversion Back-UPS RS 1500 LCD FW:839.H10 .D USB FW:H10 ] on usb-bcm2708_usb-1.3/input0
Any suggestions?

**EDIT**
Raspbian Wheezy.

Harrkev
Posts: 22
Joined: Mon Feb 27, 2012 4:56 pm

Re: APCUPSD and /proc/bus/usb

Tue Aug 14, 2012 8:02 pm

OK. I have done some more playing with this, and it seems that the problem is that the daemon is not starting. I will have to keep digging into this as I get time...

inas_iorl
Posts: 1
Joined: Wed Feb 29, 2012 2:48 am

Re: APCUPSD and /proc/bus/usb

Fri Aug 17, 2012 2:56 am

Hi. Encountered something similar. Apctest got me messages like

Code: Select all

You are using a USB cable type, so I'm entering USB test mode
mode.type = USB_UPS
Setting up the port ...
apctest FATAL ERROR in linux-usb.c at line 609
Downloading source code for apcupsd and executind ./make-hiddev in examples folder helped me

Harrkev
Posts: 22
Joined: Mon Feb 27, 2012 4:56 pm

Re: APCUPSD and /proc/bus/usb

Fri Aug 17, 2012 2:27 pm

Thanks. I just installed the package. I have not tried compiling from sources yet. I will give that a shot when I get time.

Harrkev
Posts: 22
Joined: Mon Feb 27, 2012 4:56 pm

Re: APCUPSD and /proc/bus/usb

Fri Aug 17, 2012 6:17 pm

I got everything working after compiling from sources and playing with the apcupsd.conf file. Thanks.

CheshireBat
Posts: 2
Joined: Wed Aug 29, 2012 8:58 pm

Re: APCUPSD and /proc/bus/usb

Wed Aug 29, 2012 9:00 pm

I'm planning on trying the same thing soon with my pi. Any tips on configuration? Or are the contents of apcupsd.conf mostly specific to your particular UPS?

Harrkev
Posts: 22
Joined: Mon Feb 27, 2012 4:56 pm

Re: APCUPSD and /proc/bus/usb

Wed Aug 29, 2012 10:41 pm

What I figured out was that having ANYTHING for the device path in the config file killed the USB auto-detect. You just have to set the cable type to USB (funny how this is not the default) and make sure that "device" is left blank. This might even work with the apt-get version (no need to compile). Try it and let us know how it works.

CheshireBat
Posts: 2
Joined: Wed Aug 29, 2012 8:58 pm

Re: APCUPSD and /proc/bus/usb

Fri Aug 31, 2012 2:11 am

I tried the apt-get version, and it worked fine. Like you said, the DEVICE parameter needed to be blank:

Code: Select all

# UPSTYPE   DEVICE           Description
# usb       <BLANK>          Most new UPSes are USB. A blank DEVICE
#                            setting enables autodetection, which is
#                            the best choice for most installations.
From the default settings, I changed the following in /etc/apcupsd/apcupsd.conf:

Code: Select all

#UPSCABLE smart
UPSCABLE usb
#UPSTYPE apcsmart
UPSTYPE usb
#DEVICE /dev/ttyS0
DEVICE
I also needed to change a line in /etc/default/apcupsd, but this was obvious because the service complained on startup:

Code: Select all

#ISCONFIGURED=no
ISCONFIGURED=yes
I was a little worried about this, since my UPS is an older APC model. I haven't yet tested simulated power failures, but all of the diagnostics seem to be working, and showing the same data as the PowerChute utility.

philibertperusse
Posts: 1
Joined: Sat Feb 16, 2013 4:25 pm

Re: APCUPSD and /proc/bus/usb

Sat Feb 16, 2013 7:30 pm

I had the same problems as well, and I lost plenty of time to search for a solution, while in fact it was working fine. So, I am documenting here what happened to me so that others can benefit from it.

First, I am using Raspbian "wheezy" and my UPS is connected through USB (not SmartUps).

For the setup, basically I followed these steps from ubuntu community:

Code: Select all

raspberrypi$ sudo apt-get install apcupsd
raspberrypi$ sudo vi /etc/apcupsd/apcupsd.conf
    UPSNAME MYUPS
    UPSCABLE usb
    UPSTYPE usb
    DEVICE
raspberrypi$ sudo vi /etc/default/apcupsd
    ISCONFIGURE=yes
raspberrypi$ sudo /etc/init.d/apcupsd start
raspberrypi$ apcaccess status
TL/DR; Everything was working perfectly at this point. All further testing I did was only sending me on a wild goose chase! The big missing thing, turns out you have to shutdown apcupsd to run apctest AND you have to sudo apctest...
So far, it looked fine. apcaccess is reporting was seams relevant data from my UPS. Now, I wanted to verify all was working fine and went to follow Apcupsd Quick Start for Beginners, more specifically Testing Apcupsd. So, it did the following:

Code: Select all

raspberrypi$ ps fax | grep apcupsd
 1768 ?        Ssl    0:02 /sbin/apcupsd 
I only had a single instance of apcupsd running, while the manual showed that I should have three. There was a notice there saying:
If you see only one instance of apcupsd running, don't worry about it as this is normal on most non-Linux systems, and on Linux 2.6.x kernels.
But in fact I am using a linux kernel 3.2.x+ as evidence is shown by running uname

Code: Select all

raspberrypi$ uname -a
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux
At this point I wasn't sure about what was happenning. apcaccess was showing data. So I followed with next step, checking log messages

Code: Select all

raspberrypi$ cat /var/log/messages | grep apcupsd
Nothing found there... is something amiss? Now I kind of think something is not right, so I decide to check if driver is properly setup. As per documentation, I do dmesg

Code: Select all

raspberrypi$ dmesg
     generic-usb 0003:051D:0002.0001: hiddev0: USB HID v1.10 Device [APC Back-UPS ES 450G FW:844.K4 .D USB FW:K4 ] on usb-bcm2708_usb-1.2/input0
My interpretation of the documentations shows, that I should have found something along:
ugen0: American Power Conversion Back-UPS RS 1500 FW:8.g6 .D USB FW:g6, rev 1.10/1.06, addr 2
Note that the ugen driver is called out. If you see uhid instead, it probably means you did not properly disable the uhid driver when you compiled your kernel or perhaps you're not running the new kernel.
Well, I do see hid stuff in my dmesg. Am I doomed? Lets try something else, lets try apctest

Code: Select all

raspberrypi$ apctest

2013-02-16 14:02:35 apctest 3.14.10 (13 September 2011) debian
Checking configuration ...
Attached to driver: usb
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
apctest FATAL ERROR in linux-usb.c at line 609
Cannot find UPS device --
For a link to detailed USB trouble shooting information,
please see <http://www.apcupsd.com/support.html>.
apctest error termination completed
That is how I got here in the first place, looking for that FATAL ERROR. I now have all kind of scary options: rebuilding my kernel, compiling Apcupsd from code. None of them are appealing. I am looking for something else, some other tips! After all it seems I have at least something, apcaccess does returns data. But I am afraid I might not be able to operate the UPS and "killpower" so I try it manually!

Code: Select all

raspberrypi$ apcupsd --killpower
apcupsd FATAL ERROR in linux-usb.c at line 609
Cannot find UPS device --
For a link to detailed USB trouble shooting information,
please see <http://www.apcupsd.com/support.html>.
Damn! I do have a problem! I looked around for a while and somehow stumble upon this guy where I see:
sudo apctest – You have to turn off the apcupsd daemon first, but this hand tool lets you conduct a self test and other great utilities for your UPS.
sudo /etc/init.d/apcupsd stop – stops the apcupsd daemon
sudo /etc/init.d/apcupsd start – starts the apcupsd daemon
Well, I did miss the small note "Shutdown apcupsd if it is running." in the documentation. The documentation also doesn't indicate you need to sudo apctest as well... could it be just that!

Yes IT IS!

Code: Select all

raspberrypi$ sudo /etc/init.d/apcupsd stop
raspberrypi$ sudo apctest

2013-02-16 14:19:36 apctest 3.14.10 (13 September 2011) debian
Checking configuration ...
Attached to driver: usb
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
Doing prep_device() ...

You are using a USB cable type, so I'm entering USB test mode
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)  View/Change battery date
5)  View manufacturing date
6)  View/Change alarm behavior
7)  View/Change sensitivity
8)  View/Change low transfer voltage
9)  View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number:
My error is that I did not continue the "Testing Apcupsd" steps when I started having discrepancies. Would I have, the next step was to turn off the power and I would have seen the WALL message and eventually the shutdown! I went offscript on a wild goose chase...

Let's hope that if you read this and you also have discrepancies, then it will help you out.

oldfart
Posts: 16
Joined: Wed Feb 06, 2013 11:50 pm

Re: APCUPSD and /proc/bus/usb

Wed Mar 06, 2013 4:11 pm

Having the same probem -- no soultion

Code: Select all

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l GNU/Linux

Code: Select all

pi@raspberrypi ~ $ sudo apctest
2013-03-06 16:06:14 apctest 3.14.10 (13 September 2011) debian
Checking configuration ...
Attached to driver: usb
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
apctest FATAL ERROR in linux-usb.c at line 609
Cannot find UPS device --
For a link to detailed USB trouble shooting information,
please see <http://www.apcupsd.com/support.html>.
apctest error termination completed

Code: Select all

pi@raspberrypi ~ $ dmesg | tail
[ 8973.343820] usb 1-1.2: device descriptor read/all, error -32
[ 8973.603335] usb 1-1.2: new low-speed USB device number 7 using dwc_otg
[ 8974.013255] usb 1-1.2: new low-speed USB device number 8 using dwc_otg
[ 8974.126548] usb 1-1.2: New USB device found, idVendor=06da, idProduct=0003
[ 8974.126578] usb 1-1.2: New USB device strings: Mfr=3, Product=1, SerialNumber=0
[ 8974.126594] usb 1-1.2: Product: USB UPS
[ 8974.126607] usb 1-1.2: Manufacturer: OMRON
[ 8974.140726] hid-generic 0003:06DA:0003.0002: hiddev0,hidraw0: USB HID v1.11 Device [OMRON USB UPS] on usb-bcm2708_usb-1.2/input0
[11459.221638] smsc95xx 1-1.1:1.0: eth0: kevent 2 may have been dropped
[11513.952031] udevd[8346]: starting version 175
.conf file setup as all the above & it is enabled!
Any ideas??

orangepeel
Posts: 5
Joined: Tue Feb 12, 2013 4:28 am

Re: APCUPSD and /proc/bus/usb

Mon Aug 05, 2013 4:48 am

Hi All

I have a RasPi that is in use 24/7 on a project.

As a result, I have had to slow down the USB port via the parameter on the codlin.txt file at boot up. This has made the USB controller operate slower than the designed USB2.0 speed

The parameter is dwc_otg.speed=1.


I have had success with the APCUPDS program in the past on CentOS (operating at USB2.0) however does anyone know a way to make it operate at this slower speed (USB1.1?)

At last check, the Raspberry Pi is seeing the USB connection ok - but it seems to have problems interfacing correctly with APCUSPD.

For what its worth - there is a USB Sound Card connected into the other USB port and that is work well (this is the reason for the slower speed USB port - to avoid choppy audio)

Many Thanks

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 2 guests