summaryrefslogtreecommitdiffstats
path: root/perl-install/printer/main.pm
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2003-01-28 03:04:37 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2003-01-28 03:04:37 +0000
commit3036237fc27cca6f6e8c8c7db08d30b1e944227b (patch)
tree2ee0330f9c5c2de6625423c0df1ea81d65a1457c /perl-install/printer/main.pm
parentb725a5ba74f0982372e3c164ea1399328a99ab84 (diff)
downloaddrakx-3036237fc27cca6f6e8c8c7db08d30b1e944227b.tar
drakx-3036237fc27cca6f6e8c8c7db08d30b1e944227b.tar.gz
drakx-3036237fc27cca6f6e8c8c7db08d30b1e944227b.tar.bz2
drakx-3036237fc27cca6f6e8c8c7db08d30b1e944227b.tar.xz
drakx-3036237fc27cca6f6e8c8c7db08d30b1e944227b.zip
More stuff for non-interactive printer configuration:
- Added find_new_printer() function to find local printers which are not configured yet - Fixed Titi's bugs which messed up list of auto-detected printers - Corrected text in the dialog for changing the printer connection type (for local printer connections). - Allow switching to expert mode during installation (the installation has no global expert mode any more.
Diffstat (limited to 'perl-install/printer/main.pm')
-rw-r--r--perl-install/printer/main.pm70
1 files changed, 70 insertions, 0 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index de5e5e7ad..1a047ad1a 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -1892,6 +1892,76 @@ sub copy_foomatic_queue {
# ------------------------------------------------------------------
#
+# Stuff for non-interactive printer configuration
+#
+# ------------------------------------------------------------------
+
+# Check whether a given URI (for example of an existing queue matches
+# one of the auto-detected printers
+
+sub autodetectionentry_for_uri {
+ my ($uri, @autodetected) = @_;
+
+ if ($uri =~ m!^usb://([^/]+)/([^/\?]+)(|\?serial=(\S+))$!) {
+ # USB device with URI referring to printer model
+ my $make = $1;
+ my $model = $2;
+ my $serial = $4;
+ if ($make and $model) {
+ $make =~ s/\%20/ /g;
+ $model =~ s/\%20/ /g;
+ $serial =~ s/\%20/ /g;
+ $make =~ s/Hewlett[-\s_]Packard/HP/;
+ $make =~ s/HEWLETT[-\s_]PACKARD/HP/;
+ foreach my $p (@autodetected) {
+ next if (!$p->{val}{MANUFACTURER} or
+ ($p->{val}{MANUFACTURER} ne $make));
+ next if (!$p->{val}{MODEL} or
+ ($p->{val}{MODEL} ne $model));
+ next if ((!$p->{val}{SERIALNUMBER} and $serial) or
+ ($p->{val}{SERIALNUMBER} and !$serial) or
+ ($p->{val}{SERIALNUMBER} ne $serial));
+ return $p;
+ }
+ }
+ } elsif ($uri =~ m!^ptal:/mlc:!) {
+ # HP multi-function device (controlled by HPOJ)
+ my $ptaldevice = $uri;
+ $ptaldevice =~ s!^ptal:/mlc:!!;
+ if ($ptaldevice =~ /^par:(\d+)$/) {
+ my $device = "/dev/lp$1";
+ foreach my $p (@autodetected) {
+ next if (!$p->{port} or
+ ($p->{port} ne $device));
+ return $p;
+ }
+ } else {
+ $ptaldevice =~ /^usb:(.*)$/;
+ my $model = $1;
+ $model =~ s/_/ /g;
+ my $device = "";
+ foreach my $p (@autodetected) {
+ next if (!$p->{val}{MODEL} or
+ ($p->{val}{MODEL} ne $model));
+ return $p;
+ }
+ }
+ } elsif ($uri =~ m!^(socket|smb|file|parallel|usb|serial):/!) {
+ # Local print-only device, Ethernet-(TCP/Socket)-connected printer,
+ # or printer on Windows server
+ my $device = $uri;
+ $device =~ s/^(file|parallel|usb|serial)://;
+ foreach my $p (@autodetected) {
+ next if (!$p->{port} or
+ ($p->{port} ne $device));
+ return $p;
+ }
+ }
+ return undef;
+}
+
+# ------------------------------------------------------------------
+#
# Configuration of HP multi-function devices
#
# ------------------------------------------------------------------