Mario Lobo
2015-Aug-23 22:26 UTC
[Nut-upsuser] APC BACK UPS 2200 model BZ2200BI-BR (update)
On Sun, 23 Aug 2015 11:09:03 -0400 Charles Lepple <clepple at gmail.com> wrote:> On Aug 21, 2015, at 10:10 AM, Mario Lobo <mlobo at digiart.art.br> wrote: > > > >> Not sure what to look for yet. It might be easier to add in the > >> debug calls to the source code-- can you try building NUT from > >> source? If you installed via the ports tree (as opposed to binary > >> packages), you should have most of the dependencies installed. You > >> might also need libtool and autoconf, as mentioned in the second > >> link below: > >> > >> http://www.networkupstools.org/docs/developer-guide.chunked/ar01s03.html#_source_code_management > >> and > >> http://www.networkupstools.org/docs/developer-guide.chunked/ar01s03.html#building > >> > > > > Yes I did build it through ports. I try to build a debug version of > > it. > > Mario, > > I added a few debug statements throughout the solis driver: > > https://github.com/networkupstools/nut/tree/solis_debug > > If you run into trouble with the initial build, there will be a > tarball snapshot here shortly that bypasses some of the > autoconf/libtool issues (look for the nut-* link under step 5): > > http://buildbot.networkupstools.org/public/nut/builders/Debian-x64-gcc/builds/389 >Here is what I got from running the just-compiled nut-2.7.3.1.tar.gz: [~]>/usr/local/libexec/nut/solis -a lobos -u root -D -D -D Network UPS Tools - Microsol Solis UPS driver 0.63 (2.7.3.1) 0.000000 debug level is '3' 0.001946 getbaseinfo: sending CMD_UPSCONT and ENDCHAR to sync 0.002111 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 0.963327 getbaseinfo: received 25 bytes from ser_get_buf_len() 0.963360 CommReceive: RecPack: (25 bytes) => 00 17 91 49 5e 5e bc fe bb 46 88 ac 1b 0.963375 0a a0 ed 01 07 07 bb 46 82 ae 1b 09 0.963387 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 2.048306 getbaseinfo: received 25 bytes from ser_get_buf_len() 2.048343 CommReceive: RecPack: (25 bytes) => a0 04 02 06 1d 0d 03 00 00 00 01 00 17 2.048358 91 49 5e 5e dc fe bb 47 83 ad 1a 09 2.048371 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 3.132287 getbaseinfo: received 25 bytes from ser_get_buf_len() 3.132321 CommReceive: RecPack: (25 bytes) => a0 0a 02 07 1d 0d 03 00 00 00 01 00 17 3.132337 91 49 5e 5e e3 fe bb 46 88 ac 1a 0a 3.132350 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 4.217261 getbaseinfo: received 25 bytes from ser_get_buf_len() 4.217294 CommReceive: RecPack: (25 bytes) => a0 f4 01 08 1d 0d 03 00 00 00 01 00 17 4.217309 91 49 5e 5e d1 fe bb 46 88 ad 02 0b 4.217322 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 5.302236 getbaseinfo: received 25 bytes from ser_get_buf_len() 5.302268 CommReceive: RecPack: (25 bytes) => a0 0b 02 09 1d 0d 03 00 00 00 01 00 17 5.302283 91 49 5e 5e d4 fe bb 46 88 ad 1e 0a 5.302296 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 6.386210 getbaseinfo: received 25 bytes from ser_get_buf_len() 6.386241 CommReceive: RecPack: (25 bytes) => a0 1b 02 0a 1d 0d 03 00 00 00 01 00 17 6.386256 91 49 5e 5e 00 fe bb 46 88 ad 1d 0a 6.386269 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 7.471190 getbaseinfo: received 25 bytes from ser_get_buf_len() 7.471222 CommReceive: RecPack: (25 bytes) => a0 f6 01 0b 1d 0d 03 00 00 00 01 00 17 7.471236 91 49 5e 5e da fe bb 47 83 ac 1a 09 7.471249 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 8.557168 getbaseinfo: received 25 bytes from ser_get_buf_len() 8.557200 CommReceive: RecPack: (25 bytes) => a0 f4 01 0c 1d 0d 03 00 00 00 01 00 17 8.557215 91 49 5e 5e d0 fe bb 46 88 ad 1e 0a 8.557241 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 9.642144 getbaseinfo: received 25 bytes from ser_get_buf_len() 9.642177 CommReceive: RecPack: (25 bytes) => 0d 02 0d 1d 0d 03 00 00 00 01 00 17 91 9.642192 49 5e 5e f5 fe bb 47 83 ad 02 09 a0 9.642209 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 10.727265 getbaseinfo: received 25 bytes from ser_get_buf_len() 10.727293 CommReceive: RecPack: (25 bytes) => 02 0e 1d 0d 03 00 00 00 01 00 17 91 49 10.727303 5e 5e d9 fe bb 46 88 ac 1e 0b a0 1d 10.727313 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 11.811101 getbaseinfo: received 25 bytes from ser_get_buf_len() 11.811136 CommReceive: RecPack: (25 bytes) => 02 0f 1d 0d 03 00 00 00 01 00 17 91 49 11.811151 5e 5e 07 fe bb 47 88 ac 1c 0a a0 04 11.811164 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 12.896076 getbaseinfo: received 25 bytes from ser_get_buf_len() 12.896112 CommReceive: RecPack: (25 bytes) => 02 10 1d 0d 03 00 00 00 01 00 17 91 49 12.896127 5e 5e ed fe bb 46 88 ac 19 0a a0 07 12.896140 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 13.981054 getbaseinfo: received 25 bytes from ser_get_buf_len() 13.981087 CommReceive: RecPack: (25 bytes) => 02 11 1d 0d 03 00 00 00 01 00 17 91 49 13.981102 5e 5e ed fe bb 47 88 ad 23 0c a0 4c 13.981115 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 15.065032 getbaseinfo: received 25 bytes from ser_get_buf_len() 15.065066 CommReceive: RecPack: (25 bytes) => 02 12 1d 0d 03 00 00 00 01 00 17 91 49 15.065081 5e 5e 41 fe bb 46 83 ae 02 0a a0 1b 15.065093 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 16.150009 getbaseinfo: received 25 bytes from ser_get_buf_len() 16.150044 CommReceive: RecPack: (25 bytes) => 02 13 1d 0d 03 00 00 00 01 00 17 91 49 16.150059 5e 5e e9 fe bb 46 88 ad 1d 0a a0 f8 16.150072 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 17.235986 getbaseinfo: received 25 bytes from ser_get_buf_len() 17.236019 CommReceive: RecPack: (25 bytes) => 01 14 1d 0d 03 00 00 00 01 00 17 91 49 17.236033 5e 5e e5 fe bb 46 88 ae 1a 0a a0 ef 17.236050 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 18.320960 getbaseinfo: received 25 bytes from ser_get_buf_len() 18.320995 CommReceive: RecPack: (25 bytes) => 15 1d 0d 03 00 00 00 01 00 17 91 49 5e 18.321009 5e db fe bb 46 88 ad 1b 0a a0 f2 01 18.321026 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 19.405941 getbaseinfo: received 25 bytes from ser_get_buf_len() 19.405975 CommReceive: RecPack: (25 bytes) => 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e 19.405990 df fe bb 47 88 ad 1a 0a a0 f8 01 17 19.406003 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 20.489919 getbaseinfo: received 25 bytes from ser_get_buf_len() 20.489953 CommReceive: RecPack: (25 bytes) => 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e 20.489968 e6 fe bb 46 83 ad 02 0a a0 e3 01 18 20.489981 getbaseinfo: requesting 25 bytes from ser_get_buf_len() 21.574893 getbaseinfo: received 25 bytes from ser_get_buf_len() 21.574925 CommReceive: RecPack: (25 bytes) => 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e 21.574940 b4 fe bb 47 88 ad 1d 0a a0 0f 02 19 21.574953 Solis not detected! aborting ... I hope it helps!. -- Mario Lobo http://www.mallavoodoo.com.br FreeBSD since 2.2.8 [not Pro-Audio.... YET!!] "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things."
Charles Lepple
2015-Aug-25 02:29 UTC
[Nut-upsuser] APC BACK UPS 2200 model BZ2200BI-BR (update)
On Aug 23, 2015, at 6:26 PM, Mario Lobo <mlobo at digiart.art.br> wrote:> > I hope it helps!It is a bit easier to read than the ktrace output. Here are the bytes received, without the other messages: Network UPS Tools - Microsol Solis UPS driver 0.63 (2.7.3.1) CommReceive: RecPack: (25 bytes) => 00 17 91 49 5e 5e bc fe bb 46 88 ac 1b 0a a0 ed 01 07 07 bb 46 82 ae 1b 09 CommReceive: RecPack: (25 bytes) => a0 04 02 06 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e dc fe bb 47 83 ad 1a 09 CommReceive: RecPack: (25 bytes) => a0 0a 02 07 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e e3 fe bb 46 88 ac 1a 0a CommReceive: RecPack: (25 bytes) => a0 f4 01 08 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e d1 fe bb 46 88 ad 02 0b CommReceive: RecPack: (25 bytes) => a0 0b 02 09 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e d4 fe bb 46 88 ad 1e 0a CommReceive: RecPack: (25 bytes) => a0 1b 02 0a 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e 00 fe bb 46 88 ad 1d 0a CommReceive: RecPack: (25 bytes) => a0 f6 01 0b 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e da fe bb 47 83 ac 1a 09 CommReceive: RecPack: (25 bytes) => a0 f4 01 0c 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e d0 fe bb 46 88 ad 1e 0a CommReceive: RecPack: (25 bytes) => 0d 02 0d 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e f5 fe bb 47 83 ad 02 09 a0 CommReceive: RecPack: (25 bytes) => 02 0e 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e d9 fe bb 46 88 ac 1e 0b a0 1d CommReceive: RecPack: (25 bytes) => 02 0f 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e 07 fe bb 47 88 ac 1c 0a a0 04 CommReceive: RecPack: (25 bytes) => 02 10 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e ed fe bb 46 88 ac 19 0a a0 07 CommReceive: RecPack: (25 bytes) => 02 11 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e ed fe bb 47 88 ad 23 0c a0 4c CommReceive: RecPack: (25 bytes) => 02 12 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e 41 fe bb 46 83 ae 02 0a a0 1b CommReceive: RecPack: (25 bytes) => 02 13 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e e9 fe bb 46 88 ad 1d 0a a0 f8 CommReceive: RecPack: (25 bytes) => 01 14 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e e5 fe bb 46 88 ae 1a 0a a0 ef CommReceive: RecPack: (25 bytes) => 15 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e db fe bb 46 88 ad 1b 0a a0 f2 01 CommReceive: RecPack: (25 bytes) => 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e df fe bb 47 88 ad 1a 0a a0 f8 01 17 CommReceive: RecPack: (25 bytes) => 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e e6 fe bb 46 83 ad 02 0a a0 e3 01 18 CommReceive: RecPack: (25 bytes) => 1d 0d 03 00 00 00 01 00 17 91 49 5e 5e b4 fe bb 47 88 ad 1d 0a a0 0f 02 19 Solis not detected! aborting ... I highlighted the final character (0xfe/254). It seems as though the code expects the serial stream to always put the 0xfe character at the end of the buffer, but as you can see, that is not the case in the debug output. (The code loops twenty times, so it is not impossible for it to sync: this may be what happened when you ran the driver in gdb.) We could modify the code to re-sync with the start character, but what concerns me is that a byte gets dropped occasionally. If you run "stty -f /dev/cuaU0 raw", then run the driver with the same debug flags, do you get the same sort of output, where the "fe" character moves left? You might also try unplugging the USB cable, then running the driver immediately after plugging it in again (maybe there is a buffer filling up - that happened a number of years ago on another USB interface on FreeBSD). -- Charles Lepple clepple at gmail -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20150824/9b1191f3/attachment.html>
Charles Lepple
2015-Aug-26 01:59 UTC
[Nut-upsuser] APC BACK UPS 2200 model BZ2200BI-BR (update)
Turns out another user reported the same issue with a slightly different model: https://github.com/networkupstools/nut/issues/231 <https://github.com/networkupstools/nut/issues/231> The "stty -f /dev/cuaU0 raw" trick should help, but I am confused as to why FreeBSD has different "raw" settings than what is set up at the same time as the baud rate: https://github.com/networkupstools/nut/blob/master/drivers/serial.c#L163 <https://github.com/networkupstools/nut/blob/master/drivers/serial.c#L163> Before running "stty raw", can you please send the output of "stty -a -f /dev/cuaU0"? -- Charles Lepple clepple at gmail -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20150825/83f2274b/attachment.html>