トップ «前の日(05-06) 最新 次の日(05-08)» 追記

Masa's blog

検索キーワード:

2012年05月07日 escputil(gutenprint-5.2.7) with EPSON PM-3500C

_ escputil(gutenprint-5.2.7) with EPSON PM-3500C

I installed gutenprint-5.2.7 to control EPSON PM-3500C by using escputil.

How to install

How to list supported models

escputil -M

How to show ink status

escputil -s -r /dev/usb/lp0 -m escp2-pm3500c

How to clean nozzle

escputil -c -r /dev/usb/lp0 -m escp2-pm3500c

How to print check pattern

escputil -n -r /dev/usb/lp0 -m escp2-pm3500c

escputil.cgi

Quick hack version B)

#!/usr/bin/perl
#
##use NKF;
#
$Cgipath = "http://Foo.org/cgi-bin/escputil.cgi";
#
#---------------------------------------------------------------------
#
# Get from form
#
read(STDIN, $buf, $ENV{'CONTENT_LENGTH'});
@array = split(/&/, $buf);
foreach $i (@array){
  ($key, $val) = split(/=/, $i);
  $val =~ tr/+/ /;
  $val =~ s/%([0-9a-zA-Z][0-9a-zA-Z])/pack("C",hex($1))/eg;
  $val =~ s/\n$//eg;
##  $input{$key} = nkf('-e', $val);
  $input{$key} = $val;
}
#---------------------------------------------------------------------
($sec,$min,$hour,$day,$month,$year,$wday,$yday,$isdst) = localtime(time);
#
print "Content-type: text/html\n\n";
print "<html>\n";
print "<head>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=euc-jp\">\n";
print "<title>escputil for EPSON PM-3500C</title>\n";
print "</head>\n";
#
# create form
#
print "<body>\n";
print "<div align=\"center\"><h1>escputil for EPSON PM-3500C</h1></div>\n";
print "<hr>\n";
print "<form action=\"$Cgipath\" method=\"POST\">\n";
print "<input type=\"submit\" value=\"Clean nozzle\" name=\"Clean_nozzle\"><br>\n";
print "<input type=\"submit\" value=\"Print check pattern\" name=\"Print_check_pattern\"><br>\n";
print "<hr>\n";
print "<input type=\"submit\" value=\"Update status\" name=\"Update_status\">\n";
print "<pre>\n";
$status = `/usr/local/bin/escputil -s -r /dev/usb/lp0 -m escp2-pm3500c`;
print $status;
print "</pre>\n";
print "</form>\n";
print "<hr>\n";
#
if ($input{'Clean_nozzle'} eq "Clean nozzle"){
	$status = `/usr/local/bin/escputil -c -r /dev/usb/lp0 -m escp2-pm3500c`;
}
#
if ($input{'Print_check_pattern'} eq "Print check pattern"){
	$status = `/usr/local/bin/escputil -n -r /dev/usb/lp0 -m escp2-pm3500c`;
}
#
if ($input{'Update_status'} eq "Update status"){
	# do nothing
}
#
print "</body>\n";
print "</html>\n";
#---------------------------------------------------------------------

You have to give your http daemon `read/write permission to /dev/usb/lp0'

# vipw -g

lp::7:lp,daemon,httpd