diff options
-rw-r--r-- | perl-install/c/stuff.xs.pm | 15 | ||||
-rw-r--r-- | perl-install/detect_devices.pm | 7 |
2 files changed, 21 insertions, 1 deletions
diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index f6e63a85d..563c97013 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -26,6 +26,7 @@ print ' #include <linux/kd.h> #include <linux/hdreg.h> #include <linux/vt.h> +#include <linux/fd.h> #include <linux/cdrom.h> #include <linux/loop.h> #include <net/if.h> @@ -236,6 +237,20 @@ isDvdDrive(fd) OUTPUT: RETVAL +char * +floppy_info(name) + char * name + CODE: + int fd = open(name, O_RDONLY | O_NONBLOCK); + RETVAL = NULL; + if (fd != -1) { + char drivtyp[17]; + ioctl(fd, FDGETDRVTYP, (void *)drivtyp); + RETVAL = drivtyp; + } + OUTPUT: + RETVAL + unsigned int total_sectors(fd) int fd diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 46626e06c..dba137f4c 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -73,10 +73,15 @@ sub get_mac_generation() { return "Unknown Generation"; } +sub dev_is_devfs { 0 && -e "/dev/.devfsd" } + sub floppies() { require modules; eval { modules::load("floppy") }; - my @fds = map {; { device => $_, media_type => 'fd' } } grep { tryOpen($_) } qw(fd0 fd1); + my @fds = map { + my $info = (!dev_is_devfs() || -e "/dev/$_") && c::floppy_info(devices::make($_)); + if_($info && $info ne '(null)', { device => $_, media_type => 'fd', info => $info }) + } qw(fd0 fd1); my @ide = ls120s() and modules::load("ide-floppy"); my @scsi = grep { $_->{media_type} eq 'fd' } getSCSI(); @ide, @scsi, @fds; |