LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 02-08-2012, 08:33 AM   #1
tilman1
Member
 
Registered: Mar 2007
Location: Stuttgart, Germany
Distribution: gentoo
Posts: 54

Rep: Reputation: 15
fluhing tty


Hello

Description:
=============
in reference to another posting of mine "self written usb driver: received data is retransmitted", I discovered that received character are kept in a buffer. There may be a significant delay until a received character is actually dumped on the tty (around 100 characters)

Setup:
=======
I have 2 serial devices connected. On one of them, I am doing a 'cat /dev/ttySx'. On the other device, I am sending data via 'echo "12345" > /dev/ttyUSBy'. After sending bigger amounts of data to the receiving serial device (a couple of 100 characters) at once, I observe a buffering behavior, i.e. characters sent are not immediatly dump onto the receiving terminal. Instead data previously sent and not yet displayed is dumped.

Question:
==========
I wonder how I can tell the tty to flush all data in its receive buffer (preferable via stty) ?

Remark: I am logged in via ssh which means that I am working on pty. Not sure if that makes a difference.

Thanks
Tilman
 
Old 02-08-2012, 11:37 AM   #2
theNbomr
Senior Member
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 4,506

Rep: Reputation: 602Reputation: 602Reputation: 602Reputation: 602Reputation: 602Reputation: 602
Serial ports and devices have considerable underlying configuration that is obscured from ordinary shell commands. For this reason, I consider the shell to be a very clumsy vehicle for performing serial communications. Neverthless, stty implements a shell interface to the termios API to fine tune the behavior of the serial port. I suggest that you study the following online tomes:
Serial-Howto
Serial Programming Howto
Serial Programming Guide for POSIX OS's

From that, you should be able to divine that the VMIN & VTIME settings will probably address your read delay issues. In stty-speak, these seem to correspond to the 'min' and 'time' options.
I'm not sure how to reduce the buffering of output data. Perhaps simply using raw mode will suffice.

--- rod.
 
  


Reply

Tags
tty


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] TTY's not working, switching TTY's does nothing David2010 Linux - Hardware 5 01-17-2012 11:25 PM
can a tty execute command on another tty? BeacoN Linux - Desktop 3 11-08-2008 09:39 AM
I it possible to kill a tty or find which tty is being using by which process? geletine Linux - Software 2 01-15-2006 08:40 AM
change tty => system crashes (ati driver/tty resolution) mosca Debian 6 08-05-2004 07:37 AM


All times are GMT -5. The time now is 07:50 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
Open Source Consulting | Domain Registration