I've written a little keyboard to UART script as a first step to something more complex. The following code will let me send data from a PuTTY terminal over the serial connection, display it (STDOUT), and send a period back over the UART. In other words, the UART connection is working.
However, if I uncomment the "my $outchar=<>;" line, everything stops working. I suspect this is because it's blocking. I've also tried replacing the line with a "my $outchar=getc();" line. This works a little better in that the characters coming in over the serial port eventually print, but only if a couple characters are typed on STDIN. This despite the `stty cbreak` instruction.
use IO::Termios ();
$| = 1;
my $fh = IO::Termios->open('/dev/ttyAPP4', '115200,8,n,1')
or die "IO::Termios->open: $!";
print $fh "Begin\n\r";
# my $outchar=<>;
print $fh ".";
# print $fh $outchar;
Is there a non-blocking approach to doing what I'm after? I managed to get the IO:Termios module installed, though it was a little nightmarish. I dread having to add another module. :p
Thanks in advance for any advice!