summaryrefslogtreecommitdiffstats
path: root/perl-install/printer
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2005-08-31 14:36:47 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2005-08-31 14:36:47 +0000
commit98fc1310a0c85782cc06e98349fca8aa9850dc73 (patch)
treee68077a03d2c4ca5e876549c627448486bd16d4c /perl-install/printer
parentc48fab451e7b4dcc44f8c70818000024c73c8e8e (diff)
downloaddrakx-98fc1310a0c85782cc06e98349fca8aa9850dc73.tar
drakx-98fc1310a0c85782cc06e98349fca8aa9850dc73.tar.gz
drakx-98fc1310a0c85782cc06e98349fca8aa9850dc73.tar.bz2
drakx-98fc1310a0c85782cc06e98349fca8aa9850dc73.tar.xz
drakx-98fc1310a0c85782cc06e98349fca8aa9850dc73.zip
- Fixed parallel printer auto-detection and registered IEEE-1284 ID
string for Mandriva hardware database. - Fixed USB IEEE-1284 ID string output.
Diffstat (limited to 'perl-install/printer')
-rw-r--r--perl-install/printer/detect.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm
index cf07a06df..43aed0d5b 100644
--- a/perl-install/printer/detect.pm
+++ b/perl-install/printer/detect.pm
@@ -38,26 +38,32 @@ sub whatPrinter() {
sub whatParport() {
my @res;
- foreach (0..3) {
+ my $i = 0;
+ foreach (sort { $a =~ /(\d+)/; my $m = $1; $b =~ /(\d+)/; my $n = $1; $m <=> $n } `ls -1d /proc/parport/[0-9]* /proc/sys/dev/parport/parport[0-9]* 2>/dev/null`) {
+ chomp;
my $elem = {};
my $F;
- open $F, "/proc/parport/$_/autoprobe" or open $F, "/proc/sys/dev/parport/parport$_/autoprobe" or next;
+ open $F, "$_/autoprobe" or next;
{
local $_;
my $itemfound = 0;
- while (<$F>) {
+ while (<$F>) {
+ chomp;
if (/(.*):(.*);/) { #-#
$elem->{$1} = $2;
$elem->{$1} =~ s/Hewlett[-\s_]Packard/HP/;
$elem->{$1} =~ s/HEWLETT[-\s_]PACKARD/HP/;
$itemfound = 1;
+ # Add IEEE-1284 device ID string
+ $elem->{IEEE1284} .= $_;
}
}
# Some parallel printers miss the "CLASS" field
$elem->{CLASS} = 'PRINTER'
if $itemfound && !defined($elem->{CLASS});
}
- push @res, { port => "/dev/lp$_", val => $elem };
+ push @res, { port => "/dev/lp$i", val => $elem };
+ $i ++;
}
@res;
}
@@ -103,6 +109,10 @@ sub whatUsbport() {
next;
};
close $PORT;
+ # Cut resulting string to its real length
+ my $length = ord(substr($idstr, 1, 1)) +
+ (ord(substr($idstr, 0, 1)) << 8);
+ $idstr = substr($idstr, 2, $length-2);
# Remove non-printable characters
$idstr =~ tr/[\x00-\x1f]/./;
# If we do not find any item in the ID string, we try to read