LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Virtual Null Modem or pseudo terminal b2b connection (http://www.linuxquestions.org/questions/linux-newbie-8/virtual-null-modem-or-pseudo-terminal-b2b-connection-707034/)

Dumb.Coder 02-24-2009 02:08 AM

Virtual Null Modem or pseudo terminal b2b connection
 
Hi,

I am trying to write 2 applications in C# (MONO) which communicate over serial port. For debugging purposes, I need back to back serial port connection simulator. On windows box I have used com0com, which basically creates pairs of virtual COM ports, each of which is virtually connected back 2 back (Rx of one is Tx of other and vice versa). I don't need other properties of serial port(RS232) e.g. DTE/DTR, CTS/RTS etc etc. All I need is to be able set Baud-Rate, Data-Bits, Parity-Bit to 9600,N,8,1 (It may or may not change the communication parameters, it is of no concern, I just need to be able to set them, so that the same code can work on actual serial ports).

I have googled for this, searched forums also and it seems that pseudo terminals can be used for this. But as I am quite new to Linux world and have just started 10-12 days back :D, I will need some help from you people.

Can you please help me in setting up pseudo terminal connections or let me know if some other technique exists, which can be helpful in my case. I am using OpenSUSE 11.1 and have a laptop with no serial port :(. Also using a USB-serial converter is not possible for me.

TIA,
Dumb.Coder

brianmcgee 02-24-2009 03:32 AM

Maybe this tutorial is of use for you:

http://darebux.blogspot.com/2007/12/...rial-port.html

Dumb.Coder 02-24-2009 06:34 AM

Hi Brian,

I tried installing the VSPD in my OpenSUSE 11.1 box. First it was failing to compile saying, it could not found /usr/src/linux-2.6.27.7-9-pae, so i created a symbolic link to the directory /usr/src/linux-2.6.27-9. After that here is the output from running install.sh from vspd extracted directory...

OpenSUSE11:/usr/local/vspd-1.39-dist # ./install.sh /usr/local/vspd/
installing to /usr/local/vspd/
creating cache ./config.cache
checking for target KERNEL... ok
checking for target KERNEL name... linux
checking for target KERNEL version... 2.6.27.7-9-pae
checking for target KERNEL subversion... 2.6
checking for target KERNEL path... /usr/src/linux-2.6.27.7-9-pae
checking for target MAKE_ARGS... make "-C /usr/src/linux-2.6.27.7-9-pae SUBDIRS=$PWD modules"
checking for DEVFS... checking for UDEV... ok
********************* checking for required programms ******************
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for install... /usr/bin/install
checking for cp... /bin/cp
****************** checking for required header files ******************
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for ctype.h... yes
*********************** checking for functions *************************
checking for strerror... yes
************************ current settings ******************************
CC: gcc
CXX version: gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CXXFLAGS:
EXTRA_DEFINES:
EXTRA_SOURCES:
Using kernel: linux
Using kernel version: 2.6.27.7-9-pae
Using kernel subversion: 2.6
********************** making config.h and Makefile ********************
updating cache ./config.cache
creating ./config.status
creating lib/src/_makewrapper
creating lib/src/Makefile
creating lib/src/linux/Makefile-2.6
creating ./bin/vspd.sh
creating ./bin/vspm.sh
creating ./etc/vspd.conf
compiling the vspm kernel module ...
make: Entering directory `/usr/src/linux-2.6.27.7-9'

WARNING: Symbol version dump /usr/src/linux-2.6.27.7-9/Module.symvers
is missing; modules will have no dependencies and modversions.

CC [M] /usr/local/vspd-1.39-dist/lib/src/vspm.o
In file included from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /usr/local/vspd-1.39-dist/lib/src/sysheaders.h:13,
from /usr/local/vspd-1.39-dist/lib/src/vspm.c:1:
include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory
include/linux/mmzone.h:197:5: warning: "MAX_NR_ZONES" is not defined
In file included from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /usr/local/vspd-1.39-dist/lib/src/sysheaders.h:13,
from /usr/local/vspd-1.39-dist/lib/src/vspm.c:1:
include/linux/mmzone.h:221: error: ‘MAX_NR_ZONES’ undeclared here (not in a function)
In file included from /usr/local/vspd-1.39-dist/lib/src/vspm.c:4:
/usr/local/vspd-1.39-dist/lib/src/vspm.h: In function ‘vsp_unregister’:
/usr/local/vspd-1.39-dist/lib/src/vspm.h:279: warning: overflow in implicit constant conversion
/usr/local/vspd-1.39-dist/lib/src/vspm.h: In function ‘vsp_register’:
/usr/local/vspd-1.39-dist/lib/src/vspm.h:292: warning: overflow in implicit constant conversion
/usr/local/vspd-1.39-dist/lib/src/vspm.h: In function ‘vsp_register_dev’:
/usr/local/vspd-1.39-dist/lib/src/vspm.h:414: warning: overflow in implicit constant conversion
make[1]: *** [/usr/local/vspd-1.39-dist/lib/src/vspm.o] Error 1
make: *** [_module_/usr/local/vspd-1.39-dist/lib/src] Error 2
make: Leaving directory `/usr/src/linux-2.6.27.7-9'
compilation failed, please see ./README for details

--------------------------

Please help me further to compile and install the VSPD drivers.

TIA,
Dumb.Coder

-------------------
Quote:

Originally Posted by brianmcgee (Post 3455338)
Maybe this tutorial is of use for you:

http://darebux.blogspot.com/2007/12/...rial-port.html


Dumb.Coder 03-04-2009 04:14 AM

Hi,

Even after all kind of gymnastics, I was unable to install a virtual null modem on Linux :( . Anyways, here virtual machine came to the rescue :D. Here are the steps in case somebody else needs the same thing.

1. I installed com0com virtual null modem drivers on my windows box.
2. Installed Linux in virtual machine (VMWare).
3. In hardware configuration for guest OS, I mapped one of the serial port from the pair of virtual null modem to /dev/ttyS0.
4. Now, I can use /dev/ttyS0 in my linux vm, and at other end (on windows host) I can run my hw simulator application.


Hope this helps anybody needing the same thing.

Regards,
Dumb.Coder

eeffrr 09-13-2010 01:55 AM

I've got some problems about pseudo terminal b2b connection too.


All times are GMT -5. The time now is 08:59 AM.