summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2000-09-29 16:49:51 +0000
committerFrancois Pons <fpons@mandriva.com>2000-09-29 16:49:51 +0000
commit0d05432e5549d86203a9677603824923920b10cd (patch)
tree9f1729f99647a3b8b47fad6409ce5914863e2c2f
parentec6fb419868416b1c90fcac09e3887d9b68eab99 (diff)
downloaddrakx-backup-do-not-use-0d05432e5549d86203a9677603824923920b10cd.tar
drakx-backup-do-not-use-0d05432e5549d86203a9677603824923920b10cd.tar.gz
drakx-backup-do-not-use-0d05432e5549d86203a9677603824923920b10cd.tar.bz2
drakx-backup-do-not-use-0d05432e5549d86203a9677603824923920b10cd.tar.xz
drakx-backup-do-not-use-0d05432e5549d86203a9677603824923920b10cd.zip
*** empty log message ***
-rw-r--r--perl-install/ChangeLog7
-rw-r--r--perl-install/detect_devices.pm21
-rw-r--r--perl-install/printer.pm22
3 files changed, 38 insertions, 12 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog
index 1f3de2080..058fa3296 100644
--- a/perl-install/ChangeLog
+++ b/perl-install/ChangeLog
@@ -11,7 +11,14 @@
2000-09-29 François Pons <fpons@mandrakesoft.com>
* modules.pm (load): fixed when standalone, use modprobe.
+
* pkgs.pm: added preference for wu-ftpd.
+
+ * detect_devices.pm: added code to proble USB printer.
+
+ * printer.pm: fixed missing PRINTER=yes on CUPS configuration for
+ USB printer.
+
* install_steps.pm: removed possibilty to add an user in urpmi
group (jloup).
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 4c9360d8e..b937eca48 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -254,13 +254,32 @@ sub whatParport() {
@res;
}
+sub whatUsbport() {
+ my ($i, $elem, @res) = (0, {});
+ local *F;
+ open F, "/proc/bus/usb/devices" or return;
+ foreach (<F>) {
+ $elem->{$1} = $2 if /S:\s+(.*)=(.*\S)/;
+ if (/I:.*Driver=(printer|usblp)/ && $elem->{Manufacturer} && $elem->{Product}) {
+ my $MF = ${{ 'Hewlett-Packard' => 'HP' }}{$elem->{Manufacturer}} || $elem->{Manufacturer};
+ push @res, { port => "/dev/usb/lp$i", val => { CLASS => 'PRINTER',
+ MODEL => $elem->{Product},
+ MANUFACTURER => $elem->{Manufacturer},
+ DESCRIPTION => "$MF $elem->{Product}",
+ }};
+ $i++; $elem = {}; #- try next one, but blank what has been probed.
+ }
+ }
+ @res;
+}
+
#-CLASS:PRINTER;
#-MODEL:HP LaserJet 1100;
#-MANUFACTURER:Hewlett-Packard;
#-DESCRIPTION:HP LaserJet 1100 Printer;
#-COMMAND SET:MLC,PCL,PJL;
sub whatPrinter() {
- my @res = whatParport();
+ my @res = (whatParport(), whatUsbport());
grep { $_->{val}{CLASS} eq "PRINTER"} @res;
}
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index def53c7d0..d8fd4f19d 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -580,19 +580,19 @@ sub configure_queue($) {
print PRINTCAP "\n";
}
eval { commands::chown_("root.lp", "$prefix/etc/printcap") };
-
- my $useUSB = 0;
- foreach (values %{$entry->{configured}}) {
- $useUSB ||= $_->{DEVICE} =~ /usb/;
- }
- if ($useUSB) {
- my $f = "$prefix/etc/sysconfig/usb";
- my %usb = getVarsFromSh($f);
- $usb{PRINTER} = "yes";
- setVarsInSh($f, \%usb);
- }
last };
}
+
+ my $useUSB = 0;
+ foreach (values %{$entry->{configured}}) {
+ $useUSB ||= $_->{DEVICE} =~ /usb/ || $_->{DeviceURI} =~ /usb/;
+ }
+ if ($useUSB) {
+ my $f = "$prefix/etc/sysconfig/usb";
+ my %usb = getVarsFromSh($f);
+ $usb{PRINTER} = "yes";
+ setVarsInSh($f, \%usb);
+ }
}
#- use the queue currently configured at the top of printer hash.