summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-04-11 12:16:27 +0000
committerFrancois Pons <fpons@mandriva.com>2001-04-11 12:16:27 +0000
commitf1938a800ccee64e384a663bea7840ca20203b76 (patch)
tree927d86afe6afa7560f56ea3a4b2a2c68a5596ab3 /perl-install
parent51d9bc4cd3119c1bcf8510a2834c81d17474798c (diff)
downloaddrakx-backup-do-not-use-f1938a800ccee64e384a663bea7840ca20203b76.tar
drakx-backup-do-not-use-f1938a800ccee64e384a663bea7840ca20203b76.tar.gz
drakx-backup-do-not-use-f1938a800ccee64e384a663bea7840ca20203b76.tar.bz2
drakx-backup-do-not-use-f1938a800ccee64e384a663bea7840ca20203b76.tar.xz
drakx-backup-do-not-use-f1938a800ccee64e384a663bea7840ca20203b76.zip
fixed printer probe (usb and parallel).
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/detect_devices.pm28
1 files changed, 12 insertions, 16 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 6d0d1cc31..46bc37450 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -267,8 +267,10 @@ sub whatParport() {
my $elem = {};
local *F;
open F, "/proc/parport/$_/autoprobe" or open F, "/proc/sys/dev/parport/parport$_/autoprobe" or next;
- local $_;
- while (<F>) { $elem->{$1} = $2 if /(.*):(.*);/ }
+ {
+ local $_;
+ while (<F>) { $elem->{$1} = $2 if /(.*):(.*);/ }
+ }
push @res, { port => "/dev/lp$_", val => $elem};
}
@res;
@@ -281,19 +283,13 @@ sub usbZips { grep { $_->{type} =~ /Mass Storage\|/ } usb_probe() }
sub whatUsbport() {
my ($i, $elem, @res) = (0, {});
- local *F; open F, "/proc/bus/usb/devices" or return;
- local $_;
- while (<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.
- }
+ foreach (grep { $_->{type} =~ /Printer/ } usb_probe()) {
+ my ($manufacturer, $model) = split '\|', $_->{description};
+ push @res, { port => "/dev/usb/lp$i", val => { CLASS => 'PRINTER',
+ MODEL => $model,
+ MANUFACTURER => $manufacturer,
+ DESCRIPTION => $_->{description},
+ }};
}
@res;
}
@@ -309,7 +305,7 @@ sub whatPrinter() {
}
sub whatPrinterPort() {
- grep { tryWrite($_)} qw(/dev/lp0 /dev/lp1 /dev/lp2 /dev/usb/lp0);
+ grep { tryWrite($_)} qw(/dev/lp0 /dev/lp1 /dev/lp2 /dev/usb/lp0 /dev/usb/lp1 /dev/usb/lp2);
}
sub probeSerialDevices {