[Nut-upsdev] APC Smart-UPS 1000 RM USB problems with newhidups

Peter Selinger selinger at mathstat.dal.ca
Fri Feb 3 15:49:53 UTC 2006


George Ross wrote:
> 
> > I am attaching below a program that one can use (as root) to read
> > descriptors from a USB device and dump them to stdout.
> 
> If that's the same program that I got from Charles Lepple in January, then 
> I expect the output will still be:
> 
> > [haitink+]root: ./get_descriptor 002 002 1 0 0 128 0x21 0
> > Bus 002 device 002 configuration 1 interface 0 altsetting 0 endpoint 128 descriptor 0x21 index 0:
> > 
> >  09 21 10 01 21 01 22 f3 f1
> > 
> >  .!..!."..
> > 
> > (which corresponds with what I'd got when I hacked newhidups's libusb.c to
> > print out the HID descriptor contents).  The "f3 f1" looks wrong, both here
> > and as obtained by newhidups -- I would have expected "10 04".  Linux with 
> > a 2.6.12-1.1381_FC3 kernel and libusb-0.1.10a, btw.

Yes, it's the same output, and yes, the "f3 f1" should be "10 04" or
similar. So technically, it is the UPS that is buggy, and not NUT.  Of
course, the right thing to do would be to work around the problem,
i.e., compensate for this bug on the driver side.

I have not looked at the lsusb sources, but I expect that it simply
ignores the value from descriptor 0x21, and either reads descriptor
0x22 into a very large buffer, or tries for larger and larger buffers
until the read is successful. This is a bit awkward, because some
*other* UPS models, such as Belkin, which actually have the correct
value in the 0x21 descriptor, might crash if you try to read more
bytes than allowed. Probably we should examine how lsusb determines
this value, and use the same method.

> (I see that was on the nut-upsuser list, probably as a result of following 
> up a message thread which started out there.)

I stopped following both lists for a while because I was too busy, so
I probably missed the discussion in January. I am still busy now, so
it might be some time until I can implement a permanent workaround for
this problem. I might be able to do a little here and there. 

-- Peter



More information about the Nut-upsdev mailing list