i am sending data to a display device connected to a serial port. i manage to check for buffer overflow for the device itself by checking for flow control on the display device and thereby throttling writes to it (essentially using sleep). the problem i think i am facing is on the serial port side where the buffer on the serial port is getting overloaded.
i am pasting relevant code here..
open DisplayIO, "+> /dev/cuaa1" # open serial (display) device
or die ("Can't open tty: $!") ;
sub main ()
{
#code to loop &scrollTest several times with a sleep of 1 sec.
+..
}
sub process_keyboard_input ()
{
syswrite DisplayIO, $KeyBoardInput ; # write to display
} # process_keyboard_input
sub scrollTest {
syswrite DisplayIO, sprintf ("%c%c", 0xfe, 0x51);
$KeyBoardInput = sprintf ("%cE%cX%s", 0xfe,0xfe,'HHHHHHHHHHHHH
+HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH')
+;
process_keyboard_input ();
sleep(1);
}
..
The pattern on 'H's fills the display as expected. The issue is that after about 50 loops or so, i get "tty-level buffer overflows" messages continously whenever the next syswrite takes place and eventually the display (or) serial port hangs. i think the issue is with the buffer handling with the serial port. anyone would know how i can set up buffer overflow control so that i dont jam up the serial port? thanks in advance..
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.