summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-10-04 00:30:29 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-10-04 00:30:29 +0000
commit1237406e5ee90da9dbdfec9fce21d603f75c80a6 (patch)
treef9b071d99afeccf9ef1c029cd08724b24919d91f /perl-install/detect_devices.pm
parenta8fff3fb88fd5d727ab14812673dbed47541593e (diff)
downloaddrakx-1237406e5ee90da9dbdfec9fce21d603f75c80a6.tar
drakx-1237406e5ee90da9dbdfec9fce21d603f75c80a6.tar.gz
drakx-1237406e5ee90da9dbdfec9fce21d603f75c80a6.tar.bz2
drakx-1237406e5ee90da9dbdfec9fce21d603f75c80a6.tar.xz
drakx-1237406e5ee90da9dbdfec9fce21d603f75c80a6.zip
no_comment
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm27
1 files changed, 14 insertions, 13 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 6e9852b45..9a28f0624 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -43,30 +43,34 @@ sub ls120s() { grep { $_->{type} =~ /.d/ && isLS120Drive($_) } get(); }
sub usbfdus() { grep { $_->{type} =~ /.d/ && isUSBFDUDrive($_) } get(); }
sub cdroms() {
my @l = grep { $_->{type} eq 'cdrom' } get();
- if (my @l2 = getIDEBurners()) {
+ if (my @l2 = grep { isBurner($_->{device}) } @l) {
require modules;
modules::add_alias('scsi_hostadapter', 'ide-scsi');
my $nb = 1 + max(-1, map { $_->{device} =~ /scd (\d+)/x } @l);
- foreach my $b (@l2) {
- log::l("getIDEBurners: $b");
- my ($e) = grep { $_->{device} eq $b } @l or next;
- $e->{device} = "scd" . $nb++;
+ foreach (@l2) {
+ log::l("IDEBurner: $_->{device}");
+ $_->{device} = "scd" . $nb++;
}
}
@l;
}
+sub burners { grep { isBurner($_->{device}) } cdroms() }
+sub IDEburners { grep { $_->{type} eq 'cdrom' && isBurner($_->{device}) } getIDE() }
+
sub floppies() {
my @ide = map { $_->{device} } ls120s() and modules::load("ide-floppy");
my @scsi = map { $_->{device} } usbfdus();
(@ide, @scsi, grep { tryOpen($_) } qw(fd0 fd1));
}
+sub floppy { first(floppies()) }
#- example ls120, model = "LS-120 SLIM 02 UHD Floppy"
-sub isZipDrive() { $_[0]->{info} =~ /ZIP\s+\d+/ } #- accept ZIP 100, untested for bigger ZIP drive.
-#-sub isJazzDrive() { $_[0]->{info} =~ /JAZZ?\s+/ } #- untested.
-sub isLS120Drive() { $_[0]->{info} =~ /LS-?120/ }
-sub isUSBFDUDrive() { $_[0]->{info} =~ /USB-?FDU/ }
-sub isRemovableDrive() { &isZipDrive || &isLS120Drive || &isUSBFDUDrive } #-or &isJazzDrive }
+sub isBurner { my $f = tryOpen($_[0]); $f && c::isBurner(fileno($f)) }
+sub isZipDrive { $_[0]->{info} =~ /ZIP\s+\d+/ } #- accept ZIP 100, untested for bigger ZIP drive.
+#-sub isJazzDrive { $_[0]->{info} =~ /JAZZ?\s+/ } #- untested.
+sub isLS120Drive { $_[0]->{info} =~ /LS-?120|144MB/ }
+sub isUSBFDUDrive { $_[0]->{info} =~ /USB-?FDU/ }
+sub isRemovableDrive { &isZipDrive || &isLS120Drive || &isUSBFDUDrive } #-or &isJazzDrive }
sub hasSCSI() {
local *F;
@@ -135,9 +139,6 @@ sub getIDE() {
@idi;
}
-#- do not work if ide-scsi is built in the kernel (aka not in module)
-sub getIDEBurners() { uniq map { m!ATAPI.* CD(-R|/RW){1,2} ! ? /(\w+)/ : () } syslog() }
-
sub getCompaqSmartArray() {
my @idi;
my $f;