Ser2net

From DaqWiki
Revision as of 14:45, 6 June 2017 by Olchansk (talk | contribs)
Jump to navigation Jump to search

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:

3001:raw:600:usb-2-2:9600  -XONXOFF -RTSCTS LOCAL 
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.


add ser2net entries to hosts.allow:

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 

and start ser2net from /etc/rc.local:

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