# USB, genkernel, & apcupsd [SOLVED]

## Garth

New Gentoo user (and LOVE it)

I used genkernel 1.8 to compile my 2.4.22-gentoo-r2 kernel. Have emerged hotplug.

I just bought an APC UPS with USB connectivity. I plugged it in and I have no entries in /dev/usb. I want to get 'apcupsd' to work with it. It wants to find the UPS at  /dev/usb/hid/hiddev0

How can I tell if USB is working? What can I do to get it to work?

Thanks.

----------

## Vanquirius

According to this thread, there is some problem with gentoo-sources and APC UPS. I don't have one myself, so I can't make my word good for it.

Good ways to check if you hardware was detected are using the commands dmesg and lsmod, as root.

----------

## Garth

this is snip from dmesg output. I had plugged it and replugged it, then stopped and started hotplug. All looks good to me. Where is it?

```

hub.c: new USB device 00:07.2-1, assigned address 2

: USB HID v1.10 Device [American Power Conversion Back-UPS BR  800 FW:9.o2 .D USB FW:o2 ] on usb1:2.0

usb.c: USB disconnect on device 00:07.2-1 address 2

uhci.c: 1080: host controller halted. very bad

hub.c: new USB device 00:07.2-1, assigned address 3

: USB HID v1.10 Device [American Power Conversion Back-UPS BR  800 FW:9.o2 .D USB FW:o2 ] on usb1:3.0

usb.c: USB disconnect on device 00:07.2-1 address 3

hub.c: new USB device 00:07.2-1, assigned address 4

: USB HID v1.10 Device [American Power Conversion Back-UPS BR  800 FW:9.o2 .D USB FW:o2 ] on usb1:4.0

usb.c: USB disconnect on device 00:07.2-0 address 1

usb.c: USB disconnect on device 00:07.2-1 address 4

usb.c: USB bus 1 deregistered

usb.c: deregistering driver hid

usb.c: deregistering driver usb-storage

usb.c: deregistering driver usbdevfs

usb.c: deregistering driver hub

usb.c: registered new driver usbdevfs

usb.c: registered new driver hub

uhci.c: USB Universal Host Controller Interface driver v1.1

PCI: Found IRQ 11 for device 00:07.2

uhci.c: USB UHCI at I/O 0x1080, IRQ 11

usb.c: new USB bus registered, assigned bus number 1

hub.c: USB hub found

hub.c: 2 ports detected

hub.c: new USB device 00:07.2-1, assigned address 2

usb.c: USB device 2 (vend/prod 0x51d/0x2) is not claimed by any active driver.

usb.c: registered new driver hid

: USB HID v1.10 Device [American Power Conversion Back-UPS BR  800 FW:9.o2 .D USB FW:o2 ] on usb1:2.0

hid-core.c: v1.8.1 Andreas Gal, Vojtech Pavlik <vojtech@suse.cz>

hid-core.c: USB HID support drivers

```

----------

## Garth

ran the following script to forceibly create the inodes:

```

#!/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

```

No luck. apcupsd will not recognize the APC USB device. I also find that /proc/bus/usb has no device listing.

I guess my next steps are:

1. find my kernel config file (is there one with genkernel?)

2. check to see if all the USB options are added

3. recompile kernel (use genkernel again?)

4. reboot

But this is not supposed to work this way. I thought genkernel was suppose to include the HID USB support.

Any help would be greatly appreciated.  :Smile: 

PS. I don't think it's a gentoo-sources kernel issue either. If anyone has further evidence contrary-wise, then please bring it.

----------

## Garth

Well, I checked the config, it seems genkernel loads the right support. Rebooted. I now have this:

```

 # ll /dev/usb/hid

total 0

 # cat /proc/bus/usb/devices

:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2

B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0

D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1

P:  Vendor=0000 ProdID=0000 Rev= 0.00

S:  Product=USB UHCI-alt Root Hub

S:  SerialNumber=1080

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=   8 Ivl=255ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=1.5 MxCh= 0

D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1

P:  Vendor=051d ProdID=0002 Rev= 1.06

S:  Manufacturer=American Power Conversion

S:  Product=Back-UPS BR  800 FW:9.o2 .D USB FW:o2

S:  SerialNumber=QB0344130879

C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 24mA

I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=hid

E:  Ad=81(I) Atr=03(Int.) MxPS=   6 Ivl=10ms

 # cat /proc/bus/usb/drivers

         usbdevfs

         hub

         hid

         usb-storage

```

during boot, apcupsd fails to connect to UPS. I try to start it manually from init.d I get "* WARNING:  "apcupsd" has already been started." But it does not show up on a ps -A or in TOP.

Can anyone help me here? I'm dying!

----------

## Drunkula

I've got the same problem.  However.... I noticed that if I run /usr/sbin/apcupsd(not the init.d script) it starts fine.  I can even run powerflute after that and it sees the UPS.

----------

## Garth

Drunkula- trying the "/usr/sbin/apcupsd" from the command line, I get the message: "apcupsd FATAL ERROR in linux-usb.c at line 678   Cannot open UPS device:"

For anyone who cares: this is my apcupsd.conf file listing (with all but the header comment lines removed)

```

## apcupsd.conf v1.1 ##

#

#  for apcupsd release 3.10.8 (28 December 2003) - gentoo

#

# "apcupsd" POSIX config file

#

UPSCABLE usb

UPSTYPE usb

DEVICE /dev/usb/hid/hiddev[0-9]

LOCKFILE /var/lock

ONBATTERYDELAY 6

BATTERYLEVEL 5

MINUTES 3

TIMEOUT 0

ANNOY 300

ANNOYDELAY 60

NOLOGON disable

KILLDELAY 0

NETSERVER on

NISIP 0.0.0.0

NISPORT 3551

EVENTSFILE /var/log/apcupsd.events

EVENTSFILEMAX 10

UPSMODE disable

LOGSTATS off

DATATIME 0

FACILITY DAEMON

```

Anyone have a clue?

BTW, I've tried the line DEVICE /dev/usb/hid/hiddev[0-9] as /dev/usb/hid/hiddev[0-15] with no luck either.

----------

## Garth

SOLVED

Genkernel ( 1.8 ) does NOT enable the HIDDEV driver by default. This is REQUIRED for the APCUPSD daemon.

Must be set manually with genkernel --config. (or genkernel --menuconfig in 3.0.1) 

This is strange to me since Genkernel is supposed to be so all-inclusive.

if cat /proc/bus/usb/drivers shows no hiddev, then you need to get it.

----------

## kdvgent

I have also problems getting a USB UPS working.

I have the HID and HIDDEV support enabled in the kernel (2.6.9-gentoo-r1).

In this series of messages, the file /proc/bus/usb/drivers is mentioned.  I do not find such file on my system.

Any clue

----------

## whiskeypriest

If you're using an APC UPS unit, you might want to have a look at the HOWTO I wrote on the subject...and if you're not using an APC product, you may find something useful anyway (check the KERNEL CONFIGURATION section).

The first thing that springs to mind from your post is checking to make sure you've built the USB device filesystem into your kernel.  I had an initial installation of apcupsd go wonky on me after having compiled a kernel without this feature.

I can't tell from your post if you're using genkernel or not, but I'm afraid I can't be of much assistance if you are...I started compiling my own manually about two weeks after I found Gentoo, and have been a much happier man for it.

----------

