Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Sep 2010 14:44:07 -0600
From:      Ben Schumacher <benschumacher@gmail.com>
To:        apcupsd-users@lists.sourceforge.net, freebsd-stable@freebsd.org
Subject:   apcupsd, USB and FreeBSD 8.1 aren't getting along
Message-ID:  <AANLkTi=WQFY85ckjhTwA%2BTGrqVozesdMGnEVWezT5Tks@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
All-

It seems that something about the combination of FreeBSD 8.1 and
apcupsd connecting to an APC Back-UPS RS 1500.

Here's what I've got:
1. FreeBSD 8.1 (source compiled up to RELENG_8_1 for security fixes)
2. apcupsd 3.14.8 compiled from FreeBSD Ports
3. APC Back-UPS RS 1500

This was working fine in FreeBSD 8.0, but it appears to be broken with
FreeBSD 8.1. I've done a little debugging to try to figure out what's
going on and was best I can tell it's not able to communicate at all
with the UPS.

Here's what I've come up with so far:

# usbconfig list
ugen0.1: <UHCI root HUB Intel> at usbus0, cfg=255 md=HOST spd=FULL
(12Mbps) pwr=ON
ugen1.1: <UHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen2.1: <UHCI root HUB Intel> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen3.1: <EHCI root HUB Intel> at usbus3, cfg=0 md=HOST spd=HIGH
(480Mbps) pwr=ON
ugen4.1: <UHCI root HUB Intel> at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen5.1: <UHCI root HUB Intel> at usbus5, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen6.1: <UHCI root HUB Intel> at usbus6, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen7.1: <EHCI root HUB Intel> at usbus7, cfg=0 md=HOST spd=HIGH
(480Mbps) pwr=ON
ugen3.2: <Mass Storage Device Prolific Technology Inc.> at usbus3,
cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen1.2: <Back-UPS RS 1500 FW:8.g9 .D USB FW:g9 American Power
Conversion> at usbus1, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
# usbconfig -d 1.2 dump_info
ugen1.2: <Back-UPS RS 1500 FW:8.g9 .D USB FW:g9 American Power
Conversion> at usbus1, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON

# usbconfig -d 1.2 dump_device_desc
ugen1.2: <Back-UPS RS 1500 FW:8.g9 .D USB FW:g9 American Power
Conversion> at usbus1, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0110
  bDeviceClass = 0x0000
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0008
  idVendor = 0x051d
  idProduct = 0x0002
  bcdDevice = 0x0106
  iManufacturer = 0x0003  <American Power Conversion>
  iProduct = 0x0001  <Back-UPS RS 1500 FW:8.g9 .D USB FW:g9 >
  iSerialNumber = 0x0002  <JB0704015634  >
  bNumConfigurations = 0x0001

# truss -o apctest.truss apctest -d 200


2010-09-03 14:23:00 apctest 3.14.8 (16 January 2010) freebsd
Checking configuration ...
0.000 apcupsd: apcconfig.c:799 After config scriptdir: "/usr/local/etc/apcupsd"
0.000 apcupsd: apcconfig.c:800 After config pwrfailpath: "/var/run"
0.000 apcupsd: apcconfig.c:801 After config nologinpath: "/var/run"
0.000 apcupsd: newups.c:102 write_lock at drivers.c:208
0.000 apcupsd: drivers.c:210 Looking for driver: usb
0.000 apcupsd: drivers.c:214 Driver apcsmart is configured.
0.000 apcupsd: drivers.c:214 Driver net is configured.
0.000 apcupsd: drivers.c:214 Driver usb is configured.
0.000 apcupsd: drivers.c:217 Driver usb found and attached.
0.000 apcupsd: newups.c:108 write_unlock at drivers.c:234
0.000 apcupsd: drivers.c:236 Driver ptr=0x8064e60
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 ...
usb_set_debug: Setting debugging level to 2 (on)
0.000 apcupsd: newups.c:102 write_lock at generic-usb.c:614
0.000 apcupsd: generic-usb.c:398 Initializing libusb
0.001 apcupsd: generic-usb.c:403 Found 0 USB busses
0.002 apcupsd: generic-usb.c:405 Found 0 USB devices
0.002 apcupsd: newups.c:108 write_unlock at generic-usb.c:633
apctest FATAL ERROR in generic-usb.c at line 636
Cannot find UPS device --
For a link to detailed USB trouble shooting information,
please see <http://www.apcupsd.com/support.html>.
0.002 apcupsd: newups.c:102 write_lock at generic-usb.c:656
0.002 apcupsd: newups.c:108 write_unlock at generic-usb.c:663
apctest error termination completed

This is what I think the issue is:
# grep '/dev' apctest.truss
open("/dev/usb0",O_RDWR,00)                      ERR#2 'No such file
or directory'
open("/dev/usb1",O_RDWR,00)                      ERR#2 'No such file
or directory'
open("/dev/usb2",O_RDWR,00)                      ERR#2 'No such file
or directory'
open("/dev/usb3",O_RDWR,00)                      ERR#2 'No such file
or directory'
open("/dev/usb4",O_RDWR,00)                      ERR#2 'No such file
or directory'
open("/dev/usb5",O_RDWR,00)                      ERR#2 'No such file
or directory'
open("/dev/usb6",O_RDWR,00)                      ERR#2 'No such file
or directory'
open("/dev/usb7",O_RDWR,00)                      ERR#2 'No such file
or directory'
open("/dev/usb8",O_RDWR,00)                      ERR#2 'No such file
or directory'
open("/dev/usb9",O_RDWR,00)                      ERR#2 'No such file
or directory'

FreeBSD's USB stack no longer appears to generate the '/dev/usb#'
entries. I tried symlinking the appropriate 'ugen' to 'usb0', but this
didn't help either.

# ln -s /dev/ugen1.2 /dev/usb0
# apctest -d 200


2010-09-03 14:29:04 apctest 3.14.8 (16 January 2010) freebsd
Checking configuration ...
0.000 apcupsd: apcconfig.c:799 After config scriptdir: "/usr/local/etc/apcupsd"
0.000 apcupsd: apcconfig.c:800 After config pwrfailpath: "/var/run"
0.000 apcupsd: apcconfig.c:801 After config nologinpath: "/var/run"
0.000 apcupsd: newups.c:102 write_lock at drivers.c:208
0.000 apcupsd: drivers.c:210 Looking for driver: usb
0.000 apcupsd: drivers.c:214 Driver apcsmart is configured.
0.000 apcupsd: drivers.c:214 Driver net is configured.
0.000 apcupsd: drivers.c:214 Driver usb is configured.
0.000 apcupsd: drivers.c:217 Driver usb found and attached.
0.000 apcupsd: newups.c:108 write_unlock at drivers.c:234
0.000 apcupsd: drivers.c:236 Driver ptr=0x8064e60
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 ...
usb_set_debug: Setting debugging level to 2 (on)
0.000 apcupsd: newups.c:102 write_lock at generic-usb.c:614
0.001 apcupsd: generic-usb.c:398 Initializing libusb
usb_os_find_busses: Found /dev/usb0
0.002 apcupsd: generic-usb.c:403 Found 1 USB busses
0.004 apcupsd: generic-usb.c:405 Found 0 USB devices
0.004 apcupsd: newups.c:108 write_unlock at generic-usb.c:633
apctest FATAL ERROR in generic-usb.c at line 636
Cannot find UPS device --
For a link to detailed USB trouble shooting information,
please see <http://www.apcupsd.com/support.html>.
0.004 apcupsd: newups.c:102 write_lock at generic-usb.c:656
0.004 apcupsd: newups.c:108 write_unlock at generic-usb.c:663
apctest error termination completed


Okay. Extremely lengthy email, but if anybody can help me with this
it'd be much appreicated.

Cheers,
Ben



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTi=WQFY85ckjhTwA%2BTGrqVozesdMGnEVWezT5Tks>