LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   Getting APCUPSD to talk to an APC ES 750 (https://www.linuxquestions.org/questions/mandriva-30/getting-apcupsd-to-talk-to-an-apc-es-750-a-838522/)

camorri 10-16-2010 01:33 PM

Getting APCUPSD to talk to an APC ES 750
 
I can not get my new APC Back-UPS ES 750 to talk to Mandriva 10.1 over the supplied usb cable.

uname -a reports -

Quote:

uname -a
Linux duelie 2.6.33.7-desktop-2mnb #1 SMP Mon Sep 20 18:19:20 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
When I hot plug the sub cable into my Mandriva system, I get the following from dmesg.

Quote:

usb 1-6: new low speed USB device using ohci_hcd and address 3
usb 1-6: device not accepting address 3, error -71
usb 1-6: new low speed USB device using ohci_hcd and address 4
usb 1-6: device descriptor read/all, error -71
usb 1-6: new low speed USB device using ohci_hcd and address 5
usb 1-6: device descriptor read/8, error -71
usb 1-6: device descriptor read/8, error -71
usb 1-6: new low speed USB device using ohci_hcd and address 6
usb 1-6: device descriptor read/8, error -71
usb 1-6: device descriptor read/8, error -71
hub 1-0:1.0: unable to enumerate USB device on port 6
lsusb never shows the device. I know the UPS supply is working, I can plug it into my netbook running Ubuntu 10.1 and the USB device shows up with lsusb.

I did some research and found a package to support APC-UPS. Here is what is installed on my 64 bit system.

Quote:

Version: 3.14.8-1mdv2010.1
Currently installed version: 3.14.8-1mdv2010.1
Group: System/Servers
Architecture: x86_64
I followed the instructions with this package. It had me modprobe the hid and usbhid modules. They load without problems. The doc also has you create device nodes in /dev/usb/hid/ in fact there is an example script I ran to do the work. It worked and created the nodes. I discovered Mandriva deleted the manually created nodes after a cold boot. I have no idea how to prevent that. I can re-create them, Mandriva will wipe them out on the next boot.

From the doc supplied, I appear to have all the correct drivers loaded.
Here is what the doc calls for for a 2.6 kernel.
Quote:

...or perhaps something like:

total 0
drwxr-xr-x 2 root root 0 Jan 6 15:27 hiddev
drwxr-xr-x 2 root root 0 Jan 6 15:28 hub
drwxr-xr-x 2 root root 0 Jan 6 15:28 usb
drwxr-xr-x 2 root root 0 Jan 6 15:27 usbfs
drwxr-xr-x 2 root root 0 Jan 6 15:28 usbhid
and what I have installed...

Quote:

ls -l /sys/bus/usb/drivers/
total 0
drwxr-xr-x 2 root root 0 2010-10-16 14:22 hiddev/
drwxr-xr-x 2 root root 0 2010-10-16 14:22 hub/
drwxr-xr-x 2 root root 0 2010-10-16 14:22 usb/
drwxr-xr-x 2 root root 0 2010-10-16 14:22 usbfs/
drwxr-xr-x 2 root root 0 2010-10-16 14:22 usbhid/
Now, here is the kicker... from the install instructions a direct copy and paste...

Quote:

What complicates the situation much more on Mandrake kernels is their security level since CONFIG_DYNAMIC_USB_MINORS is turned on, but on higher security levels devfs is turned off. The net result, is that in those situations hiddev is completely unusable so apcupsd will not work. So, in these cases, the choices are:

1. Reduce the security level setting of the system (not sure if this is possible after the initial install).
2. Custom build a high security kernel with devfs enabled and make sure devfs is mounted and devfsd is running.
3. Custom build a high security kernel with dynamic minors disabled
4. Use udev
This has to do with the device being recognized by Mandrake. I have security set to 'Standard'. There doesn't appear to be a lower setting. Not sure I want one either. However, since the system will not 'see' the device on the usb connection, what do I do now?

I don't have a clew on building a kernel. Use udev? How?

BTW, the usb ports seem to work just fine for the other usb devices I have. The ups is seen by Ubuntu, so I know the cable should not be the problem, or the code on the UPS, since it works with Ubuntu.

Has anyone got a APC UPS working with Mandriva? If so, how?

BTW, I saw some threads with similar hot plugging issues, and one solution was to use modprobe to unload the ehci_hcd driver and use only ohci_hcd. Of course this means you run all devices at the slower 1.0 usb speed. On some systems this got around a problem. On this bug it made no difference.

ernie 10-18-2010 01:26 PM

Have you used MCC to set up your UPS? I do not use a UPS here, but MCC has an applet (icon) named "Set up a UPS for power monitoring" in the hardware category.

1. Open MCC (Tools > System Tools > Configure your computer in the menu system)

2. Select Hardware in the category list at the left.

3. Open the Set up a UPS for power monitoring icon in the main pane.

Follow the prompts from there.

HTH,

camorri 10-18-2010 01:44 PM

ernie,

Yes, that was the first thing I tried. It fails because the system is not seeing the device on the usb bus. I have not been able to find out what error 71 is for the usb, yet. (First set of error messages I posted.)

The interesting thing I found out is this function uses NUT to try and talk to the device. I have that working now on my netbook running Ubuntu 10.1. So, at this point I know the UPS is O.K. The last quote I posted basically says Mandrake will not work with this type of USB device using hiddev. Then it lists my choices. I was hoping someone who knows Mandriva very well could give me some idea of how to use udev. I sure don't want to build a custom kernel to get it working. If it comes to that, I will install a distro known to run hiddev.

ernie 10-19-2010 12:25 AM

You can try adding the modules to /etc/modprobe.preload which should ensure that they are loaded at boot time, then add the commands that create the device nodes you need to the end of /etc/profile. Better yet, to avoid typos, copy the script you used to create the device nodes to /bin, or /usr/bin, then call the script from /etc/profile. To call the script, (assuming the script name is installUPSdeviceNodes, and you copied it to /usr/bin) add the full path name to the end of /etc/profile (/usr/bin/installUPSdeviceNodes). See if that works.

The file /etc/modprobe.preload does just what its name indicates, it is used to list (one module per line) the modules that should be loaded at boot time.

I do not currently have to use /etc/modprobe.preload to load any modules here, but I have had to do so in the past (with earlier releases of Mandriva).

What follows is the comment text found in the default file:
Quote:

# /etc/modprobe.preload: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a `#', and everything on the line after them are ignored.
# this file is for module-init-tools (kernel 2.5 and above) ONLY
# for old kernel use /etc/modules

/etc/profile is read by bash at boot time, and any commands in it are run as root. I assume that you had to run the commands (or script) as root to create the device nodes in the first place.

HTH,

camorri 10-19-2010 08:24 AM

Thank-you for the reply. I will give it a try that way, and see what happens. I'll post back.

camorri 10-19-2010 01:45 PM

Some progress. I now have the needed modules loading a boot time. ( At least I think I have them all loaded ). I edited /etc/modprobe.preload and added hid, usbhid and hidusb-ups. No errors, and the modules show up with lsmod.

I can not get the shell script to add the nodes however, be editing /etc/profile. I tried calling the script, that failed, then I put the command into the file. Either way, after boot, /dev/usb/hid/ does not exist. If I run the command as root, ie 'sh make-hiddev' it works.

For the record, here is the contents of the file.

Quote:

cat /usr/local/nut/make-hiddev
#!/bin/sh
mkdir -p /dev/usb/hid
mknod /dev/usb/hid/hiddev0 c 180 96
mknod /dev/usb/hid/hiddev1 c 180 97
mknod /dev/usb/hid/hiddev2 c 180 98
mknod /dev/usb/hid/hiddev3 c 180 99
mknod /dev/usb/hid/hiddev4 c 180 100
mknod /dev/usb/hid/hiddev5 c 180 101
mknod /dev/usb/hid/hiddev6 c 180 102
mknod /dev/usb/hid/hiddev7 c 180 103
mknod /dev/usb/hid/hiddev8 c 180 104
mknod /dev/usb/hid/hiddev9 c 180 105
mknod /dev/usb/hid/hiddev10 c 180 106
mknod /dev/usb/hid/hiddev11 c 180 107
mknod /dev/usb/hid/hiddev12 c 180 108
mknod /dev/usb/hid/hiddev13 c 180 109
mknod /dev/usb/hid/hiddev14 c 180 110
mknod /dev/usb/hid/hiddev15 c 180 111
and the permissions,

Quote:

ll /usr/local/nut/make-hiddev
-rwxr--r-- 1 root root 626 2010-10-19 14:00 /usr/local/nut/make-hiddev*
The ups is not seen on the usb bus.

ernie 10-19-2010 10:13 PM

OK, I goofed. /etc/profile is not the place to call your script. I did a small experiment. I put commands in /etc/profile to create a test file in my $HOME directory with the value contained in $UID (root = 0), and I got back a my user uid (10001). It has been too long since I did any shell scripting . . .

Try adding the call to the script in /etc/rc.local. Remember to use the full path name as described in post # 4 of this thread.

HTH,

camorri 10-20-2010 02:01 PM

Well, progress is slow. I got the script to work when I boot the system. That is the good news. The bad news is the ups still does not show up when I do a lsusb. dmesg shows errors as before.

So, at this point I have the NUT utilities installed and configure. They are running, I get a message that the UPS is not available.

I'm going to do some more scratching around to see if I can figure out why the UPS shows up on Ubuntu and not Mandrake.

mecelec415 10-20-2010 08:35 PM

have you played with usb speed settings in the bios changing them to max resolved a usb detection issue i had with a card reader a while ago.

camorri 10-21-2010 08:24 AM

Quote:

have you played with usb speed settings in the bios
I have been in the BIOS, I did not see any speed settings. As far as I know, speed is controlled by the usb driver the device connects to. These are the drivers loaded, after a clean boot.

Quote:

lsmod | grep usb
usbhid 49577 0
hid 81757 1 usbhid
usbcore 210196 4 usbhid,ohci_hcd,ehci_hcd
Ohci is the low speed and ehci is the high speed. I'll have another look, however not sure it will help.

I had another look at the BIOS settings. I do not see any speed settings for USB. For the record, the system board is a Gigabyte GA-M61SME-S2 and the BIOS level is F4.

camorri 11-05-2010 06:49 PM

An update. I have installed the latest BIOS for my Gigabyte system board. It is now at level F10a. There is no change in the problem. The UPS is still not detected by Mandriva.

I'm looking into configuring my own kernel. This is a learning process, I have never created my own kernel.

I compiled the kernel without CONFIG_USB_DYNAMIC_MINORS and it made no difference. I still do not see the device with lsusb.


All times are GMT -5. The time now is 09:38 AM.