diff --git a/scan/scan b/scan/scan index d79833240497c3cdc53da69bd41fa3cf1c11cd7e..286c6772ecb9fb1806f6a0d3c9f04cb59e81af40 100755 --- a/scan/scan +++ b/scan/scan @@ -13,6 +13,7 @@ use Digest::SHA; my $verbose = 0; my $close = 0; +my $opt_exit = 0; my $s_all = 0; my $s_encodings = 0; my $s_iodev = 0; @@ -44,6 +45,7 @@ GetOptions( "psversion!" => \$s_psversion, "verbose!" => \$verbose, "close!" => \$close, + "exit!" => \$opt_exit, ) and @ARGV == 1 or die <<AMEN ; Usage: $0 [<options>] <hostname> @@ -59,6 +61,7 @@ Options: --psversion Scan PS interpreter version --verbose Be verbose and dump all communication with the printer --close Close connection after each scan to flush buffers +--exit Send Universal Exit Language after each scan to flush buffers AMEN my ($host) = @ARGV; @@ -236,10 +239,16 @@ sub need_ps() { enter_ps(); } +sub end_ps() { + tx("flush\n"); + uel() if $opt_exit; +} + sub scan_psversion() { heading("PS interpreter version"); need_ps(); - tx("version == revision == (%END%) = flush\n"); + tx("version == revision == (%END%) =\n"); + end_ps(); my $ver = rx_until("%END%"); print join(" ", @$ver), "\n"; } @@ -247,7 +256,8 @@ sub scan_psversion() { sub scan_pagedev() { heading("PS page device parameters"); need_ps(); - tx("currentpagedevice showdict (%END%) = flush\n"); + tx("currentpagedevice showdict (%END%) =\n"); + end_ps(); my $dict = rx_until("%END"); out_dict($dict); } @@ -262,8 +272,9 @@ sub scan_iodev() { currentdevparams showdict } 100 string /IODevice resourceforall (%>>%) = -(%END%) = flush +(%END%) = AMEN + end_ps(); out_dict(rx_until("%END")); } @@ -277,8 +288,9 @@ sub scan_outdev() { cvn /OutputDevice findresource showdict } 100 string /OutputDevice resourceforall (%>>%) = -(%END%) = flush +(%END%) = AMEN + end_ps(); my $odev = rx_until("%END%"); out_dict($odev); } @@ -328,8 +340,9 @@ sub scan_psfonts() { (%>>%) = flush % Flush to avoid buffer management bugs on Xerox Phaser 3300 } 100 string /Font resourceforall (%>>%) = -(%END%) = flush +(%END%) = AMEN + end_ps(); my $fonts = parse_dict(rx_until("%END%")); if ($verbose) { show_dict($fonts); @@ -367,8 +380,9 @@ sub scan_encodings() { /Encoding findresource == } 100 string /Encoding resourceforall (%>>%) = -(%END%) = flush +(%END%) = AMEN + end_ps(); my $encs = parse_dict(rx_until("%END%")); for my $e (keys %$encs) { my $array = $encs->{$e}; diff --git a/scan/show-snmp b/scan/show-snmp index 987032c00d523211c17e97ca27bf63afcaa52e95..531becc6af825cd12ac8fc57ea0be515fdd9ae2f 100755 --- a/scan/show-snmp +++ b/scan/show-snmp @@ -10,7 +10,7 @@ my $host = $ARGV[0] or die "Usage: $0 <host>\n"; print "Scanning $host...\n"; my $sess = Net::SNMP->session( - -hostname => $host . '.kam.hide.ms.mff.cuni.cz', + -hostname => $host . '.kam.mff.cuni.cz', -version => 1, -community => 'public', ) or die;