zentara has asked for the wisdom of the Perl Monks concerning the following question:
I know I could just kill the $pid, but the control-d works from the command-line operation of scanimage, and I would like to know why it dosn't go thru IPC.
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; use Tk; my $mw=tkinit; my $start_but = $mw->Button(-text => 'Start Scan', -command => \&start_scan)->pack(); my $cancel_but = $mw->Button(-text => 'Cancel Scan', -command => \&stop_scan)->pack(); MainLoop; ################################### sub start_scan{ # do a 'scanimage -L ' for your list my @options = ( '-d umax:/dev/scanner', '-b', '--format=tiff', '--batch-count=3', '--batch-prompt', ); #interface to scanimage my $pid = open3(\*WRITE, 0 ,\*ERROR, "scanimage @options" ); $mw->fileevent('ERROR', 'readable' => \&collect_stderr); } ############################################################### sub collect_stderr { my $err = <ERROR>; print $err; } ############################################################### sub stop_scan{ # print WRITE chr(4),"\n"; # print WRITE "\x04\n"; print WRITE "\cd"; # print WRITE "\004\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sending a control signal to a scanner
by Fletch (Bishop) on Aug 01, 2006 at 20:41 UTC | |
|
Re: sending a control signal to a scanner
by Hue-Bond (Priest) on Aug 01, 2006 at 20:29 UTC | |
by zentara (Cardinal) on Aug 01, 2006 at 20:35 UTC |