Ser2net

From DaqWiki
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:

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.