[Nut-upsuser] RE: Nut-upsuser Digest, Vol 11, Issue 3

Nevil Thatcher NevilTh at nat.com.au
Mon May 8 08:55:28 UTC 2006


Hi Vladimir,

I have got 2.0.3 working on netBSD 3.0.

To get it operational I needed to do the following (most of this is from
memory...).

1).
Recompile kernel with uhid removed. If uhid ataches to the device then
libusb is not able to. Have to allow generic usb driver ugen to claim port.


>From dmesg

usb0 at uhci0: USB revision 1.0
uhub0 at usb0
uhub0: VIA Technologies UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered

ugen0 at uhub0 port 1
ugen0: MGE UPS SYSTEMS NOVA AVR, rev 1.10/0.01, addr 2

2).

Install libusb 0.1.12

0.1.11 includes a bug fix for *BSD to allow short reads. Without this
various status is not returned from UPS.

3). I found another problem with libusb on netBSD in that the 

Function usb_interrupt_read() calls read() which blocks on read from usb
until buffer is full. In my case this was seemingly infinite. A timeout is
passed to the function but netBSD does not seem to respect this.

I have been meaning to lodge a bug-report but haven't as yet.

To fix (hack) I changed bsd.c in libusb as follows:

Change 
Fd = ensure_ep_open(dev, ep, 0, O_RDONLY)

To

Fd = ensure_ep_open(dev, ep, 0, O_RDONLY | O_NONBLOCK)

This just tells the read to return immediately if no data from usb rather
than block. OS buffers device anyway.

With this plus the information in the faqs I was able to achieve an
operational system.

Hope this is someway helps.

Nevil

Message: 1
Date: Sat, 6 May 2006 20:01:33 +0200 (CEST)
From: Vladimir Botka <vlado at botka.homeunix.org>
Subject: [Nut-upsuser] No USB/HID UPS found
To: nut-upsuser at lists.alioth.debian.org
Message-ID: <20060506194833.I47952 at srv.g1.netng.org>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

Hello,

Help me please with *newhidups* setup. Does it work for someone on *BSD ?


Here is the data.
---------------------------------------------------------------

*** FreeBSD
root.srv# uname -a
FreeBSD xxxxxx.dyndns.info 5.3-RELEASE FreeBSD 5.3-RELEASE #2: Tue Feb 8
07:38:22 UTC 2005
admin at temp.botka.homeunix.org:/usr/src/sys/i386/compile/SRV  i386

*** NUT ver.2.0.3
root.srv# ll /var/db/pkg/ | grep nut
drwxr-xr-x  2 root  wheel      512 May  6 19:53 nut-2.0.3
drwxr-xr-x  2 root  wheel      512 May  6 19:53 nut-usb-2.0.3

*** usbd can see the UPS on /dev/uhid0
root.srv# usbdevs -v -d -a 2
Controller /dev/usb0:
addr 2: low speed, self powered, config 1, Back-UPS CS 500 FW:808.q5.I USB
FW:q5(0x0002), American Power Conversion(0x051d), rev 0.06
   uhid0
Controller /dev/usb1:
Controller /dev/usb2:
Controller /dev/usb3:

*** HERE IS THE PROBLEM
root.srv# /usr/local/libexec/nut/newhidups -u root -DDDDD auto
Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3)

debug level is '5'
No appropriate HID device found
No matching USB/HID UPS found

root.srv# /usr/local/libexec/nut/newhidups -a myups -u root -DDDDD
/dev/uhid0
Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3)

debug level is '5'
No appropriate HID device found
No matching USB/HID UPS found

root.srv# cat /usr/local/etc/nut/ups.conf
[myups]
         driver = newhidups
         port = /dev/uhid0
         desc = "Back-UPS CS 500"

------------------------------------------------------------------

Thank you for your afford.

Cheers,

  -vlado

******




More information about the Nut-upsuser mailing list