Index: trunk/ippScripts/scripts/register_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/register_imfile.pl	(revision 25473)
+++ trunk/ippScripts/scripts/register_imfile.pl	(revision 25483)
@@ -33,4 +33,5 @@
 my $ppStats = can_run( 'ppStats' ) or (warn "Can't find ppStats" and $missing_tools = 1);
 my $ppStatsFromMetadata = can_run( 'ppStatsFromMetadata' ) or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
+my $ppConfigDump = can_run( 'ppConfigDump' ) or (warn "Can't find ppConfigDump" and $missing_tools = 1);
 
 my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $bytes, $md5sum, $dbname, $verbose, $no_update, $no_op, $logfile);
@@ -103,9 +104,49 @@
     print "[Running $command2]\n";
     my $result2 = IPC::Run::run $h2;
-    print "STDOUT:\n$out2";
-    print "STDERR:\n$err2";
+
     &my_die("Unable to perform ppStatsFromMetadata on exposure id $exp_id: " . $h2->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, ($h2->result() or $PS_EXIT_PROG_ERROR) ) unless $result2;
     chomp $out2;
     $cmdflags = $out2;
+
+    # Manually parse the burntool_state entry.
+    my $burntoolState = 0;
+    my $isGPC1 = 0;
+    my $burntoolStateGood = 0;
+    foreach my $line (split /\n/, $out1) {
+	if ($line =~ /FPA.BURNTOOL.APPLIED/) {
+	    $line =~ s/^\s+//;
+	    $burntoolState = (split /\s+/, $line)[2];
+	}
+	if ($line =~ /FPA.CAMERA/) {
+	    $line =~ s/^\s+//;
+	    if ((split /\s+/, $line)[2] eq 'GPC1') {
+		$isGPC1 = 1;
+	    }
+	}
+    }
+    if ($isGPC1 != 1) {
+	$burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool.
+    }
+    elsif (($isGPC1 == 1) && ($burntoolState == 1)) {
+	my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -";
+	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	    IPC::Cmd::run(command => $ppConfigDump_cmd, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    warn ("Unable to perform ppConfigDump");
+	    exit($error_code);
+	}
+
+	# This is ugly, but doing a full parse for one entry is a bit wasteful.
+	foreach my $line (split /\n/, (join "", @$stdout_buf)) {
+	    if ($line =~ /BURNTOOL.STATE.GOOD/) {
+		$line =~ s/^\s+//;
+		$burntoolStateGood = (split /\s+/, $line)[2];
+		last;
+	    }
+	}
+	$burntoolState = $burntoolStateGood; # Positive because this has the header table.
+    }
+    $cmdflags .= " -burntool_state $burntoolState ";
 }
 
