Serial ports, USB-Serial adapters, and Linux
I have a tool that communicates with a robot via serial. My eventual goal is to build a man-in-the-middle box for the serial communication line, so that I can listen to the transmitted serial messages and modify them if desired, and then transmit them on. A small amount of latency introduced is not a problem. Can I do this with, say, a PC running Linux, and Perl? Is there a better way?
As a proof of concept, I figured I could use my laptop and two USB-to-Serial adapters. As a first step, I plugged both serial adapters in, and connected them to each other through a null modem. Now what? I figured I could just Code:
cat /dev/ttyX Code:
echo "blarg" >> /dev/ttyY Once upon a time, I had a perl script to communicated with a piece of lab equipment, and all I did was Code:
open(MEOUT, ">>/dev/ttyUSB0"); Even though I plugged two serial adapters in, there is only the one /dev/ttyUSB0 when they are both plugged in. Code:
chaz@singularity:~$ ls /dev/tty* |
I've discovered that while both USB-to-Serial adapters show up in lsusb, only one of them results in the creation of a /dev/ttyUSB* file. Any ideas on why the other one does not? Is it faulty?
Blue adapter: Code:
chaz@singularity:~$ lsusb Code:
chaz@singularity:~$ ls /dev/*tty* black adapter: Code:
chaz@singularity:~$ lsusb Code:
chaz@singularity:~$ ls /dev/*tty* |
Quote:
|
It was one of those Open-box discounted items at Fry's. I bet someone switched devices in the package.
|
All times are GMT -5. The time now is 05:41 AM. |