[Nut-upsuser] Re: bcmxcp_usb "Can't open POWERWARE USB

Peter Selinger selinger at mathstat.dal.ca
Sun Apr 16 16:57:36 UTC 2006


Kjell Claesson wrote:
> 
> Hi,
> 
> The problem was reported to me by Charlie Garrison
> that helped me testing the 5115 usb.
> 
> The first implementation was not done by powerware.
> So if you look at the code in drivers/nut_usb.c
> line 58.
> --------------------------------------------------
> /* XXX Check for POWERWARE 3105 or 3110 ... other models??? */
> 	if (dev->descriptor.bDeviceClass == USB_CLASS_PER_INTERFACE &&
> 	    (dev->descriptor.idVendor == 0x0592 ||
> 	     dev->descriptor.idVendor == 0x06da) &&
> 	    dev->descriptor.idProduct == 0x0002 &&
> 	    dev->descriptor.iManufacturer == 1 &&
> 	    dev->descriptor.iProduct == 2)
> 		return usb_open(dev);
> -----------------------------------------------------
> 
> It check the iManufacturer and iProduct code. 

This code actually makes no sense. Note that, as per the USB
specification (http://www.usb.org/developers/docs/, section 9.6.1),
iManufacturer and iProduct are merely string indexes, i.e., *pointers*
to strings describing the manufacturer and product. It makes no sense
to compare these indexes to predefined numbers. Instead, you should
compare the strings being pointed to, or better, check only idVendor
and idProduct. (Note that the strings given by iManufacturer and
iProduct are meant to be human-readable, so one should not rely on
these to be exactly the same from one product to the next).

> This is not the same on the 5115 and 3110.
> So that is why it can't open the device.
> 
> It should look like this.
> ----------------------------
>     dev->descriptor.iManufacturer == 4
>     dev->descriptor.iProduct == 24
> -------------------------------
> 
> Or you may remove the lines like this
> ----------------------------------------
> /* XXX Check for POWERWARE 3105 or 3110 ... other models??? */
> 	if (dev->descriptor.bDeviceClass == USB_CLASS_PER_INTERFACE &&
> 	    (dev->descriptor.idVendor == 0x0592 ||
> 	     dev->descriptor.idVendor == 0x06da) &&
> 	    dev->descriptor.idProduct == 0x0002)
> 		return usb_open(dev);
> -----------------------------------------

This last solution is the only sensible one IMHO. -- Peter



More information about the Nut-upsuser mailing list