Changeset 5929
- Timestamp:
- 02/16/11 14:58:38 (15 months ago)
- Location:
- i2c-tools/trunk
- Files:
-
- 2 modified
-
CHANGES (modified) (1 diff)
-
eeprom/decode-dimms (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
i2c-tools/trunk/CHANGES
r5928 r5929 5 5 decode-dimms: Decode module configuration type of DDR SDRAM 6 6 Decode refresh rate of DDR SDRAM 7 Add support for the at24 kernel driver 7 8 i2c-dev.h: Make value arrays const for block write functions 8 9 i2cset: Add support for SMBus and I2C block writes -
i2c-tools/trunk/eeprom/decode-dimms
r5928 r5929 6 6 # modified by Christian Zuckschwerdt <zany@triq.net> 7 7 # modified by Burkart Lingner <burkart@bollchen.de> 8 # Copyright (C) 2005-20 09Jean Delvare <khali@linux-fr.org>8 # Copyright (C) 2005-2011 Jean Delvare <khali@linux-fr.org> 9 9 # 10 10 # This program is free software; you can redistribute it and/or modify … … 1711 1711 1712 1712 1713 # From a sysfs device path and an attribute name, return the attribute 1714 # value, or undef (stolen from sensors-detect) 1715 sub sysfs_device_attribute 1716 { 1717 my ($device, $attr) = @_; 1718 my $value; 1719 1720 open(local *FILE, "$device/$attr") or return ""; 1721 $value = <FILE>; 1722 close(FILE); 1723 return unless defined $value; 1724 1725 chomp($value); 1726 return $value; 1727 } 1728 1713 1729 sub get_dimm_list 1714 1730 { 1715 my ( $dir, $file, @files);1731 my (@dirs, $dir, $file, @files); 1716 1732 1717 1733 if ($use_sysfs) { 1718 $dir = '/sys/bus/i2c/drivers/eeprom';1734 @dirs = ('/sys/bus/i2c/drivers/eeprom', '/sys/bus/i2c/drivers/at24'); 1719 1735 } else { 1720 $dir = '/proc/sys/dev/sensors'; 1721 } 1722 1723 if (opendir(local *DIR, $dir)) { 1736 @dirs = ('/proc/sys/dev/sensors'); 1737 } 1738 1739 foreach $dir (@dirs) { 1740 next unless opendir(local *DIR, $dir); 1724 1741 while (defined($file = readdir(DIR))) { 1725 next if $use_sysfs && $file !~ /^\d+-[\da-f]+$/i; 1726 next if !$use_sysfs && $file !~ /^eeprom-/; 1742 if ($use_sysfs) { 1743 # We look for I2C devices like 0-0050 or 2-0051 1744 next unless $file =~ /^\d+-[\da-f]+$/i; 1745 next unless -d "$dir/$file"; 1746 1747 # Device name must be eeprom (driver eeprom) 1748 # or spd (driver at24) 1749 my $attr = sysfs_device_attribute("$dir/$file", "name"); 1750 next unless defined $attr && 1751 ($attr eq "eeprom" || $attr eq "spd"); 1752 } else { 1753 next unless $file =~ /^eeprom-/; 1754 } 1727 1755 push @files, { eeprom => "$file", 1728 1756 file => "$dir/$file" }; 1729 1757 } 1730 1758 close(DIR); 1759 } 1760 1761 if (@files) { 1731 1762 return sort { $a->{file} cmp $b->{file} } @files; 1732 1763 } elsif (! -d '/sys/module/eeprom') {
