sensors-detect-stat.pl: Handle alternative chip lists.

Ultimately this script should be folded into sensors-detect.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4971 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-10-21 13:58:27 +00:00
1 parent 3d9acfa6f9
commit a3be2931c6
2 files changed
+16 -2

No files matched your search

+1
View File
@@ -5,6 +5,7 @@ SVN HEAD
sensord: Reload config on SIGHUP rather than automatically
sensors-detect: Fix SMSC LPC47B357/M967 detection
Select the right driver for FSC chips
sensors-detect-stat.pl: Handle alternative chip lists
3.0.0-rc2 (2007-10-10)
useful_addresses.html: Moved to the wiki
+15 -2
View File
@@ -3,7 +3,7 @@
# sensors-detect-stat.pl
# Statistical analysis of sensors-detect i2c addresses scanner
# Part of the lm_sensors project
# Copyright (C) 2003-2004 Jean Delvare <khali@linux-fr.org>
# Copyright (C) 2003-2007 Jean Delvare <khali@linux-fr.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use strict;
use vars qw(%histo $chips $file);
use vars qw(%histo $chips $file $skip);
# Where is sensors-detect?
# Use first argument, else try default locations.
@@ -51,8 +51,21 @@ if (! -r $file)
# Get the data.
open (SD, $file) || die;
$skip = 0;
while (<SD>)
{
# Some chips are handled differently depending on the kernel
# version, avoid counting them twice.
if (m/^\@chip_kern24_ids\s*=/ || m/^\@chip_oldfsc_ids\s*=/) {
$skip = 1;
next;
}
if ($skip && m/^\);$/) {
$skip = 0;
next;
}
next if $skip;
# The regular expression may seem a little bit complex, but we wouldn't
# want to exec malicious code.
next unless m/^\s*i2c_addrs\s*=>\s*(\[( *0x[\dA-Fa-f]{2}( *\.\. *0x[\dA-Fa-f]{2})? *,?)+\])\s*,/;