perllearner has asked for the wisdom of the Perl Monks concerning the following question:

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..

Replies are listed 'Best First'.
Re: tty-level buffer overflows
by sgifford (Prior) on Jun 22, 2004 at 23:20 UTC
    Perhaps Device::SerialPort would help. It should allow somewhat lower-level access to the specific properties of a serial port.

    You may also be able to use stty(1) to set the serial port's options.