Closed dilyanpalauzov closed 2 years ago
Ah, I had to call strace -f
. This is the output of stdbuf -o0 -e0 strace -fs2048 ./inverter_poller -d &>E.txt
:
E.txt
It contains:
[pid 4886] openat(AT_FDCWD, "/dev/hidraw1", O_RDWR|O_NONBLOCK) = 3
[pid 4886] ioctl(3, TCGETS, 0x76b88d78) = -1 EINVAL (Неправилен аргумент)
[pid 4886] ioctl(3, TCGETS, 0x76b88d70) = -1 EINVAL (Неправилен аргумент)
[pid 4886] ioctl(3, SNDCTL_TMR_START or TCSETS, {B2400 -opost -isig -icanon echo ...}) = -1 EINVAL (Неправилен аргумент)
[pid 4886] ioctl(3, TCFLSH, TCOFLUSH) = -1 EINVAL (Неправилен аргумент)
[pid 4886] mmap2(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x76189000
[pid 4886] munmap(0x76189000, 487424) = 0
[pid 4886] munmap(0x76300000, 561152) = 0
[pid 4886] mprotect(0x76200000, 135168, PROT_READ|PROT_WRITE) = 0
[pid 4886] stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2121, ...}) = 0
[pid 4886] openat(AT_FDCWD, "/dev/null", O_WRONLY|O_CREAT|O_APPEND, 0666) = 4
[pid 4886] _llseek(4, 0, [0], SEEK_END) = 0
[pid 4886] fstat64(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x1, 0x3), ...}) = 0
I know that different inverters has some more or less differences in the reply frame. From what I can see the inverter is properly opened, and properly read, because it is outputting the correct frame:
(230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 48.0 44.0 59.5 54.7 2 02 100 0 1 3 9 01 0 1 54.0 0 1 0 00014 000
So it is responding properly for a query. The problem is probably in some different thing, or protocol differences. I know that even the same inverter may respond differently depending on firmware version, not saying about different devices/clones.
I have four tips for you:
git checkout 48826f4
in the project root directory, rebuild and check againThanks for your answer. It was a matter of setting qpiri=102
in inverter.conf.
My /etc/inverter/inverter.conf contains:
device=/dev/hidraw0 run_interval=1 amperage_factor=1.0 watt_factor=1.01
Calling
stdbuf -e0 -o0 strace -s2048 ./inverter_poller -d |&tee e
contains e.txt.As can be seen, inverter_poller does not open the device. As can be seen, the device /dev/hidraw0 is not opened and the output contains
INVERTER: QPIRI: incorrect start/stop bytes. Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 48.0 44.0 59.5 54.7 2 02 100 0 1 3 9 01 0 1 54.0 0 1 0 00014 000
.