Commit 97066a92 authored by Mike Hibler's avatar Mike Hibler

Pulled another fix from the anal repository...

No idea why rpc exchanges started failing after updating boss/ops to
FreeBSD 6.1 or, for that matter, why this really fixes the problem.
Monitoring the exchanges between client and the RPC serial line didn't
show any rhyme or reason why some exchanges elicited "Input error" and
others didn't.  But I noticed that every \r we send to the RPC gets
echoed back as \r\r\n (and no, it isn't the serial line CR<->NL mapping).
So I reduced the number of \r (actually \n) we send it and things got better.

This "fix" has been running every 5 minutes for the last hour without
failure, so I declare it: An Improvement.
parent f3514ad7
......@@ -196,7 +196,7 @@ sub syncandsend($$$) {
my ($controller,$TIP,$cmd,$statusp) = @_;
#
# Send a couple of newlines to get the command prompt, and then wait
# Send a newline to get the command prompt, and then wait
# for it to print out the command prompt. This loop is set for a small
# number since if it cannot get the prompt quickly, then something has
# gone wrong.
......@@ -206,7 +206,7 @@ sub syncandsend($$$) {
for (my $i = 0; $i < 20; $i++) {
my $line;
if (syswrite($TIP, "\r\n") == 0) {
if (syswrite($TIP, "\r") == 0) {
print STDERR
"*** Power control sync write failed ($controller/$outlet)\n";
return 1;
......@@ -239,20 +239,20 @@ sub syncandsend($$$) {
#
# These things have an annoying tendency to fail sometimes by losing
# the command part of the string (e.g., "6" instead of "reboot 6").
# I think we are overrunning the UART with "\r\n" since we put out
# I think we are overrunning the UART with "\r" since we put out
# a pair after every line we read that is not a prompt and when the
# RPC puts out its banner, it is a good 10 lines before we see the
# prompt. So allow some time for the RPC to digest everything before
# we feed it the command.
#
sleep(2);
sleep(1);
if ($debug) {
print "Sending '$cmd' to $controller\n";
}
# Okay, got a prompt. Send it the string:
if (syswrite($TIP, "$cmd\r\n") == 0) {
if (syswrite($TIP, "$cmd\r") == 0) {
print STDERR "*** Power control write failed ($controller/$outlet)\n";
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment