#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; use IPC::Open2; my $ezio = { cmd=> chr ( hex ( '0xFE' ) ) , init=> chr ( hex ( '0x28' ) ) , stopsend=> chr ( hex ( '0x37' ) ) , cls=> chr ( hex ( '0x01' ) ) , home=> chr ( hex ( '0x02' ) ) , blank=> chr ( hex ( '0x8' ) ) , hide=> chr ( hex ( '0x0C' ) ), readkey=> chr ( hex ( '0x06' ) ), turnon=> chr ( hex ( '0x0D' ) ) , cursor=> chr ( hex ( '0x0E' ) ) , }; sub ShowMessage { my $text = shift; my $text2 = shift; use bytes ; my $textlength = length $text; my $textlength2 = length $text2; no bytes; my $textpos = 40 - $textlength; print {*TTYOUT} $text,$textlength; print {*TTYOUT} "q{ } x $textpos"; print {*TTYOUT} $text2,$textlength2; return () } sub open_display { qx(pkill cu); my $stty = `/bin/stty -g`; open2( \*TTYIN, \*TTYOUT, 'cu -l/dev/cua01 -s2400 2>&1'); # starting cu hoses /dev/tty's stty settings, even when it has # been opened on a pipe... qx(/bin/stty $stty); $_ = ; chomp; if ( !m/^Connected/ ) { print STDERR "$0: cu printed `$_' instead of `Connected'\n"; } return (); } sub close_display { close TTYIN; close TTYOUT; return (); } sub EzioInit { print TTYOUT $ezio->{cmd}; print TTYOUT $ezio->{init}; print TTYOUT $ezio->{cmd}; print TTYOUT $ezio->{init}; return (); } sub Cls { print TTYOUT $ezio->{cmd}; print TTYOUT $ezio->{cls}; return (); } sub Blank { print TTYOUT $ezio->{cmd}; print TTYOUT $ezio->{blank}; return (); } sub CursorOn { print TTYOUT "$ezio->{cmd}"; print TTYOUT "$ezio->{cursor}"; return (); } sub Hide { print TTYOUT $ezio->{cmd}; print TTYOUT $ezio->{hide}; return (); } open_display(); EzioInit(); #open_display(); Cls(); Blank(); ShowMessage('*HGL EZIO *','****************'); Hide(); close_display(); 1