Ser2net: Difference between revisions

From DaqWiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 22: Line 22:
   
   
<pre>
<pre>
3001:raw:600:usb-2-2:9600  -XONXOFF -RTSCTS LOCAL  
localhost,3001:raw:600:usb-2-2:9600  -XONXOFF -RTSCTS LOCAL  
3002:raw:600:usb-2-4:38400 -XONXOFF -RTSCTS LOCAL  
localhost,3002:raw:600:usb-2-4:38400 -XONXOFF -RTSCTS LOCAL  
</pre>
</pre>
   
   
Line 30: Line 30:


you can  copy these names to ser2net.conf.
you can  copy these names to ser2net.conf.
add ser2net entries to hosts.allow:
<pre>
ser2net-control:  127.0.0.1  142.90.101.81  142.90.115.99 142.90.101.136
ser2net: 127.0.0.1  142.90.101.81  142.90.115.99 142.90.101.136
</pre>
   
   
and start ser2net from /etc/rc.local:
and start ser2net from /etc/rc.local:
<pre>
<pre>
/root/ser2net -c /root/ser2net.conf -p 3000 &
/root/ser2net -c /root/ser2net.conf -p localhost,3000 &
</pre>
</pre>
NOTE: latest version of ser2net binds to localhost IP addresses to prevent external access. To enable external access change "localhost,NNNN" to "0.0.0.0,NNNN" and setup firewall rules to restrict access to ser2net ports only to authorized machines.

Latest revision as of 16:39, 28 September 2023

When multiple USB-to-serial adapters are present on a Linux system, it is not obvious which port corresponds to which /dev/ttyUSBnnn device. The mapping of ttyUSBnnn devices depends on the order that devices have been connected and disconnected, may change across system reboots, or when USB devices are re-enumerated after USB hardware errors.

This modification of the ser2net package from http://sourceforge.net/projects/ser2net attempts to solve this problem by specifying serial devices using USB paths instead of /dev/ttyUSBnnn names.

To build the package, get the package sources and run "make" to produce the ser2net executable:

cd $HOME/packages
git clone https://bitbucket.org/ttriumfdaq/ser2net.git
cd ser2net
make
ls -l ser2net

Browse the git repository at https://bitbucket.org/ttriumfdaq/ser2net

Old ladd00 svn instructions: svn checkout https://ladd00.triumf.ca/svn/daqsvn/trunk/ser2net firefox http://ladd00.triumf.ca/viewvc/daqsvn/trunk/ser2net/

An example ser2net.conf file for 2 USB serial ports looks like this:

localhost,3001:raw:600:usb-2-2:9600  -XONXOFF -RTSCTS LOCAL 
localhost,3002:raw:600:usb-2-4:38400 -XONXOFF -RTSCTS LOCAL 


When the program starts it prints the names of all available USB-serial devices,

you can copy these names to ser2net.conf.

and start ser2net from /etc/rc.local:

/root/ser2net -c /root/ser2net.conf -p localhost,3000 &

NOTE: latest version of ser2net binds to localhost IP addresses to prevent external access. To enable external access change "localhost,NNNN" to "0.0.0.0,NNNN" and setup firewall rules to restrict access to ser2net ports only to authorized machines.