LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-23-2010, 05:44 AM   #1
Semo
LQ Newbie
 
Registered: Jun 2010
Posts: 6

Rep: Reputation: 0
xTerm on pseudo terminal hast no output


Hello,
I hope this is the right forum for my issue.
I'm writing a programm in c++ and want a interactiv way to communicate with it. The program opens a pseudo terminal(pt) in read/write mode and after that it forcs and opens a xTerm instance with the -Sccn option.
After playing around with the ps options like ICANON and ECHO I got a running example in raw mode but then I have to implement the line discipline and the erasing characters an so on on my self.
I don't want to do this :-)
What I want is to get a Xterm/pt connection to my application where only line will be transmitted and signals and erase chars are processed.
At this time. I have following situation:
Turned ICANON on.
My applications sends a couple of chars to the pt-master (ptm). Nothing will be printed on the xTerm.
If I type some chars into the xTerm window, my application receives them. (char after char ... no CR or else) The chars I typed not even printed in the xTerm window.
If nothing is to read the read() funktion returns -1.

Here are the code of the opening and configurating the pt.

Code:
		tty_master_fd = open ("/dev/ptmx", O_RDWR | O_NOCTTY| O_NDELAY); //open Master for pseudo terminal
		grantpt(tty_master_fd);						//necessary for pseudo terminal, grant the new terminal the right of the opening process
		unlockpt(tty_master_fd);					//necessary for pseudo terminal, unlocks the terminal so other programs can read/write to it
		tty_slavename = ptsname(tty_master_fd);		//read path for slave side of the pseudo terminal
 		int tty_slave_fd = open(tty_slavename, O_RDWR | O_NOCTTY | O_NDELAY);	//open slave side of the terminal
...
		struct termios termInfo;						//create new register set
		tcgetattr(tty_slave_fd, &termInfo);
		termInfo.c_lflag &= ~(ECHOPRT);						
		termInfo.c_lflag |= (ICANON | ECHO | ECHOE | ECHOKE | ECHONL | CLOCAL );
		termInfo.c_oflag |= ONLRET;						//transform new line characters to carriage return

		tcsetattr( tty_slave_fd, TCSANOW, &termInfo );	//set changes to the control registers now
		tcsetattr(tty_master_fd, TCSANOW, &termInfo );	// don't know whitch side of the pt  I have to control
...
		int terminal= fork();
		if(terminal==0)
		{
			//cout<<args<<endl;	//for debug
			termPID = execvp("xterm",arg);	//start the xterm
		}
I hope somebody can give me a hint where my error is.
 
Old 06-24-2010, 05:07 AM   #2
Semo
LQ Newbie
 
Registered: Jun 2010
Posts: 6

Original Poster
Rep: Reputation: 0
push !
More than 70 views and not one idea... kind of depressing :-(
This cant be as hard as it looks.

hmmpf .... continue searching for an answer....
 
Old 06-24-2010, 12:17 PM   #3
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,086

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
are you writing using the ncurses api?
 
Old 06-25-2010, 03:09 AM   #4
Semo
LQ Newbie
 
Registered: Jun 2010
Posts: 6

Original Poster
Rep: Reputation: 0
No I don't use ncurses and I wont use it because its like breaking a nut with a sledgehammer. I read, that the most people use the raw mode but I can't find an example or anything about the use of the canonical mode. This feature is like a unloved child. Hard to figure out why.
 
Old 06-30-2010, 10:29 AM   #5
Semo
LQ Newbie
 
Registered: Jun 2010
Posts: 6

Original Poster
Rep: Reputation: 0
another push!
Since I'm searching for a solution I think nobody ever uses this feature. I hope somebody has any idea. But I guess nobody has....

:-(
 
  


Reply

Tags
c++, pseudo, pts, terminal, xterm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pseudo terminal problem ghostwhowalks Programming 3 01-13-2010 10:44 PM
font in pseudo terminal crs_zxf Linux - Newbie 7 07-26-2009 08:38 PM
Error opening terminal: xterm Terminal type "xterm" unknown Pscylo Slackware 10 04-17-2009 06:33 AM
Pseudo-Terminal means? Marty21 Linux - Software 1 01-28-2009 02:53 PM
Pseudo Terminal Problems ailiez Programming 2 02-09-2004 01:58 AM


All times are GMT -5. The time now is 11:49 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration