[Nut-upsdev] Krauler UP-M500VA investigation
Alexander I. Gordeev
lasaine at lvk.cs.msu.su
Thu Nov 16 23:06:27 CET 2006
Success!
I haven't yet switched UPS to Windows box so I haven't tried usbsnoop.
But I tried your program, Peter. It WORKS! UPS is responding.
By the way, could you please explain what is "descriptor" and "index"
and how to choose them?
Here are some logs of program starts with different parameters:
Here I tried values that newhidups had reported
-----------------------------------------------
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 1 16
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x01 index 16:
12 01 00 01 00 00 00 08 01 00 00 00 00 01 01 02 00 01
..................
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 2 16
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x02 index 16:
09 02 22 00 01 01 00 80 32 09 04 00 00 01 03 00 00 00 09 21 00 01 00 01
22 70 02 07 05 81 03 08 00 0a
..".....2..........!...."p........
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 16
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 16:
04 03 09 00
....
The same output comes for all indexes from 0 to about 30 with descriptor = 1
----------------------------------------------------------------------------
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 1 0
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x01 index 0:
12 01 00 01 00 00 00 08 01 00 00 00 00 01 01 02 00 01
..................
Quite the same situation with descriptor = 2
--------------------------------------------
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 2 0
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x02 index 0:
09 02 22 00 01 01 00 80 32 09 04 00 00 01 03 00 00 00 09 21 00 01 00 01
22 70 02 07 05 81 03 08 00 0a
..".....2..........!...."p........
With descriptor = 3:
--------------------
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 0
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 0:
04 03 09 00
....
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 1
Can't get endpoint 129 descriptor 0x03 index 1: error sending control message: Connection timed out
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 2
Can't get endpoint 129 descriptor 0x03 index 2: error sending control message: Connection timed out
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 3
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 3:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 4
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 4:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 5
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 5:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 6
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 6:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 7
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 7:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
And at this point I noticed a beep from the UPS! I tried this sequence
once more and behaviour of this run changed:
----------------------------------------------------------------------
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 3
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 3:
60 03 28 00 32 00 32 00 39 00 2e 00 30 00 20 00 31 00 36 00 35 00 2e 00
30 00 20 00 32 00 32 00 39 00 2e 00 30 00 20 00 30 00 30 00 30 00 20 00
35 00 30 00 2e 00 30 00 20 00 31 00 33 00 2e 00 36 00 20 00 30 00 30 00
2e 00 30 00 20 00 30 00 30 00 30 00 30 00 31 00 30 00 30 00 30 00 0d 00
`.(.2.2.9...0. .1.6.5...0. .2.2.9...0. .0.0.0. .5.0...0. .1.3...6. .0.0.
..0. .0.0.0.0.1.0.0.0...
And it also changes from time to time:
--------------------------------------
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 3
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 3:
60 03 28 00 32 00 32 00 39 00 2e 00 30 00 20 00 31 00 36 00 35 00 2e 00
30 00 20 00 32 00 32 00 39 00 2e 00 30 00 20 00 30 00 30 00 30 00 20 00
35 00 30 00 2e 00 30 00 20 00 31 00 33 00 2e 00 35 00 20 00 30 00 30 00
2e 00 30 00 20 00 30 00 30 00 30 00 30 00 31 00 30 00 30 00 30 00 0d 00
`.(.2.2.9...0. .1.6.5...0. .2.2.9...0. .0.0.0. .5.0...0. .1.3...5. .0.0.
..0. .0.0.0.0.1.0.0.0...
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 3
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 3:
60 03 28 00 32 00 33 00 31 00 2e 00 30 00 20 00 31 00 36 00 35 00 2e 00
30 00 20 00 32 00 33 00 31 00 2e 00 30 00 20 00 30 00 30 00 30 00 20 00
35 00 30 00 2e 00 30 00 20 00 31 00 33 00 2e 00 35 00 20 00 30 00 30 00
2e 00 30 00 20 00 30 00 30 00 30 00 30 00 31 00 30 00 30 00 30 00 0d 00
`.(.2.3.1...0. .1.6.5...0. .2.3.1...0. .0.0.0. .5.0...0. .1.3...5. .0.0.
..0. .0.0.0.0.1.0.0.0...
Some other interesting logs:
----------------------------
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 12
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 12:
50 03 23 00 4b 00 52 00 41 00 55 00 4c 00 45 00 52 00 20 00 20 00 20 00
20 00 20 00 20 00 20 00 20 00 20 00 55 00 50 00 2d 00 4d 00 35 00 30 00
30 00 56 00 41 00 20 00 20 00 56 00 45 00 52 00 33 00 2e 00 30 00 30 00
20 00 20 00 20 00 0d 00
P.#.K.R.A.U.L.E.R. . . . . . . . . .U.P.-.M.5.0.0.V.A. . .V.E.R.3...0.0.
. . ...
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 13
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 13:
2e 03 23 00 32 00 32 00 35 00 2e 00 30 00 20 00 30 00 30 00 34 00 20 00
31 00 31 00 2e 00 35 00 30 00 20 00 35 00 30 00 2e 00 30 00 0d 00
..#.2.2.5...0. .0.0.4. .1.1...5.0. .5.0...0...
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 19
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 19:
60 03 28 00 32 00 32 00 39 00 2e 00 30 00 20 00 31 00 36 00 35 00 2e 00
30 00 20 00 32 00 32 00 39 00 2e 00 30 00 20 00 30 00 30 00 30 00 20 00
35 00 30 00 2e 00 30 00 20 00 31 00 33 00 2e 00 36 00 20 00 30 00 30 00
2e 00 30 00 20 00 30 00 30 00 30 00 30 00 31 00 30 00 30 00 30 00 0d 00
`.(.2.2.9...0. .1.6.5...0. .2.2.9...0. .0.0.0. .5.0...0. .1.3...6. .0.0.
..0. .0.0.0.0.1.0.0.0...
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 20
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 20:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 21
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 21:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 22
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 22:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 23
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 23:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 24
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 24:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 25
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 25:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 26
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 26:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 27
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 27:
16 03 55 00 50 00 53 00 20 00 4e 00 6f 00 20 00 41 00 63 00 6b 00
..U.P.S. .N.o. .A.c.k.
Nearly every time I got "..U.P.S. .N.o. .A.c.k." message UPS beeped or
uttered some clicking sounds
----------------------------------------------------------------------
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 28
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 28:
50 03 22 00 4b 00 52 00 41 00 55 00 4c 00 45 00 52 00 20 00 20 00 20 00
20 00 20 00 20 00 20 00 20 00 20 00 55 00 50 00 2d 00 4d 00 35 00 30 00
30 00 56 00 41 00 20 00 20 00 56 00 45 00 52 00 33 00 2e 00 30 00 30 00
20 00 20 00 20 00 0d 00
P.".K.R.A.U.L.E.R. . . . . . . . . .U.P.-.M.5.0.0.V.A. . .V.E.R.3...0.0.
. . ...
admin at router:/home/alex/work/module-dev/hid> ./get_descriptor 001 003 1 0 0 129 3 29
Bus 001 device 003 configuration 1 interface 0 altsetting 0 endpoint 129 descriptor 0x03 index 29:
2e 03 23 00 32 00 32 00 35 00 2e 00 30 00 20 00 30 00 30 00 34 00 20 00
31 00 31 00 2e 00 35 00 30 00 20 00 35 00 30 00 2e 00 30 00 0d 00
..#.2.2.5...0. .0.0.4. .1.1...5.0. .5.0...0...
Sorry if I quoted too much.
P.S. I forgot that when I was experimenting for the first time some
equipment was plugged in and after one run UPS powered itself off.
After that I unplugged the devices for safety and without load it
never turns off.
Peter Selinger wrote:
> It's an interesting guess, but this is not possible. The reason is
> that (as Charles already pointed out) one never asks a HID device for
> '00860004.xxx' - one asks, e.g., for "Report number 13". The UPS sends
> a sort of directory in the beginning, explaining what reports
> correspond to what usages. So in a sense the usages such as '00860004'
> are purely informational.
> It is, however, possible that it sends the wrong report id's, or that
> the hardware is simply too slow to respond to our requests (as Charles
> suggested).
> I once posted a program called get_descriptor.c on the nut-upsdev
> mailing list [attached below]. This is a simple tool that can be used
> to experiment with retrieving individual reports from a USB device
> from the command line. It might be a good starting point for
> exploration, as it is relatively simple to modify (e.g. to insert
> timing delays).
> If we find some hack that works, we can then worry about how newhidups
> should be modified.
> -- Peter
--
Alexander mailto:lasaine at lvk.cs.msu.su
More information about the Nut-upsdev
mailing list