[Nut-upsdev] BCMXCP USB driver issues for Powerware 5110 on OpenWRT (long)

Alexander V. Tsvyashchenko lists at ndl.kiev.ua
Mon Mar 6 20:02:22 UTC 2006


Hello All,

Sorry for the long post, I'm just trying to give as much info as I have
about the problem(s) ...

Recently I've tried to port NUT to the hardware router Asus WL-500g Deluxe
(http://wiki.openwrt.org/OpenWrtDocs/Hardware/Asus/WL500GD), that runs
OpenWRT Linux distribution (http://www.openwrt.org) based on Linux 2.4.30
kernel, in order to support my Powerware 5110 UPS (through USB interface).

Basically, the port was very easy, though the hardware seems to be quite
different from the "usual" PC (thanks to all developers for their efforts in
writing portable code! ;-)

However, I had some issues with making bcmxcp_usb driver to work, most of
them is related to libusb.

The first point was usb_clear_halt function call in nut_usb.c file during
device initialization: the driver reported "broken pipe" error. I'm not an
expert in USB devices programming, but based on the context, I would expect
that usb_resetep function would be more appropriate here - am I wrong?

Anyway, changing the call to usb_resetep did solve the problem for me, but
the next problem was during reading of the data from the UPS - it constantly
failed with the error "Invalid argument".

It took quite some time to understand what the problem is, but finally it
appeared that libusb uses  MAX_READ_WRITE constant that is equal to  16*1024
as limiting value when reading from USB device, while my UPS has 8 bytes
maximal packet size, and thus it seems that all readings must be done by
blocks that are not larger than 8 bytes. When I set MAX_READ_WRITE to 8 and
recompiled libusb, everything worked fine.

The questions are:
1) Am I right in the assumption usb_resetep should be used instead of
usb_clear_halt?

2) Whose fault is this "max-packet-size" issue? Is NUT using libusb
incorrectly? Is libusb coded wrongly? Is kernel USB driver wrong? What is
the best way to solve this issue? I can easily live with custom-recompiled
libusb, but that doesn't look too nice for me in the long run, as then this
problem can happen for somebody else ...

3) While NUT with recompiled USB works fine for my UPS, it reports once in
10-20 minutes "RECONNECT USB DEVICE" warning (there seems to be some reading
error for the command 0x35). Is this "normal" (i.e., expected with the
current version of the driver)?

Thanks!

Good luck!                            Alexander




More information about the Nut-upsdev mailing list