From 29c3201c8dc00e3384afc32ae946a59992498fbe Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Tue, 8 Feb 2005 14:37:25 +0000 Subject: - Corrected recognition of driver name in Foomatic-generated PPDs. - Conserve auto-detection data when a Foomatic printer entry is replaced by an entry from a native PostScript PPD. --- perl-install/printer/main.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 28ee79cb5..30c2ef8ea 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -1717,7 +1717,7 @@ sub poll_ppd_base { my $fullfoomaticdriver = $driver; # Foomatic PPD? Extract driver name my $isfoomatic = - $driver =~ s/^\s*(GhostScript|Foomatic)\s*\+\s*//i; + $driver =~ s!^\s*(GhostScript|Foomatic)(\s*\+\s*|/)!!i; # Foomatic PostScript driver? $isfoomatic ||= $descr =~ /Foomatic/i; # Native CUPS? @@ -1736,6 +1736,7 @@ sub poll_ppd_base { # Foomatic $key = $keynolang; } + my ($devidmake, $devidmodel, $deviddesc, $devidcmdset); if (!$printer->{expert}) { # Remove driver from printer list entry when in # recommended mode @@ -1758,6 +1759,11 @@ sub poll_ppd_base { $thedb{$key}{driver} =~ /^PostScript$/i || $thedb{$key}{driver} ne "PPD" && $isrecommended || $thedb{$key}{driver} eq "PPD" && $isrecommended && $driver ne "PostScript") { + # Save the autodetection data + $devidmake = $thedb{$key}{devidmake}; + $devidmodel = $thedb{$key}{devidmodel}; + $deviddesc = $thedb{$key}{deviddesc}; + $devidcmdset = $thedb{$key}{devidcmdset}; # Remove the old entry delete $thedb{$key}; } else { @@ -1834,7 +1840,12 @@ sub poll_ppd_base { $thedb{$key}{make} = $mf; $thedb{$key}{model} = $model; $thedb{$key}{driver} = $driver; - # Get auto-detection data + # Recover saved autodetection data + $thedb{$key}{devidmake} = $devidmake if $devidmake; + $thedb{$key}{devidmodel} = $devidmodel if $devidmodel; + $thedb{$key}{deviddesc} = $deviddesc if $deviddesc; + $thedb{$key}{devidcmdset} = $devidcmdset if $devidcmdset; + # Get autodetection data #my ($devidmake, $devidmodel) = ppd_devid_data($ppd); #$thedb{$key}{devidmake} = $devidmake; #$thedb{$key}{devidmodel} = $devidmodel; -- cgit v1.2.1