0
votes

For testing purposes I want to use socat to create virtual serial ports to use in my Python program.

I have limited success, but struggle again and again with the many options in socat. I use this command in Ubuntu Linux:

sudo socat -d -d  pty,b9600,raw,echo=0,link=/dev/ttyS90    pty,b9600,raw,echo=0,link=/dev/ttyS91 

As it should, it creates the virtual ports like /dev/pts/2 and 4, and links them to /dev/ttyS90 and *91. It does not work without sudo (it fails with unable to unlink for the *90, *91 ports, although the regular user is in the dialout group).

enter image description here

But as you see the permissions 'lrwxrwxrwx' look like reading/writing for everybody. However, this is NOT true: I CANNOT use these devices unless I am root. The file manager (=Nemo) gives this result:

enter image description here

The permissions are significantly different. Huh?

After issuing 'sudo chmod 777 /dev/ttyS90' (and same for *91) nothing changes in the terminal output, because it is already, but incorrectly, showing 777 permissions, but the Nemo output changes to

enter image description here

And now I can use the ports as regular user! How comes? Am I doing something wrong?

And one more socat problem: the above socat command gives an 8-bit, no-parity connection, but I really need a 7-bit, even-parity connection. My attempts to implement this by juggling some of the many options all failed. I am lost; any insight?

1

1 Answers

0
votes

Try changing the permission on /dev/pts/2 and /dev/pts/4 instead of on the link