Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm currently working on a project for university that requires communication, via an RS232 link between a piece of hardware (I have designed and am currently testing) and some software(which need testing).
I was hoping to have my hardware finished by now so I could get on with testing the software over Easter.
The hardware does not work yet but I would still like to test the software.
Does any one know if there a way to make a virtual serial port that I could put data on and read data off while my program accesses it as a regular serial port so I can check my code?
I am using Ubuntu 9.10 and am happy to give any more information on request.
PS: I'm sorry if this is in the wrong place I did not know what this type of question came under so I put it in genral
I'm currently working on a project for university that requires communication, via an RS232 link between a piece of hardware (I have designed and am currently testing) and some software(which need testing).
I was hoping to have my hardware finished by now so I could get on with testing the software over Easter.
The hardware does not work yet but I would still like to test the software.
Does any one know if there a way to make a virtual serial port that I could put data on and read data off while my program accesses it as a regular serial port so I can check my code?
I am using Ubuntu 9.10 and am happy to give any more information on request.
PS: I'm sorry if this is in the wrong place I did not know what this type of question came under so I put it in genral
Offhand, no, but I'm sure there's a way to do it. However, if I had to test a serial device, I'd grab a cheap USB to Serial converter, and jump pins 2&3 together, to create a loopback. Your software should then be able to transmit/receive....
I had thought about using a loop back but the data I wish to simulate coming in is not the same as that going out. I suppose I could get two serial ports and connect RX of one to TX of the other and vice versa.
Would still be nice if I could do it with a virtual port.
I had thought about using a loop back but the data I wish to simulate coming in is not the same as that going out. I suppose I could get two serial ports and connect RX of one to TX of the other and vice versa.
Would still be nice if I could do it with a virtual port.
Very, but the time spent in getting that going, would be much more than plugging in a USB device. Thought about the different data thing after I posted...you could always get two, and a null-modem adapter, and connect it to another PC, running a terminal emulator. That way, you could see the data you're sending come up on the screen, and type in data to go BACK to your program.
I think part of the answer lies in how you intend to create a simulation of the device, and whether the objective is to test the communication channel itself, or to test the 'conversation', the data exchange irrespective of the serial interface. If the latter, you can probably create a useful and simple to deploy simulation by exchanging data through pipes or message queues. A process simulating the device reads and writes data in real time, responding to queries from the project software. If the communications itself is the object of the test, then a second serial port driven by the simulation code seems like a good approach. Simply using a loopback on a single port doesn't sound like it will work, since it is still a single port, which only a single process can open and use.
How you craft your simulator might make as much of a project as the original project. Usually devices do something that relates to real-world events and circumstances, and modeling these is the subject of a lot of science.
--- rod
Any way this seems to be more complex and time consuming than I thought so I have decided to modify the code so it writes to a file (I have called serverTX) and reads from another (serverRX) the simulated device reads writes to the opposite files.
I think this should show the logic of my project which is what needs to be done (I only have to demonstrate the validity of my idea)
ttypatch use legacy ptys (bsd style), disabled for security questions in new kernels. You can recompile the kernel with this option enabled and the ttypatch will work.
Other option is use the ptys UNIX_98 style, supported in new kernels.
The code below simulate an serial data connection without control handshake using pty UNIX_98 style, this code work to connect two gtkterm, replacing ttypatch for my tests.
This s regarding my project
I am trying to send data over wifi using socket.
I am working Ubuntu.
The data to be sent is received from a device over serial port.
I want to create a virtual serial
port which will read data from a file and present it in way serial port will present for a given baud rate.
I got same error and also we while running auto testtty.c
the error is couldnt open ttyp0
Also i checked /de there is no file called ptyp0 then how can it open(there is file named ptmx,i think its pseudo terminal)
So can u please tell how to recomplile with kernel permission changed or what should be make file.
This is what make file i have.
[/quote]# Makefile for ttypatch-1.0
# Copyright (c) Daniel G. Clemmensen. Licensed under the GPL.
#
# trivial makefile, generated manually. Needs to be replaced by full-up
# autoocnf/automake system. We simply make ttypatch and testty.
# This will probably work on most Linux distros, but that's all
#
all: ttypatch testty autotesttty
ttypatch: ttypatch.c
gcc -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_UNISTD_H=1 -DRETSIGTYPE=void -DHAVE_SELECT=1 -DHAVE_STRERROR=1 -I. -I. -g -O2 ttypatch.c -o ttypatch
This s regarding my project
I am trying to send data over wifi using socket.
I am working Ubuntu.
The data to be sent is received from a device over serial port.
I want to create a virtual serial
port which will read data from a file and present it in way serial port will present for a given baud rate.
I got same error and also we while running auto testtty.c
the error is couldnt open ttyp0
Also i checked /de there is no file called ptyp0 then how can it open(there is file named ptmx,i think its pseudo terminal)
So can u please tell how to recomplile with kernel permission changed or what should be make file.
This is what make file i have.
Also can u please tell me how i can open a ttyp0 slave in other user program and read data from it.
Open your own thread for your own question, please, and spell out your words. Don't tack yours onto the bottom of someone elses. And if you read the above thread, you'd see code that lets you work with a virtual serial port.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.