summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-02-03 16:08:21 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-02-03 16:08:21 +0000
commitd05a0d60e48a6307e802b63d3f91484b70758775 (patch)
treea21e7e48159440618ba8af5b0e752b4b223287ca /perl-install/detect_devices.pm
parente1d7d13d8807b1a404afcaf90c7686c1fcbca2c2 (diff)
downloaddrakx-d05a0d60e48a6307e802b63d3f91484b70758775.tar
drakx-d05a0d60e48a6307e802b63d3f91484b70758775.tar.gz
drakx-d05a0d60e48a6307e802b63d3f91484b70758775.tar.bz2
drakx-d05a0d60e48a6307e802b63d3f91484b70758775.tar.xz
drakx-d05a0d60e48a6307e802b63d3f91484b70758775.zip
- fix dmidecode_category() (returning a list)
- c::dmiDetectMemory() was in smp-dmi.c which is dropped, creating dmi_detect_memory instead
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm16
1 files changed, 14 insertions, 2 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 3ab051fc3..1f797fccf 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -925,10 +925,22 @@ sub dmidecode() {
}
sub dmidecode_category {
my ($cat) = @_;
- my @l = find { $_->{name} eq $cat } dmidecode();
+ my @l = grep { $_->{name} eq $cat } dmidecode();
wantarray() ? @l : $l[0] || {};
}
+#- size in MB
+sub dmi_detect_memory() {
+ my @l1 = map { $_->{'Enabled Size'} =~ /(\d+) MB/ && $1 } dmidecode_category('Memory Module');
+ my @l2 = map { $_->{'Form Factor'} =~ /^(SIMM|SIP|DIP|DIMM|RIMM|SODIMM|SRIMM)$/ &&
+ ($_->{Size} =~ /(\d+) MB/ && $1 || $_->{Size} =~ /(\d+) kB/ && $1 * 1024)
+ } dmidecode_category('Memory Device');
+ my $s1 = join(' ', grep {$_} @l1);
+ my $s2 = join(' ', grep {$_} @l2);
+ warn "$s1 <|> $s2\n" if $s1 && $s2 && $s1 ne $s2;
+ max(sum(@l1), sum(@l2))
+}
+
sub computer_info() {
my $Chassis = dmidecode_category('Chassis')->{Type} =~ /(\S+)/ && $1;
@@ -956,7 +968,7 @@ sub isLaptop() {
}
sub BIGMEM() {
- arch() !~ /x86_64|ia64/ && $> == 0 && c::dmiDetectMemory() > 4 * 1024;
+ arch() !~ /x86_64|ia64/ && $> == 0 && dmi_detect_memory() > 4 * 1024;
}
sub is_i586() {