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

Kjell Claesson kjell.claesson at telia.com
Sun Apr 16 18:04:20 UTC 2006


Ok Peter,

Thank's for the comment. I was on my way to remove the lines
in the nut_usb.c. As it is a type of vendor device it follows
it's own rules ;-(

Regards
Kjell

sön 2006-04-16 klockan 13:57 -0300 skrev Peter Selinger:
> 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
> 
> _______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser




More information about the Nut-upsuser mailing list