victronenergy / venus

Victron Energy Unix/Linux OS
https://github.com/victronenergy/venus/wiki
577 stars 72 forks source link

USB Serial access #878

Closed ardiehl closed 2 years ago

ardiehl commented 2 years ago

Btw, my device is a Cerbos GX I'm trying to read data from my Pylontech Betteries without success yet.

I have created a lock file for the port (in my case /dev/ttyUSB1), after success it looks like (1032 is /opt/victronenergy/serial-starter/serial-starter.sh and 18152 is my script) this, what looks fine for me: bash-5.0# ll /var/lock/serial-starter/ drwxr-xr-x 2 root root 220 Dec 6 20:49 . drwxr-xr-x 4 root root 120 Dec 4 11:13 .. lrwxrwxrwx 1 root root 4 Dec 4 11:13 ttyS4 -> 1042 lrwxrwxrwx 1 root root 4 Dec 4 11:13 ttyS5 -> 1042 lrwxrwxrwx 1 root root 4 Dec 4 11:13 ttyS6 -> 1042 lrwxrwxrwx 1 root root 4 Dec 4 11:13 ttyS7 -> 1042 lrwxrwxrwx 1 root root 4 Dec 4 14:21 ttyUSB0 -> 1042 lrwxrwxrwx 1 root root 5 Dec 6 19:47 ttyUSB1 -> 18158 lrwxrwxrwx 1 root root 4 Dec 6 20:49 ttyUSB2 -> 1042 lrwxrwxrwx 1 root root 4 Dec 6 20:49 ttyUSB3 -> 1042 lrwxrwxrwx 1 root root 4 Dec 6 20:49 ttyUSB4 -> 1042

However, something reconfigures the locked ttyUSB1, is works fine for some time than someone reconfigures the port and i got communication errors, closing and reinitializing the port fixes it for some time. In my prog, i tried to reopen / reconfigure the port in case of errors and than it works for some time agian. As i have created a lock file, this should not happen. Btw, the same Software running on a Linux Laptop (Fedora 34) works fine. Any idea how could i fix that ?

mpvader commented 2 years ago

Hi Ardiehl,

please have a look here: https://github.com/victronenergy/venus/wiki/howto-add-a-driver-to-Venus#howto-stop-serial-starter-on-a-tty-port.

Make sure to also read above, as well as below that specific chapter I linked to.

For more help, could you go to the Modifications section on community? Its here: https://community.victronenergy.com/spaces/31/mods.html

that is a better place than here in the issue list. Thank you!