Thanks Adam for the scripts !

In order to test serial communication Linux has a great feature where you can create virtual serial ports and connect them to each other.  A serial loopback ! :)

terminalEmulation.sh
#Terminal emulation script by Adam Harris

#create the two linked pseudoterminals
socat -d -d pty,raw,echo=0 pty,raw,echo=0 &

#now create symbolic links to these terminals
sudo ln -s /dev/pts/1 /dev/ttyUSB13
sudo ln -s /dev/pts/2 /dev/ttyUSB14
echo "symbolic links created, see for yourself:"
ls /dev/ttyUSB*

 

#unlink.sh:
#unlinks the symbolic links of the pseudoterminals
echo "unlinking the ttyUSBs..."
sudo unlink /dev/ttyUSB23
sudo unlink /dev/ttyUSB24
echo "done, see: ls /dev/ttyUSB*"
ls /dev/ttyUSB*
echo "killing socat..."
sudo killall socat
echo "done."

 

Here is a Serial session I started using socat and a virtual null modem. In the webgui I can type and send data to the terminal running minicom.  In minicom i can type and data will appear in the webgui - one bug is the double display (I think it might be a display only issue) of the data coming back to the Serial service - it would be nice to have it display in different formats too .  But data is going both ways.

morrows_end

11 years 2 months ago

Did you have to change the code at all to getr comunications from minico to MRL?

So I'm a little confused why it's giving you a hard problem.
I still need to clean up the display.
Is there something else you want me to try ... btw - thanks for your scripts !  I did this once, and then quickly forgot all the details on how to set it up.. Its nice to be able to copy paste from somewhere :)

morrows_end

11 years 2 months ago

In reply to by GroG

I will give it another try. If I have issues, I'll make a screencast showing the behavior. Then maybe you could point out where I went wrong.

 

Thanks for testing it out for me!

morrows_end

11 years 2 months ago

Here's a screencast showing what I did.  Firstly, I modded the scripts slightly so I could specify any two USB numbers to use. It also changes permissions to make it work better.

http://youtu.be/XQExjLNGTY0

The scripts work with arguments such as "
 

./terminal.sh 21 22

Which will create /dev/ttyUSB21 and /dev/ttyUSB22:

#Terminal emulation script by Adam Harris
 
#create the two linked pseudoterminals
socat -d -d pty,raw,echo=0 pty,raw,echo=0 &
 
#now create symbolic links to these terminals
sudo ln -s /dev/pts/1 /dev/ttyUSB$1
sudo ln -s /dev/pts/2 /dev/ttyUSB$2
 
echo""
echo "setting permissions..."
sudo chmod 666 /dev/ttyUSB$1
sudo chmod 666 /dev/ttyUSB$2
 
echo""
echo "symbolic links created, see for yourself:"
ls /dev/ttyUSB*
 
 
Here's the new unlinking code:
#unlinks the symbolic links of the pseudoterminals
echo "unlinking the ttyUSBs..."
 sudo unlink /dev/ttyUSB$1
 sudo unlink /dev/ttyUSB$2
echo "done, see: ls /dev/ttyUSB*"
ls /dev/ttyUSB*
echo "killing socat..."
sudo killall socat
echo "done."
 

 

Thanks for the video - that of course always helps !

I'll look into it closer...  one difference was, I was using the webgui, I'll check out the scripts .. 
should be able to figure it out shortly.