LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Thread Tools
Old 11-06-2009, 05:02 AM   #1
trkecea
LQ Newbie
 
Registered: Nov 2009
Posts: 5
Thanked: 0
How to create pseudo terminal master and slave


[Log in to get rid of this advertisement]
hi frds
I am new to the linux, don't know about pseudo terminal, when am trying to read manual pages about pseduo terminal i understand little bit, I want to create /dev/cdma/ on two terminals like dummy driver for modem and if i will send data from one terminal, that data has to come from another terminal , basically it has to form a pipe between the two terminals can any one of you suggest me clearly
please do favour for me .....
linuxubuntu trkecea is offline     Reply With Quote
Old 11-06-2009, 09:49 AM   #2
hda7
LQ Newbie
 
Registered: May 2009
Distribution: Puppy Linux 4.00
Posts: 14
Thanked: 0
Most modern systems use Unix 98 style pseudo terminals. To open a master terminal and configure the save in C, do something like:

Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define _XOPEN_SOURCE
#include <stdlib.h>

int main(int argc, char **argv) {
  char *slavename;
  int masterfd;

  masterfd = open("/dev/ptmx", O_RDWR);
  grantpt(masterfd);
  unlockpt(masterfd);
  slavename = ptsname(masterfd);
  ...
}
The name of the slave file will be in `slavename' and can be opened with all call to open, like:
Code:
open(slavename, O_RDWR)
If your system does not have a `/dev/ptmx', you probably have BSD style pseudo terminals. See the BSD pseudo terminal section in pty(7).
linux hda7 is offline     Reply With Quote
Old 11-07-2009, 11:55 AM   #3
trkecea
LQ Newbie
 
Registered: Nov 2009
Posts: 5
Thanked: 0

Original Poster
hii
very very thanx for your guidance sir
can any one of you please tell me, can we use AT commands in pseudo terminal and also how ?
please suggest me asap
thanx sir once again for ur help
linuxubuntu trkecea is offline     Reply With Quote
Old 11-08-2009, 05:27 PM   #4
hda7
LQ Newbie
 
Registered: May 2009
Distribution: Puppy Linux 4.00
Posts: 14
Thanked: 0
Pseudo terminals function like a direct connection, so they don't use AT commands.

I'm pretty sure that they will translate certain characters sent from the master into signals sent to the process on the slave, e.g., ^C to SIGINT or ^Z to SIGTSTP. These characters can be set with `stty'.
linux hda7 is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
Master and slave? Siiiiiii Linux - Hardware 4 05-27-2006 04:53 PM
simulating pseudo master-slave terminal sytem kshkid Programming 2 03-27-2006 08:58 AM
slave not authenticating when master is down spyghost Solaris / OpenSolaris 3 10-04-2004 12:12 PM
Slave to Master? s9722 Linux - General 6 02-23-2004 11:34 PM
Slave to Master Question tkman Linux - General 2 11-24-2003 12:37 AM


All times are GMT -5. The time now is 08:33 PM.

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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration