Re: [Nut-upsuser] nut unable to communicate with new APC SMX100 over USB

2011-02-11 Thread Arjen de Korte

Citeren Brian Daniels :

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

[Nut-upsuser] nut unable to communicate with new APC SMX100 over USB

2011-02-04 Thread Brian Daniels
I'm trying to set up nut-2.6 with a SMX1000 ups unit from APC on a 
CentOS 4.8 server.  It's connected via USB, and Linux has detected it as 
a HID device.  Nut was built from source code.


T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 21 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=051d ProdID=0003 Rev= 1.06
S:  Manufacturer=American Power Conversion
S:  Product= FW:COM 02.3 /
S:  SerialNumber=
C:* #Ifs= 1 Cfg#= 1 Atr=60 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
E:  Ad=01(O) Atr=03(Int.) MxPS=  64 Ivl=32ms

I have it configured in ups.conf as:
[apc]
driver = usbhid-ups
vendorid=051d
productid=0003
port=auto

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.



#./usbhid-ups -DDD -a apc
Network UPS Tools - Generic HID driver 0.35 (2.6.0)
USB communication driver 0.31
   0.00 debug level is '3'
   0.000656 upsdrv_initups...
   0.001123 Checking device (058F/9360) (005/002)
   0.001180 - VendorID: 058f
   0.001189 - ProductID: 9360
   0.001197 - Manufacturer: unknown
   0.001204 - Product: unknown
   0.001211 - Serial Number: unknown
   0.001218 - Bus: 005
   0.001225 Trying to match device
   0.001244 Device does not match - skipping
   0.001256 Checking device (/) (005/001)
   0.001279 - VendorID: 
   0.001287 - ProductID: 
   0.001294 - Manufacturer: unknown
   0.001301 - Product: unknown
   0.001308 - Serial Number: unknown
   0.001315 - Bus: 005
   0.001321 Trying to match device
   0.001329 Device does not match - skipping
   0.001338 Checking device (/) (004/001)
   0.001360 - VendorID: 
   0.001368 - ProductID: 
   0.001375 - Manufacturer: unknown
   0.001382 - Product: unknown
   0.001389 - Serial Number: unknown
   0.001395 - Bus: 004
   0.001402 Trying to match device
   0.001410 Device does not match - skipping
   0.001419 Checking device (051D/0003) (003/020)
   0.014186 - VendorID: 051d
   0.014343 - ProductID: 0003
   0.014459 - Manufacturer: American Power Conversion
   0.014615 - Product:  FW:COM 02.3 /
   0.014737 - Serial Number: AS1018320628
   0.014848 - Bus: 003
   0.014981 Trying to match device
   0.015118 interrupt pipe disabled (add 'pollonly' flag to 
'ups.conf' to get rid of this message)

   0.015375 Device matches
   0.015513 failed to claim USB device: could not claim interface 
0: Device or resource busy

   0.032673 detached kernel driver from USB device...
   0.042217 HID descriptor, method 1: (9 bytes) => 09 21 00 01 21 
01 22 ad 01
   0.042502 HID descriptor, method 2: (9 bytes) => 09 21 00 01 21 
01 22 ad 01

   0.043238 HID descriptor length 429
   0.044218 Report Descriptor size = 429
   0.044342 Report Descriptor: (429 bytes) => 05 84 09 04 a1 01 09 
24 a1 02 85 01 09 fe
   0.044543  79 02 75 08 95 01 15 00 26 ff 00 b1 22 85 02 09 ff 79 
03 b1 22 85 03 09 fd
   0.044808  79 01 b1 22 05 85 85 04 09 8f 79 01 b1 22 85 05 09 89 
79 04 b1 22 85 06 09
   0.045000  8b b1 22 09 2c b1 22 85 0e 09 83 25 64 b1 22 09 67 b1 
22 85 0c 09 66 81 22
   0.045381  09 66 b1 a2 85 10 09 8d b1 22 09 8e b1 22 85 0f 09 8c 
b1 22 85 11 09 29 b1
   0.045500  a2 85 09 09 85 75 10 27 ff ff 00 00 b1 a2 85 0d 09 68 
27 ff ff 00 00 66 01
   0.045629  10 55 00 81 a2 09 68 b1 a2 05 84 85 12 09 57 16 ff ff 
26 ff 7f b1 a2 85 13
   0.045750  09 55 75 18 17 ff ff ff ff 27 18 c5 13 00 b1 a2 05 85 
85 08 09 2a 27 64 05
   0.045870  00 00 16 78 00 81 22 09 2a b1 a2 05 84 85 0a 09 40 75 
10 15 00 27 ff ff 00
   0.045993  00 67 21 d1 f0 00 55 05 b1 22 85 0b 09 30 b1 a2 85 14 
09 5a 75 08 15 01 25
   0.046117  03 65 00 55 00 81 22 09 5a b1 a2 09 02 a1 02 85 07 05 
85 09 44 75 01 15 00
   0.046224  25 01 81 a2 09 44 b1 a2 09 45 81 a2 09 45 b1 a2 09 d0 
81 a2 09 d0 b1 a2 09
   0.046345  d1 81 a2 09 d1 b1 a2 09 42 81 a2 09 42 b1 a2 05 84 09 
68 81 a2 09 68 b1 a2
   0.046467  09 69 81 a2 09 69 b1 a2 05 85 09 43 81 a2 09 43 b1 a2 
05 84 09 73 81 a2 09
   0.046607  73 b1 a2 05 85 09 4b 81 a2 09 4b b1 a2 05 84 09 65 81 
a2 09 65 b1 a2 05 85
   0.046725  09 db 81 a2 09 db b1 a2 06 86 ff 09 80 81 a2 09 80 b1 
a2 95 03 81 01 b1 01
   0.046848  c0 c0 05 8c 09 01 a1 00 85 89 09 00 15 00 26 ff 00 75 
08 95 3f 81 02 85 90

   0.046950  09 00 15 00 26 ff 00 75 08 95 3f 91 02 c0 c0
   0.047210 Using subdriver: APC HID 0.95
   0.049181 Report[get]: (2 bytes) => 01 02
   0.049296 Path: UPS.PowerSummary.iProduct, Type: Feature, 
ReportID: 0x01, Offset: 0, Size: 8, Value: 2
   0.050313 libusb_get_report: error sending control message: 
P