Bus 005 Device 004: ID 06da:0003 Phoenixtec Power Co., Ltd moniscreen:~/debian/debian-nut-lindi/nut-2.0.1/drivers$ sudo ./mustekusb2 -DD auto Network UPS Tools - mustek UPS driver 0.2 (2.0.1) debug level is '2' found 7 busses found 10 devices usb_get_driver_np returned 0 interface 0 already claimed by driver "usbhid", attempting to detach it usb_detach_kernel_driver_np returned 0 1 get descriptor returned 18, bytes: 12 01 10 01 00 00 00 08 da 06 03 00 00 00 03 01 00 01 ".................." 2 get descriptor returned 9, bytes: 09 02 22 00 01 01 00 a0 32 "..".....2" 3 get descriptor returned 34, bytes: 09 02 22 00 01 01 00 a0 32 09 04 00 00 01 03 00 00 00 09 21 11 01 00 01 22 1b 00 07 05 81 03 08 00 14 "..".....2..........!...."........." 4 set configuration returned 0 4 set alternate setting returned 0 5 control msg returned 0 6 get descriptor returned 27, bytes: 06 00 ff 09 01 a1 01 09 02 15 00 26 ff 00 75 08 95 08 81 82 09 02 95 08 91 82 c0 "...........&..u............" 7 interrupt read returned -110, bytes: 8 interrupt read returned -110, bytes: 19 interrupt read returned -110, bytes: 18 control msg returned 8 19 interrupt read returned 8, bytes: 28 32 32 34 2e 35 20 32 "(224.5 2" 19 interrupt read returned 8, bytes: 32 34 2e 35 20 32 32 34 "24.5 224" 19 interrupt read returned 8, bytes: 2e 35 20 30 31 39 20 34 ".5 019 4" 19 interrupt read returned 8, bytes: 39 2e 39 20 31 33 2e 37 "9.9 13.7" 19 interrupt read returned 8, bytes: 20 32 35 2e 30 20 30 30 " 25.0 00" 19 interrupt read returned 8, bytes: 30 30 31 30 30 31 0d 34 "001001.4" 19 interrupt read returned 8, bytes: 2e 35 20 30 31 39 20 34 ".5 019 4" 19 interrupt read returned 8, bytes: 39 2e 39 20 31 33 2e 37 "9.9 13.7" 19 interrupt read returned -110, bytes: 18 control msg returned 8 19 interrupt read returned 8, bytes: 28 32 32 34 2e 35 20 32 "(224.5 2" 19 interrupt read returned 8, bytes: 32 34 2e 35 20 32 32 34 "24.5 224" 19 interrupt read returned 8, bytes: 2e 35 20 30 31 39 20 34 ".5 019 4" 19 interrupt read returned 8, bytes: 39 2e 39 20 31 33 2e 37 "9.9 13.7" 19 interrupt read returned 8, bytes: 20 32 35 2e 30 20 30 30 " 25.0 00" 19 interrupt read returned 8, bytes: 30 30 31 30 30 31 0d 34 "001001.4" 19 interrupt read returned 8, bytes: 2e 35 20 30 31 39 20 34 ".5 019 4" 19 interrupt read returned 8, bytes: 39 2e 39 20 31 33 2e 37 "9.9 13.7" 19 interrupt read returned -110, bytes: Syncing with UPS: mustekusb_send sending bytes:46 0d 4d 6f f1 cf 11 88 "F.Mo...." control msg returned 8 interrupt read returned 8, bytes: 23 32 32 30 2e 30 20 30 "#220.0 0" interrupt read returned 8, bytes: 30 32 20 31 32 2e 30 30 "02 12.00" interrupt read returned 8, bytes: 20 35 30 2e 30 0d 00 00 " 50.0..." interrupt read returned 8, bytes: 00 00 00 00 00 00 00 00 "........" interrupt read returned 8, bytes: 23 32 32 30 2e 30 20 30 "#220.0 0" interrupt read returned 8, bytes: 30 32 20 31 32 2e 30 30 "02 12.00" interrupt read returned 8, bytes: 20 35 30 2e 30 0d 00 00 " 50.0..." interrupt read returned 8, bytes: 00 00 00 00 00 00 00 00 "........" interrupt read returned -110, bytes: buf = 23 32 32 30 2e 30 20 30 30 32 20 31 32 2e 30 30 20 35 30 2e 30 0d 00 00 00 00 00 00 00 00 00 00 23 32 32 30 2e 30 20 30 30 32 20 31 32 2e 30 30 20 35 30 2e 30 0d 00 00 00 00 00 00 00 00 00 00 "#220.0 002 12.00 50.0...........#220.0 002 12.00 50.0..........." mustekusb_send sending bytes:51 31 0d 6f f1 cf 11 88 "Q1.o...." control msg returned 8 interrupt read returned 8, bytes: 28 32 32 34 2e 31 20 32 "(224.1 2" moniscreen:~$ sudo strace -o megatec_usb-with-mustek2.strace -s4096 -f /lib/nut/megatec_usb -a myups -DDDDD -x vendorid=06da -x productid=0003 -x subdriver=agiler Network UPS Tools 2.2.0 - Megatec protocol driver 1.5.4 [megatec_usb] Carlos Rodrigues (c) 2003-2007 Serial-over-USB transport layer for Megatec protocol driver [megatec_usb] debug level is '5' Checking device (413C/2003) (001/005) - VendorID: 413c - ProductID: 2003 - Manufacturer: unknown - Product: unknown - Serial Number: unknown - Bus: 001 Trying to match device Device does not match - skipping Checking device (413C/3016) (001/004) - VendorID: 413c - ProductID: 3016 - Manufacturer: unknown - Product: unknown - Serial Number: unknown - Bus: 001 Trying to match device Device does not match - skipping Checking device (0000/0000) (001/001) - VendorID: 0000 - ProductID: 0000 - Manufacturer: unknown - Product: unknown - Serial Number: unknown - Bus: 001 Trying to match device Device does not match - skipping Checking device (0000/0000) (007/001) - VendorID: 0000 - ProductID: 0000 - Manufacturer: unknown - Product: unknown - Serial Number: unknown - Bus: 007 Trying to match device Device does not match - skipping Checking device (0000/0000) (003/001) - VendorID: 0000 - ProductID: 0000 - Manufacturer: unknown - Product: unknown - Serial Number: unknown - Bus: 003 Trying to match device Device does not match - skipping Checking device (0000/0000) (006/001) - VendorID: 0000 - ProductID: 0000 - Manufacturer: unknown - Product: unknown - Serial Number: unknown - Bus: 006 Trying to match device Device does not match - skipping Checking device (0000/0000) (004/001) - VendorID: 0000 - ProductID: 0000 - Manufacturer: unknown - Product: unknown - Serial Number: unknown - Bus: 004 Trying to match device Device does not match - skipping Checking device (0000/0000) (002/001) - VendorID: 0000 - ProductID: 0000 - Manufacturer: unknown - Product: unknown - Serial Number: unknown - Bus: 002 Trying to match device Device does not match - skipping Checking device (06DA/0003) (005/004) - VendorID: 06da - ProductID: 0003 - Manufacturer: OMRON - Product: 87XXUPS - Serial Number: unknown - Bus: 005 Trying to match device Device matches Starting UPS detection process... Attempting to detect the UPS... Sending "Q1" command... "Q1" command successful. Attempting to detect the UPS... Sending "Q1" command... Wrong answer to "Q1" command. Attempting to detect the UPS... Sending "Q1" command... Wrong answer to "Q1" command. Attempting to detect the UPS... Sending "Q1" command... Wrong answer to "Q1" command. Attempting to detect the UPS... Sending "Q1" command... Wrong answer to "Q1" command. 4 out of 5 detection attempts failed (minimum failures: 2). The UPS is supported, but the connection is too unreliable. Try checking the cable for defects. moniscreen:~$ agiler reads 6 8-byte blocks, we should read 8 8-byte blocks. forking to agiler2. this improved the situation a bit Sending "Q1" command... "Q1" command successful. Attempting to detect the UPS... Sending "Q1" command... "Q1" command successful. Attempting to detect the UPS... Sending "Q1" command... "Q1" command successful. Attempting to detect the UPS... Sending "Q1" command... "Q1" command successful. Attempting to detect the UPS... Sending "Q1" command... "Q1" command successful. 0 out of 5 detection attempts failed (minimum failures: 2). Asking for UPS information ("I" command)... UPS doesn't return any information about itself. Megatec protocol UPS detected. Asking for UPS power ratings ("F" command)... UPS doesn't return any information about its power ratings. Cannot calculate charge percentage for this UPS. Done setting up the UPS. Asking for UPS status ("Q1" command)... UPS doesn't return any information about its status. dstate_init: sock /var/run/nut/megatec_usb-myups open on fd 5 Asking for UPS status ("Q1" command)... UPS doesn't return any information about its status. Asking for UPS status ("Q1" command)... UPS doesn't return any information about its status. Asking for UPS status ("Q1" command)... UPS doesn't return any information about its status. Asking for UPS status ("Q1" command)... UPS doesn't return any information about its status. but now extra commands confuse the UPS. I returns !\t\0\3\0\0\10\0 and others protocol error. mustekusb2 asked F\r just fine and parsed results with sscanf(buf, "%*c %f %d %*f %f", &ratevolt, &ratecurrent, &ratefreq); Q1\r F\r S02R0001