After weeks of research and nothing useful coming up I have to ask this:
Is it possible to send serial signals received on a Linux machine over Ethernet to one or more Linux machine serial port?
This is the setup: One device sends serial signals, one or more computers listen on their serial port for those signals (one way comm), in remote locations. I was looking for old computers with serial ports, running Linux, one for the sender and others for the receivers connected in a VPN, using serial-serial cable connection with clients. I do not want to use virtual ports because the computer(s) listening for serial signals can not be connected to the internet.
Can sound crazy...
Related
I need to write a program (C++) that uses a serial port to communicate with another device. The other device isn't even built yet so I need a software emulator For various reasons there is no point going into here, the software emulator needs to run on a different machine. I would like to send the data via UDP from the software emulator to the machine my program is running on and have it received by another serial interface type program that in some way acts as a serial port (serial tty device).
I also want to test my program in an automated fashion in a VM. Ideally my test program would also use UDP and would use the same UDP-serial interface program to forward the data back and forwards between my test program and the program under test.
Time is very tight. I don't really have time to learn to write and install kernel level device drivers.
I would be very grateful for any pointers as to how I can create some sort of "pipe" or "loopback" pseudo-serial device.
I am working on Linux.
Credit to meuh for his tip-off.
socat UDP:127.0.0.1:5001,bind=127.0.0.1:5000 \
PTY,link=/dev/ttyS0,raw,echo=0,waitslave
This listens on UDP port 5000 on the loopback network interface. All data received is sent to the virtual serial device at /dev/ttyS0. All data received on the virtual serial device is sent to UDP address 127.0.0.1:5001.
The IP address can be remote.
The command must be run as root, as must the process connecting to the serial port. To avoid this use a different file path, e.g. /tmp/ttyS99.
Apparently the file path specified must not already exist. However my PC has /dev/ttyS0 all the way to /dev/ttyS31 despite not having any serial ports, and using /dev/ttyS0 works fine. I suppose if I actually had a real serial port this wouldn't work.
I want to know whether Linux kernel device driver of serial port device, e.g. /dev/tty1, /dev/tty2, support poll() operation?
Or tell me where is the kernel source code of serial port device?
In my case, some sensors will send data to ARM CPU via serial port each second. And I think one way is to use a timer for periodically read from the serial port. Another way should use poll(), read it when data is ready.
Unless your serial port is a special case, using poll() or select() would seamlessly work.
If your serial port was controlled via USB, you would have to take care about what happens if the USB to serial is disconnected, but this does not seem to be the case for you.
I was tasked to do a serial port related software and I'm trying to do some initial preparations. I'm using windows 7.
My laptop physically only has USB ports (besides the screen), is it possible to check serial ports like this at all? Will any cable adapters help?
Windows 7 device manager shows nothing is connected to serial ports, which makes sense. However I've written a small application (in node.js) to list the connected serial ports. It lists COM3 as a connected port (though no information on manufacturer or any id). Is there an explanation to this?
To software, a USB-to-RS232 adapter is no different than any other RS232 serial port. It will show up on COM1 or whatever just like a physical port would.
If you have a serial port showing up on your system on COM3, then something is there. It isn't uncommon for RS232 ports to be on the motherboard, but not be exposed externally. Also, if your laptop has a dial-up modem, then this would be on the COM port as well. If you have a cellular radio, these are often on COM ports.
There is an application which wirtes to a serial connection and reads from a serial connection. I am testing it and can not change it. My test environment contains two computers and applications on that two computers send something to each other over the serial connection. I want to create a pseudo serial connection in order to test on only one computer. So that, one application will write to that pseudo serial connection and the other one, which is on the same computer, will read it.
Is such a pseudo serial connection possible? My test computer has only one serial connection but if it is required I can use a virtual machine which has got two serial connections.
i found this com0com. http://sourceforge.net/projects/com0com/files/com0com/3.0.0.0/
It will create two virtual serial ports. You can test it by using two Putty windows. Just chose different COM port.
Let me know if it was helpful.
You could use USB-to-RS232 adapters to get additional COM ports. Hook your two COM ports together with a null modem cable. Then your test program can open one port and talk to your app under test.
Well, there are two pc's connected via Wi-Fi and one of those (let's call it A) has a serial port printer (in ttys0) and a measure serial port device (in ttys1) connected too. So B needs to read some values from the mesure device connected on A and then write to the printer connected on A using a network connection.
ser2net is a good solution for this
aptitude install ser2net
Then edit the config in /etc/ser2net.conf
You can then make a tcp connection to a defined port and be connected to the serial port on the remote computer - very useful.
I don't know if Ubuntu has anything built-in, but you could run a couple of daemons using netcat. Of course, if you want it to be secure, you'd need to do a little more work.