[Pkg-cups-devel] r669 - in cupsys/trunk/debian: . local/backends

Till Kamppeter till-guest at alioth.debian.org
Tue Jan 29 18:33:29 UTC 2008


Author: till-guest
Date: Tue Jan 29 18:33:28 2008
New Revision: 669

Log:
Update of dnssd backend to suppress IPv6 entry output.


Modified:
   cupsys/trunk/debian/changelog
   cupsys/trunk/debian/local/backends/dnssd

Modified: cupsys/trunk/debian/changelog
==============================================================================
--- cupsys/trunk/debian/changelog	(original)
+++ cupsys/trunk/debian/changelog	Tue Jan 29 18:33:28 2008
@@ -3,6 +3,14 @@
   [ Martin Pitt ]
   * debian/cupsys.init.d: Add Should-Start: avahi. (Closes: #459662)
 
+  [ Till Kamppeter ]
+  * debian/local/backends/dnssd: Updated dnssd to filter out IPv6 entries,
+    as they clutter the lists of detected printers and make the network
+    printer discovery process taking more time than needed. Applied also
+    a bug fix and the possibility of querying one IP address by calling
+    the dnssd backend with the IP as command line argument (like the
+    snmp CUPS backend).
+
  -- Kenshi Muto <kmuto at debian.org>  Wed, 09 Jan 2008 16:26:43 +0100
 
 cupsys (1.3.5-1) unstable; urgency=high

Modified: cupsys/trunk/debian/local/backends/dnssd
==============================================================================
--- cupsys/trunk/debian/local/backends/dnssd	(original)
+++ cupsys/trunk/debian/local/backends/dnssd	Tue Jan 29 18:33:28 2008
@@ -30,17 +30,22 @@
 # chmod 755 /usr/lib/cups/backend/dnssd
 # killall -HUP cupsd (or "/etc/init.d/cups restart", CUPS 1.1.x only)
 # lpinfo -v (or use any printer setup tool)
+#
+# /usr/lib/cups/backend/dnssd <IP address>
+#    Shows only info for printer with given IP
 
-#use strict;
+use strict;
 
 $0 =~ m!^(.*)/([^/]+)\s*$!;
 my $progname = ($2 || $0 || "dnssd");
 my $progpath = ($1 || "/usr/lib/cups/backend");
 
-if ($ARGV[0]){
+if (@ARGV > 1) {
     die "This backend is only for printer discovery, not for actual printing.\n";
 }
 
+my $ipfilter = $ARGV[0] if $ARGV[0];
+
 my $avahicmd = "avahi-browse -k -t -v -r -a 2> /dev/null";
 
 # IPs which are for computers, consider their printer entries as queues
@@ -59,6 +64,7 @@
 	$nettype = $2;
 	my $itemname = $3;
 	my $protocolinfo = $4;
+	next if $nettype !~ /^IPv4$/i;
         if ($protocolinfo =~ /_workstation/) {
 	    $protocol = "computer";
 	} elsif ($protocolinfo =~ /_pdl-datastream/) {
@@ -81,7 +87,7 @@
 	$port = $1;
     } elsif ($line =~ /^\s*txt\s*=\s*\[(.+)\]\s*$/) {
 	my $info = $1;
-	if ($protocol) {
+	if ($protocol && (!defined($ipfilter) || ($ipfilter eq $ip))) {
 	    my ($ty, $product, $pdls, $usb_MFG, $usb_MDL, $usb_DES, $usb_CMD) = 
 		("", "", "", "", "", "", "");
 	    while ($info =~ s/^\s*\"([^\"]+)\"\s*//) {
@@ -169,7 +175,7 @@
 		($usb_DES ? "DES:$usb_DES;" : "") .
 		($usb_CMD ? "CMD:$usb_CMD;" : "");
 	    $deviceid .= "CLS:PRINTER;" if $deviceid;
-	    $hosts->{$ip} = $hostname if ($hostname);
+	    $hosts->{$ip} = $host if $host;
 	    $output->{$ip}{$protocol}{$uriext} =
 		"network $uri \"$makemodel\" \"$makemodel $ip ($extra)\" \"$deviceid\"\n";
 	    ($interface, $nettype, $ip, $host, $make, $model, $description, $cmd, $makemodel, $deviceid, $protocol, $port, $uriext, $uri) =



More information about the Pkg-cups-devel mailing list