[Nut-upsdev] support for newer mustek powermust model 06da:0003

Timo Lindfors timo.lindfors at iki.fi
Mon Nov 26 12:38:47 UTC 2007


Hi,

Arjen de Korte <nut+devel at de-korte.org> writes:
> Let's try that. Could you try SVN revision 1159?

$ sudo strace -o svn1160-phoenix.strace -s4096 -f /lib/nut/megatec_usb -a myups -DDDDD
Network UPS Tools 2.3.0-1160M - Megatec protocol driver 1.5.8 [megatec_usb]
Carlos Rodrigues (c) 2003-2007

Serial-over-USB transport layer for Megatec protocol driver [megatec_usb]
Andrey Lelikov (c) 2006, Alexander Gordeev (c) 2006-2007, Jon Gough (c) 2007

debug level is '5'
Checking device (0000/0000) (005/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: unknown
- Product: unknown
- Serial Number: unknown
- Bus: 005
Trying to match device
Device does not match - skipping
Checking device (06DA/0003) (004/002)
- VendorID: 06da
- ProductID: 0003
- Manufacturer: unknown
- Product: 87XXUPS
- Serial Number: unknown
- Bus: 004
Trying to match device
Device matches
failed to claim USB device, trying 2 more time(s)...
detaching kernel driver from USB device...
trying again to claim USB device...
Starting UPS detection process...
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(220.5 2]
get_data_phoenix: (8 bytes) => 28 32 32 30 2e 35 20 32
get_data_phoenix: got so far [(220.5 220.5 220]
get_data_phoenix: (16 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30
get_data_phoenix: got so far [(220.5 220.5 220.5 020 4]
get_data_phoenix: (24 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 32 30 20 34
get_data_phoenix: got so far [(220.5 220.5 220.5 020 49.9 13.7]
get_data_phoenix: (32 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 32 30 20 34 39 2e 39 20 31 33 2e 37
get_data_phoenix: got so far [(220.5 220.5 220.5 020 49.9 13.7 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 32 30 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(220.5 220.5 220.5 020 49.9 13.7 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 32 30 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
0.5 020 4]hoenix: got so far [(220.5 220.5 220.5 020 49.9 13.7 25.0 00001001
get_data_phoenix: (56 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 32 30 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30 2e 35 20 30 32 30 20 34
0.5 020 49.9 13.7]got so far [(220.5 220.5 220.5 020 49.9 13.7 25.0 00001001
get_data_phoenix: (64 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 32 30 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30 2e 35 20 30 32 30 20 34 39 2e 39 20 31 33 2e 37
Q1 => OK [(220.5 220.5 220.5 020 49.9 13.7 25.0 00001001]
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(220.5 2]
get_data_phoenix: (8 bytes) => 28 32 32 30 2e 35 20 32
get_data_phoenix: got so far [(220.5 220.5 220]
get_data_phoenix: (16 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30
get_data_phoenix: got so far [(220.5 220.5 220.5 019 4]
get_data_phoenix: (24 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34
get_data_phoenix: got so far [(220.5 220.5 220.5 019 49.9 13.7]
get_data_phoenix: (32 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37
get_data_phoenix: got so far [(220.5 220.5 220.5 019 49.9 13.7 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(220.5 220.5 220.5 019 49.9 13.7 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
0.5 019 4]hoenix: got so far [(220.5 220.5 220.5 019 49.9 13.7 25.0 00001001
get_data_phoenix: (56 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30 2e 35 20 30 31 39 20 34
0.5 019 49.9 13.7]got so far [(220.5 220.5 220.5 019 49.9 13.7 25.0 00001001
get_data_phoenix: (64 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37
Q1 => OK [(220.5 220.5 220.5 019 49.9 13.7 25.0 00001001]
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(220.5 2]
get_data_phoenix: (8 bytes) => 28 32 32 30 2e 35 20 32
get_data_phoenix: got so far [(220.5 220.5 220]
get_data_phoenix: (16 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30
get_data_phoenix: got so far [(220.5 220.5 220.5 019 4]
get_data_phoenix: (24 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34
get_data_phoenix: got so far [(220.5 220.5 220.5 019 49.9 13.7]
get_data_phoenix: (32 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37
get_data_phoenix: got so far [(220.5 220.5 220.5 019 49.9 13.7 25.0 00]
get_data_phoenix: (40 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30
0]t_data_phoenix: got so far [(220.5 220.5 220.5 019 49.9 13.7 25.0 00001001
get_data_phoenix: (48 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30
0.5 019 4]hoenix: got so far [(220.5 220.5 220.5 019 49.9 13.7 25.0 00001001
get_data_phoenix: (56 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30 2e 35 20 30 31 39 20 34
0.5 019 49.9 13.7]got so far [(220.5 220.5 220.5 019 49.9 13.7 25.0 00001001
get_data_phoenix: (64 bytes) => 28 32 32 30 2e 35 20 32 32 30 2e 35 20 32
32 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37 20 32 35 2e 30 20 30
30 30 30 31 30 30 31 0d 30 2e 35 20 30 31 39 20 34 39 2e 39 20 31 33 2e 37
Q1 => OK [(220.5 220.5 220.5 019 49.9 13.7 25.0 00001001]
3 out of 3 detection attempts succeeded (minimum required 3)
Asking for UPS information [I]...
I => FAILED [short read]
I detail: (0 bytes) =>
Megatec protocol UPS detected.
Asking for UPS power ratings [F]...
get_data_phoenix: got so far [! ]
get_data_phoenix: (8 bytes) => 21 09 00 03 00 00 08 00
get_data_phoenix: got so far [! ]
get_data_phoenix: (16 bytes) => 21 09 00 03 00 00 08 00 21 09 00 03 00 00
08 00
get_data_phoenix: got so far [! ]
get_data_phoenix: (24 bytes) => 21 09 00 03 00 00 08 00 21 09 00 03 00 00
08 00 21 09 00 03 00 00 08 00
get_data_phoenix: got so far [! ]
get_data_phoenix: (32 bytes) => 21 09 00 03 00 00 08 00 21 09 00 03 00 00
08 00 21 09 00 03 00 00 08 00 21 09 00 03 00 00 08 00
F => FAILED [short read]
F detail: (16 bytes) => 21 09 03 08 21 09 03 08 21 09 03 08 21 09 03 08
Cannot calculate charge percentage for this UPS.
Done setting up the UPS.
Asking for UPS status [Q1]...
Q1 => FAILED [short read]
Q1 detail: (0 bytes) =>
dstate_init: sock /var/run/nut/megatec_usb-myups open on fd 5
Asking for UPS status [Q1]...
Q1 => FAILED [short read]
Q1 detail: (0 bytes) =>
Asking for UPS status [Q1]...
Q1 => FAILED [short read]
Q1 detail: (0 bytes) =>
Asking for UPS status [Q1]...
Q1 => FAILED [short read]
Q1 detail: (0 bytes) =>
Asking for UPS status [Q1]...
Q1 => FAILED [short read]
Q1 detail: (0 bytes) =>
Asking for UPS status [Q1]...
Q1 => FAILED [short read]
Q1 detail: (0 bytes) =>
Asking for UPS status [Q1]...
Q1 => FAILED [short read]
Q1 detail: (0 bytes) =>
Signal 2: exiting

http://iki.fi/lindi/usb/mustek2-snoops/svn1160-phoenix.strace

Ok, so normal "Q1\r" commands work but after that "I\r" command the
UPS stops responding to further commands:

USBDEVFS_CONTROL, ... data="F\r\0\0\0\0\0\0"}) = -1 EPROTO (Protocol error)

If I ignore "I\r" and "C\r" in set_data_phoenix


Index: drivers/megatec_usb.c
===================================================================
--- drivers/megatec_usb.c       (revision 1160)
+++ drivers/megatec_usb.c       (working copy)
@@ -347,6 +347,11 @@
 {
        char    buffer[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };

+       if (strcmp(str, "I\r") == 0 || strcmp(str, "C\r") == 0) {
+           /* Ignore */
+           return strlen(str);
+       }
+
        snprintf(buffer, sizeof(buffer), "%s", str);

        return usb->set_report(udev, 0, (unsigned char *)buffer, sizeof(buffer));


nut manages to also get reply to "F\r" command:

...
Asking for UPS power ratings [F]...
get_data_phoenix: got so far [#220.0 0]
get_data_phoenix: (8 bytes) => 23 32 32 30 2e 30 20 30
get_data_phoenix: got so far [#220.0 002 12.00]
get_data_phoenix: (16 bytes) => 23 32 32 30 2e 30 20 30 30 32 20 31 32 2e
30 30
]et_data_phoenix: got so far [#220.0 002 12.00 50.0
get_data_phoenix: (24 bytes) => 23 32 32 30 2e 30 20 30 30 32 20 31 32 2e
30 30 20 35 30 2e 30 0d 00 00
]et_data_phoenix: got so far [#220.0 002 12.00 50.0
get_data_phoenix: (32 bytes) => 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
]et_data_phoenix: got so far [#220.0 002 12.00 50.0
get_data_phoenix: (40 bytes) => 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
]et_data_phoenix: got so far [#220.0 002 12.00 50.0
get_data_phoenix: (48 bytes) => 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
]et_data_phoenix: got so far [#220.0 002 12.00 50.0
get_data_phoenix: (56 bytes) => 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
]et_data_phoenix: got so far [#220.0 002 12.00 50.0
get_data_phoenix: (64 bytes) => 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
F => OK [#220.0 002 12.00 50.0]
12.0V battery, interval [9.7V, 13.7V].
Done setting up the UPS.



best regards,
Timo Lindfors



More information about the Nut-upsdev mailing list