[Pkg-cups-devel] r670 - in cupsys/branches/cups-1.2-ubuntu/debian: . local/backends

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


Author: till-guest
Date: Tue Jan 29 18:46:46 2008
New Revision: 670

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


Modified:
   cupsys/branches/cups-1.2-ubuntu/debian/changelog
   cupsys/branches/cups-1.2-ubuntu/debian/local/backends/dnssd

Modified: cupsys/branches/cups-1.2-ubuntu/debian/changelog
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/changelog	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/changelog	Tue Jan 29 18:46:46 2008
@@ -1,3 +1,14 @@
+cupsys (1.3.5-1ubuntu2) hardy; urgency=low
+
+  * 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).
+
+ -- Till Kamppeter <till.kamppeter at gmail.com>  Tue, 29 Jan 2008 19:01:06 +0000
+
 cupsys (1.3.5-1ubuntu1) hardy; urgency=low
 
   * Merge with Debian unstable; remaining Ubuntu changes:

Modified: cupsys/branches/cups-1.2-ubuntu/debian/local/backends/dnssd
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/local/backends/dnssd	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/local/backends/dnssd	Tue Jan 29 18:46:46 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