I am CC'ing this to the list as others might find it useful to know this,
sorry about the length.

The later model JetDirects can be addressed as remote net printers:

##PRINTTOOL3## REMOTE ljet4 600x600 a4 {} LaserJet4 Default 1
lp:\
        :sd=/var/spool/lpd/lp:\
        :mx#0:\
        :sh:\
        :rm=cwaylp94:\
        :rp=lp:\
        :if=/var/spool/lpd/lp/filter:

The earlier models only worked with port 9100 and have to be addressed as
direct printers:

##PRINTTOOL3## DIRECT ljet4 600x600 a4 {} LaserJet4 Default 1
lp:\
        :sd=/var/spool/lpd/lp:\
        :mx#0:\
        :sh:\
        :if=/var/spool/lpd/lp/filter:\
        :af=/var/spool/lpd/lp/acct:\
        :lp=/dev/null:

and the /var/spool/lpd/lp/.config file is

printer_ip=www.xxx.yyy.zzz
port=9100                                                                       


But, for this latter, you also need to install
/usr/lib/rhs/rhs-printfilters/directprint which is not installed by
default.  I include it here if you cannot find it in your distro.

8<---------------8<--------------------8<

#!/usr/bin/perl
#  Direct-to-printer (old HP Jetdirect style printers) filter
#  to integrate with rhs-printfilters.
#  Supplied by Joshua Buysse, University of Minnesota

# needs perl 5.004 for IO:Socket
require 5.004;

# Maximum number of times to retry connection
$max_retries = 3600; # at one second each, one hour.

# needed for the dirname() function
use File::Basename;
use IO::Socket;

# The first parameter to the script is the name of the
# accounting file, in the spool directory for the printer.
$acct_file = $ARGV[0];

# we need the spool_dir to pick up the config files
$spool_dir = dirname($acct_file);

$config_file = "$spool_dir/.config";
 
open(CONFIG, $config_file) || die "No config file found!";
 
while (<CONFIG>) {
  chomp;
  s/#.*//;     # no comments
  s/^\s+//;    # no leading white
  s/\s+$//;    # no trailing white
 
  # If there's nothing left, we're done.
  next unless length;
 
  # split the fields
  my ($key,$value) = split /\s*=\s*/, $_, 2;
 
  $config{$key} = $value;
}
 
 
# the config hash should contain port and printer_ip as keys
 
# if the port isn't set, use the default of 9100
$config{'port'} = 9100 unless $config{'port'};
$config{'printer_ip'} || die "Config file does not specify printer IP.";
 
# now, open a socket to the printer.
 
$retry_count = 0;
 
do {
  $socket = IO::Socket::INET->new(PeerAddr => $config{'printer_ip'},
                                  PeerPort => $config{'port'},
                                  Proto    => "tcp",
                                  Type     => SOCK_STREAM);
  if (! $socket) {
    sleep 1;
    $retry_count++;
  }
} until ($socket || ($retry_count > $max_retries));
 
$socket || die "Unable to open socket after $retry_count retries.";
 
while (<STDIN>) {
  print $socket $_;
}
 
close($socket);
                                                                                
8<--------------------8<----------------------8<------

-- 
Howard.
______________________________________________________
LANNet Computing Associates <http://www.lannet.com.au>

> Steven Kerr wrote on Fri, 24 Nov 2000
> 
> >What is the best method of utilizing HP Jet Directs (300/500 and
> >Builtins) on a RH 6.2 System.
> 
> >Our leagcy system currently uses approximatly 30 J/Directs, but the
> >old host O/S (DG/UX) was able to see them as termprinters
> 
> >I am aware that I can run them in lpd mode, but is there a way that I
> >can get native RH6 to talk JetDirect language to ports 910x ?



-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to