From 5d165fecad7ba9831fc47d47dc9d9a0a0ca66ea1 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 5 Jun 2001 17:04:34 +0000 Subject: nicer solution for detecting DVD drives (still need SCSI detection) --- perl-install/c/stuff.xs.pm | 8 ++++++++ perl-install/detect_devices.pm | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index 3fa08bc0a..14d9ddeb5 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -164,6 +164,14 @@ isBurner(fd) OUTPUT: RETVAL +int +isDvdDrive(fd) + int fd + CODE: + RETVAL = ioctl(fd, CDROM_GET_CAPABILITY) & CDC_DVD; + OUTPUT: + RETVAL + unsigned int total_sectors(fd) int fd diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index c2be7e1e8..754870662 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -79,7 +79,16 @@ sub isBurner { $f && c::isBurner(fileno($f)); } } -sub isDvdDrive { $_[0]->{info} =~ /DVD/ } +sub isDvdDrive { + my ($dev) = @_; + if (my ($nb) = $dev =~ /scd (.*)/x) { + # can't detect SCSI DVD + undef; + } else { + my $f = tryOpen($dev); + $f && c::isDvdDrive(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/ } -- cgit v1.2.1