[GLLUG] Reading USB serial port broken
henrik at morsing.cc
Fri Sep 20 13:40:54 UTC 2019
On Fri, Sep 20, 2019 at 01:23:44PM +0100, Adrian McMenamin via GLLUG wrote:
>Did permissions change on your script or on the python exec on an update?
>Sorry, just a guess but if an ordinary user can see what's crossing the
>port but your code can't that would seem like something to check.
Munin runs as root:
root 1386 0.0 0.0 24212 3560 ? Ss Aug31 1:26 /usr/bin/perl -wT /usr/sbin/munin-node
Device is set as per recommendation:
root at albert:/dev# ls -l ttyACM0
crw-rw---- 1 root dialout 166, 0 Sep 20 14:32 ttyACM0
Python script as follows:
root at albert:/dev# ls -l /etc/munin/plugins/mvhr_temp
lrwxrwxrwx 1 root root 41 Dec 23 2018 /etc/munin/plugins/mvhr_temp -> /usr/local/munin/lib/plugins/mvhr_temp.py
root at albert:/dev# ls -l /usr/local/munin/lib/plugins/mvhr_temp.py
-rwxr-xr-x 1 root staff 1085 Sep 20 11:51 /usr/local/munin/lib/plugins/mvhr_temp.py
root at albert:/dev# ls -l $(which python2.7)
-rwxr-xr-x 1 root root 3685224 Apr 6 02:42 /usr/bin/python2.7
I run tail as root, haven't tried anything else. And the python/munin module can open the device, it just gets no output unless tail reads it as well.
TBH, Arduinos reboot when something opens the port, and that is how my Arduino code works.
I think the problem is not so much that python/munin can't read the output but that the Arduino doesn't output anything because it no longer gets the signal to reset when python opens it.
More information about the GLLUG