LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-29-2005, 09:58 AM   #1
prell
Member
 
Registered: Jul 2004
Posts: 73

Rep: Reputation: 15
Buffer serial input -- create new device?


I'd like to buffer input from a serial device (/dev/sda1). I could alter my program, but I'm wondering if I can create a special file/device which will buffer that input for me?
 
Old 04-30-2005, 08:46 AM   #2
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
Serial device is like /dev/ttyS0.
/dev/sda1 is scsi hard drive #1, partition #1.
The serial input is buffered in the kernel. Not sure about the size but there is something like 2-4 k bytes buffering.
 
Old 04-30-2005, 09:53 AM   #3
prell
Member
 
Registered: Jul 2004
Posts: 73

Original Poster
Rep: Reputation: 15
Whoops; yeah I meant /dev/ttyS0
 
Old 04-30-2005, 09:54 AM   #4
prell
Member
 
Registered: Jul 2004
Posts: 73

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by randyding
The serial input is buffered in the kernel. Not sure about the size but there is something like 2-4 k bytes buffering.
Are you sure it's buffered? I mean, the way I think of it, I'd want it to wait to give me the data if I'm not currently reading from the device. But it seems like if I'm not reading from the device when the data arrives, I don't ever get it. Maybe that's baloney? Maybe I should test it out again?
 
Old 04-30-2005, 03:52 PM   #5
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
Its buffered for sure, up to some limit. Most serial libraries flush the serial buffer when they open the port. The kernel ISR places all RX data in the buffer, and read() pulls the data from the buffer, read() doesn't read from the port directly. If the port is open, and you don't close it, then you should get the data that arrives since the last time you tried called read().
You can look at my serial library here,

Edit: my website/email is firewalled and only available to Cont. US. If you're outside post a message here and I'll move the files somewhere else.

Last edited by randyding; 03-19-2009 at 10:48 PM. Reason: web site is now gone, removed url
 
  


Reply



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
How to increase the serial transmit buffer size in the Kernel. pwlodarczyk Programming 13 01-21-2009 04:39 PM
capture serial input at startup TomFuchs Linux - General 4 11-23-2005 10:00 AM
how to increase serial receive email buffer size? HZC Programming 0 02-14-2005 10:32 PM
No of bytes in the serial drivers transmit buffer igjesdal Programming 0 10-13-2004 10:58 AM
How to enable frame buffer device? suriyamohan Programming 2 04-03-2003 10:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:24 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration