CentOS 7.6.1810
I have 4 programs that communicate via RS232 serial to remote devices. The programs run fine from the console and establish good serial comms.
I need to auto start these programs as this is an embedded controller. I added each program as a service to systemd.
After boot, each process is running, however there are no comms.
Each program is attached to the correct port: ttyS4 to ttyS7 seen from ls -l /proc/PID/fd.
Checking stty -F /dev/ttyS4 to 7 indicates the ports are set to 115200 baud.
The programs set the speeds to 19200, 38400, 9600 & 9600 on start up. I can kill each process and restart from the console the baud rates are set correctly and comms are good.
How do I get the serial ports to operate without logging on?
Thanks
Serial communications
Re: Serial communications
Which user are you running systemd service under?
You need to add that user to ether dialout or tty group (check the owner of those ports).
Where ServiceUser is the user that you are running your service as.
You need to add that user to ether dialout or tty group (check the owner of those ports).
Code: Select all
gpasswd -a ServiceUser dialout
Code: Select all
[Service]
User=ServiceUser
Group=ServiceUser
Type=simple
...