[Nut-upsdev] Powerware PW5115 USB driver

Kjell Claesson kjell.claesson at epost.tidanet.se
Wed Nov 7 16:35:46 UTC 2007

Den Wednesday 07 November 2007 10.18.53 skrev Max E. Kuznecov:
> Hi
Hi Max
> I have PW 5115 500 UPS which has both RS232 and USB connectors.
> bcmxcp driver works fine with serial connection but bcmxcp_usb does
> not with USB one.
> After some USB sniffing on windows box I've found that PW5115
> communicates in other way than supposed in driver. Applying attached
> patch makes driver to work properly.
> System: FreeBSD 6.2 but ugen driver needs patching in order to respect
> given timeout, patch already included in 7.0
> (http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/usb/ugen.c.diff?r1=1.109
>;r2=1.110) maybe it will be backported in future.
> However I'm unsure whether PW3105 and PW5110 (those two used with
> bcmxcp_usb driver) will work after this change.

Can not see that ther is any difference in handling.

Part of the patch:
 void send_write_command(unsigned char *command, int command_length)
@@ -29,7 +29,7 @@
 	/* Add checksum */
 	sbuf[command_length] = calc_checksum(sbuf);
 	command_length += 1;
-	usb_set_descriptor(upsdev, USB_DT_STRING, 4, sbuf, command_length);  /* 
Ignore error */
+	usb_control_msg(upsdev, 0x42, 0x0d, (0x00 << 8) + 0x0, 0, sbuf, 
command_length, 1000);

As you see it calls 'usb_set_descriptor' this is a function in nut_usb.c and 
look like this.
int usb_set_descriptor(usb_dev_handle *udev, unsigned char type,
		       unsigned char index, void *buf, int size)
	return usb_control_msg(udev, USB_ENDPOINT_OUT, USB_REQ_SET_DESCRIPTOR,
				(type << 8) + index, 0, buf, size, 1000);

So the only thing you do is send the command twise.

Maybe Arjen can bring some light into this. As it is a usb (libusb) function. 
And the this is that in your control message you hardcode the

And it is if this differs from that reported under enumerating of the device.


More information about the Nut-upsdev mailing list