#!/usr/bin/perl
#
# Chatboard test utility
# Answer 'OK' to everything and spit out the communication

$| = 1;

system('stty 9600 -F /dev/tts/5');

open(TTS, "+< /dev/tts/5") or die;
print TTS "OK\n";

while(<TTS>) {
	print TTS "OK\n";

	# cut them into pieces...
	if (/^(AT\+CKPD=")([0-9a-f]+)(".*)$/) {
		my $pre = $1;
		my $pieces = $2;
		my $post = $3;
		$pieces =~ s/(..)/$1 /g;

		$_ = "$pre$pieces$post\n";
	}

	print;
}

