summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-07-10 13:48:27 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-07-10 13:48:27 +0000
commit0a1e47b9ce1698ea3c728ec7f3ea9909365674d4 (patch)
tree74dd78dfefe5b070c0e1839082a8b70680628e64 /perl-install/detect_devices.pm
parent1a435f331d81ed6d1a62c3d46de606ec44f8adc5 (diff)
downloaddrakx-backup-do-not-use-0a1e47b9ce1698ea3c728ec7f3ea9909365674d4.tar
drakx-backup-do-not-use-0a1e47b9ce1698ea3c728ec7f3ea9909365674d4.tar.gz
drakx-backup-do-not-use-0a1e47b9ce1698ea3c728ec7f3ea9909365674d4.tar.bz2
drakx-backup-do-not-use-0a1e47b9ce1698ea3c728ec7f3ea9909365674d4.tar.xz
drakx-backup-do-not-use-0a1e47b9ce1698ea3c728ec7f3ea9909365674d4.zip
enhance cohenrency: step 1
- ide and scsi devices use channel rather than bus to store their physical connection, which is more logic (at least for eide) - all devices have their connection bus in bus field, not in bus for {pci,usb,...} and interface_type for {scsi,eide,other_block_devices} - detect_devices:getIDE() : add eide_hds hash in order to be able to split info field between model and vendor - harddrake::ui : code reduction allowed by the above changes
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm56
1 files changed, 47 insertions, 9 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 1f545520e..25b98b244 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -48,7 +48,7 @@ sub zips { map { $_->{device} .= 4; $_ } raw_zips() }
sub cdroms__faking_ide_scsi {
my @l = cdroms();
return @l if $::isStandalone;
- if (my @l_ide = grep { $_->{interface_type} eq 'ide' && isBurner($_) } @l) {
+ if (my @l_ide = grep { $_->{bus} eq 'ide' && isBurner($_) } @l) {
require modules;
modules::add_alias('scsi_hostadapter', 'ide-scsi');
my $nb = 1 + max(-1, map { $_->{device} =~ /scd(\d+)/ } @l);
@@ -61,7 +61,7 @@ sub cdroms__faking_ide_scsi {
}
sub zips__faking_ide_scsi {
my @l = raw_zips();
- if (my @l_ide = grep { $_->{interface_type} eq 'ide' && $::isInstall } @l) {
+ if (my @l_ide = grep { $_->{bus} eq 'ide' && $::isInstall } @l) {
require modules;
modules::add_alias('scsi_hostadapter', 'ide-scsi');
my $nb = 1 + max(-1, map { if_($_->{device} =~ /sd(\w+)/, ord($1) - ord('a')) } getSCSI());
@@ -158,7 +158,7 @@ sub getSCSI() {
my ($id) = /^Host:.*?Id: (\d+)/ or $err->($_);
my ($vendor, $model) = /^\s*Vendor:\s*(.*?)\s+Model:\s*(.*?)\s+Rev:/m or $err->($_);
my ($type) = /^\s*Type:\s*(.*)/m or $err->($_);
- { info => "$vendor $model", id => $id, bus => 0, device => "sg$::i", raw_type => $type };
+ { info => "$vendor $model", id => $id, channel => 0, device => "sg$::i", raw_type => $type };
} @l;
each_index {
@@ -179,8 +179,37 @@ sub getSCSI() {
} grep { $_->{raw_type} =~ /Scanner/ } @l;
get_sys_cdrom_info(@l);
- @l;
-}
+ map {$_->{bus} = 'SCSI' } @l;
+}
+
+my %eide_hds =
+ (
+ "ASUS " => "Asus",
+ "CD-ROM CDU" => "Sony",
+ "CD-ROM Drive/F5D" => "ASUSTeK",
+ "Compaq" => "Compaq",
+ "CONNER" => "Conner Peripherals",
+ "IBM-" => "IBM",
+ "FUJITSU" => "Fujitsu",
+ "HITACHI" => "Hitachi",
+ "Lite-On" => "Lite-On Technology Corp.",
+ "LTN" => "Lite-On Technology Corp.",
+ "IOMEGA " => "Iomega",
+ "MAXTOR " => "Maxtor",
+ "Maxtor " => "Maxtor",
+ "Micropolis" => "Micropolis",
+ "PLEXTOR" => "Plextor",
+ "QUANTUM" => "Quantum",
+ "SAMSUNG" => "Samsung",
+ "Seagate " => "Seagate Technology",
+ "ST3" => "Seagate Technology",
+ "TEAC" => "Teac",
+ "TOSHIBA" => "Toshiba",
+ "TEAC" => "Teac",
+ "TOSHIBA" => "Toshiba",
+ "WDC" => "Western Digital Corp.",
+ );
+
sub getIDE() {
my @idi;
@@ -196,7 +225,16 @@ sub getIDE() {
my $info = chomp_(cat_("$d/model")) || "(none)";
my $num = ord (($d =~ /(.)$/)[0]) - ord 'a';
- push @idi, { media_type => $type, device => basename($d), info => $info, bus => $num/2, id => $num%2, interface_type => 'ide' };
+ my ($vendor, $model);
+ foreach my $hd (keys %eide_hds) {
+ if ($info =~ /^$hd/) {
+ $vendor = $eide_hds{$hd};
+ $model = $info;
+ $model =~ s/^$hd//;
+ last;
+ }
+ }
+ push @idi, { media_type => $type, device => basename($d), info => $info, channel => $num/2, id => $num%2, bus => 'ide', Vendor => $vendor, Model => $model };
}
get_sys_cdrom_info(@idi);
@idi;
@@ -213,7 +251,7 @@ sub getCompaqSmartArray() {
for (my $i = 0; -r ($f = "${prefix}$i"); $i++) {
foreach (cat_($f)) {
if (m|^\s*($name/.*?):|) {
- push @idi, { device => $1, info => "Compaq RAID logical disk", media_type => 'hd', interface_type => 'ida' };
+ push @idi, { device => $1, info => "Compaq RAID logical disk", media_type => 'hd', bus => 'ida' };
}
}
}
@@ -228,7 +266,7 @@ sub getDAC960() {
#- /dev/rd/c0d0: RAID-7, Online, 17928192 blocks, Write Thru0123456790123456789012
foreach (syslog()) {
my ($device, $info) = m|/dev/(rd/.*?): (.*?),| or next;
- $idi{$device} = { info => $info, media_type => 'hd', device => $device, interface_type => 'dac960' };
+ $idi{$device} = { info => $info, media_type => 'hd', device => $device, bus => 'dac960' };
}
values %idi;
}
@@ -237,7 +275,7 @@ sub getATARAID {
my %l;
foreach (syslog()) {
my ($device) = m|^\s*(ataraid/d\d+):| or next;
- $l{$device} = { info => 'ATARAID block device', media_type => 'hd', device => $device, interface_type => 'ataraid' };
+ $l{$device} = { info => 'ATARAID block device', media_type => 'hd', device => $device, bus => 'ataraid' };
log::l("ATARAID: $device");
}
values %l;