Citeren Brian Daniels <bitm...@pobox.com>:

upshid-ups is unable to communicate with the UPS, giving 'Protocol error'. I've also tried the snapshot and 2.7 svn release with the same results. Debug output is below, any ideas appreciated.

Could you try if the attached patch makes any difference? We've seen other reports from people having trouble communicating with their UPSes. It is also in the development version, so if it is more convenient to run that, this should be fine.

Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)
--- drivers/libhid.c	2011-01-15 21:03:53.149154167 +0100
+++ drivers/libhid.c	2011-02-11 10:10:02.529935413 +0100
@@ -141,7 +141,6 @@
 {
 	int	id = pData->ReportID;
 	int	r;
-	unsigned char	buf[SMALLBUF];
 
 	if (rbuf->ts[id] + age > time(NULL)) {
 		/* buffered report is still good; nothing to do */
@@ -149,17 +148,14 @@
 		return 0;
 	}
 
-	r = comm_driver->get_report(udev, id, buf, sizeof(buf));
+	r = comm_driver->get_report(udev, id, rbuf->data[id], rbuf->len[id]);
 	if (r <= 0) {
 		return -1;
 	}
 
-	/* broken report descriptors are common, so store whatever we can */
-	memcpy(rbuf->data[id], buf, (r < rbuf->len[id]) ? r : rbuf->len[id]);
-
 	if (rbuf->len[id] != r) {
 		upsdebugx(2, "%s: expected %d bytes, but got %d instead", __func__, rbuf->len[id], r);
-		upsdebug_hex(3, "Report[err]", buf, r);
+		upsdebug_hex(3, "Report[err]", rbuf->data[id], r);
 	} else {
 		upsdebug_hex(3, "Report[get]", rbuf->data[id], rbuf->len[id]);
 	}
_______________________________________________
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser

Reply via email to