summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 327f12754..b8e9c9993 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -29,6 +29,11 @@ sub get {
}
sub hds() { grep { $_->{type} eq 'hd' } get(); }
sub cdroms() { grep { $_->{type} eq 'cdrom' } get(); }
+sub floppies() {
+ my @l = grep { $_->{type} eq 'fd' } get();
+ unshift @l, "fd0" if tryOpen("fd0");
+ @l;
+}
sub hasSCSI() {
defined $scsiDeviceAvailable and return $scsiDeviceAvailable;
@@ -143,3 +148,8 @@ sub hasPlip() { goto &getPlip }
sub hasEthernet() { hasNetDevice("eth0"); }
sub hasTokenRing() { hasNetDevice("tr0"); }
sub hasNetDevice($) { c::hasNetDevice($_[0]) }
+
+sub tryOpen($) {
+ local *F;
+ sysopen F, "/dev/$_[0]", c::O_NONBLOCK();
+}