From 091b6bef31170f0a00d21ae6b07a8ba041bbc41b Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 6 Jun 2001 08:11:36 +0000 Subject: fixed burner and dvd drive detection ;-) c::isBurner seems to detect both IDE and SCSI drive and description does not necessary contains CDRW substring (for info). c::isDvdDrive is unable to detect SCSI drive (at least one tested) but DVD substring is quite nicely well represented, and there is few DVD drive available as SCSI (pionneer?) --- perl-install/detect_devices.pm | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 754870662..ab4488f45 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -49,8 +49,8 @@ sub cdroms() { } @l; } -sub burners { grep { $_->{type} eq 'cdrom' && isBurner($_->{device}) } get() } -sub IDEburners { grep { $_->{type} eq 'cdrom' && isBurner($_->{device}) } getIDE() } +sub burners { grep { $_->{type} eq 'cdrom' && isBurner($_) } get() } +sub IDEburners { grep { $_->{type} eq 'cdrom' && isBurner($_) } getIDE() } sub dvdroms { grep { $_->{type} eq 'cdrom' && isDvdDrive($_) } get() } sub get_mac_model() { @@ -71,23 +71,13 @@ sub floppy { first(floppies()) } #- example ls120, model = "LS-120 SLIM 02 UHD Floppy" sub isBurner { - my ($dev) = @_; - if (my ($nb) = $dev =~ /scd (.*)/x) { - grep { /^(scd|sr)$nb:.*writer/ } syslog(); - } else { - my $f = tryOpen($dev); - $f && c::isBurner(fileno($f)); - } + my $f = tryOpen($_[0]{device}); #- SCSI burner seems to be detected this way. + $f && c::isBurner(fileno($f)); } -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 isDvdDrive { + $_[0]{info} =~ /DVD/; #- SCSI DVD seems not to be detected correctly, so use another probe after. + my $f = tryOpen($_[0]{device}); + $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. -- cgit v1.2.1