View | Details | Raw Unified | Return to bug 244696
Collapse All | Expand All

(-)sysutils/i2c-tools/Makefile (-5 / +3 lines)
Lines 2-20 Link Here
2
# $FreeBSD: head/sysutils/i2c-tools/Makefile 516897 2019-11-06 16:26:34Z antoine $
2
# $FreeBSD: head/sysutils/i2c-tools/Makefile 516897 2019-11-06 16:26:34Z antoine $
3
3
4
PORTNAME=	i2c-tools
4
PORTNAME=	i2c-tools
5
PORTVERSION=	3.1.1
5
PORTVERSION=	4.1
6
CATEGORIES=	sysutils
6
CATEGORIES=	sysutils
7
MASTER_SITES=	http://dl.lm-sensors.org/i2c-tools/releases/
7
MASTER_SITES=	https://mirrors.edge.kernel.org/pub/software/utils/i2c-tools/
8
8
9
MAINTAINER=	avg@FreeBSD.org
9
MAINTAINER=	avg@FreeBSD.org
10
COMMENT=	Heterogeneous set of I2C tools
10
COMMENT=	Heterogeneous set of I2C tools
11
11
12
BROKEN=		unfetchable
13
14
LICENSE=	GPLv2
12
LICENSE=	GPLv2
15
13
16
NO_BUILD=	yes
14
NO_BUILD=	yes
17
USES=		perl5 shebangfix tar:bzip2
15
USES=		perl5 shebangfix tar:xz
18
USE_PERL5=	run
16
USE_PERL5=	run
19
17
20
PLIST_FILES=	man/man1/decode-dimms.1.gz sbin/decode-dimms
18
PLIST_FILES=	man/man1/decode-dimms.1.gz sbin/decode-dimms
(-)sysutils/i2c-tools/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (i2c-tools-3.1.1.tar.bz2) = 14d4d7d60d1c12e43f2befe239c682a5c44c27682f153d4b58c1e392d2db1700
1
TIMESTAMP = 1583760086
2
SIZE (i2c-tools-3.1.1.tar.bz2) = 71789
2
SHA256 (i2c-tools-4.1.tar.xz) = 57b219efd183795bd545dd5a60d9eabbe9dcb6f8fb92bc7ba2122b87f98527d5
3
SIZE (i2c-tools-4.1.tar.xz) = 83576
(-)sysutils/i2c-tools/files/patch-eeprom_decode-dimms (-51 / +30 lines)
Lines 1-6 Link Here
1
--- eeprom/decode-dimms.orig	2014-06-19 15:50:29.000000000 -0400
1
--- eeprom/decode-dimms.orig	2020-03-09 13:44:20 UTC
2
+++ eeprom/decode-dimms	2014-06-19 16:18:34.000000000 -0400
2
+++ eeprom/decode-dimms
3
@@ -42,7 +42,7 @@
3
@@ -42,7 +42,7 @@ use POSIX qw(ceil);
4
 use Fcntl qw(:DEFAULT :seek);
4
 use Fcntl qw(:DEFAULT :seek);
5
 use File::Basename;
5
 use File::Basename;
6
 use vars qw($opt_html $opt_bodyonly $opt_side_by_side $opt_merge
6
 use vars qw($opt_html $opt_bodyonly $opt_side_by_side $opt_merge
Lines 9-16 Link Here
9
 	    @vendors %decode_callback $revision @dimm $current %hexdump_cache);
9
 	    @vendors %decode_callback $revision @dimm $current %hexdump_cache);
10
 
10
 
11
 use constant LITTLEENDIAN	=> "little-endian";
11
 use constant LITTLEENDIAN	=> "little-endian";
12
@@ -305,7 +305,7 @@
12
@@ -418,7 +418,7 @@ $revision =~ s/ \([^()]*\)//;
13
  "Silicon Space Technology"]
13
  "Thermaltake Technology Co Ltd", "Shenzhen O'Yang Maile Technology Ltd", "UPMEM"]
14
 );
14
 );
15
 
15
 
16
-$use_sysfs = -d '/sys/bus';
16
-$use_sysfs = -d '/sys/bus';
Lines 18-24 Link Here
18
 
18
 
19
 # We consider that no data was written to this area of the SPD EEPROM if
19
 # We consider that no data was written to this area of the SPD EEPROM if
20
 # all bytes read 0x00 or all bytes read 0xff
20
 # all bytes read 0x00 or all bytes read 0xff
21
@@ -1079,6 +1079,9 @@
21
@@ -1329,6 +1329,9 @@ sub decode_ddr2_sdram($)
22
 	printl("Module Configuration Type",
22
 	printl("Module Configuration Type",
23
 	       sdram_module_configuration_type($bytes->[11]));
23
 	       sdram_module_configuration_type($bytes->[11]));
24
 
24
 
Lines 28-46 Link Here
28
 	printl("Refresh Rate", ddr2_refresh_rate($bytes->[12]));
28
 	printl("Refresh Rate", ddr2_refresh_rate($bytes->[12]));
29
 
29
 
30
 	my @burst;
30
 	my @burst;
31
@@ -1289,8 +1292,9 @@
31
@@ -2330,6 +2333,28 @@ sub spd_sizes($)
32
 	printl("DLL-Off Mode supported?", ($bytes->[30] & 128) ? "Yes" : "No");
33
 	printl("Operating temperature range", sprintf "0-%d degrees C",
34
 		($bytes->[31] & 1) ? 95 : 85);
35
-	printl("Refresh Rate in extended temp range",
36
-		($bytes->[31] & 2) ? "2X" : "1X");
37
+	printl_cond($bytes->[31] & 1,
38
+		    "Refresh Rate in extended temp range",
39
+		    ($bytes->[31] & 2) ? "1X" : "2X");
40
 	printl("Auto Self-Refresh?", ($bytes->[31] & 4) ? "Yes" : "No");
41
 	printl("On-Die Thermal Sensor readout?",
42
 		($bytes->[31] & 8) ? "Yes" : "No");
43
@@ -1624,6 +1628,28 @@
44
 	}
32
 	}
45
 }
33
 }
46
 
34
 
Lines 69-75 Link Here
69
 # Read bytes from SPD-EEPROM
57
 # Read bytes from SPD-EEPROM
70
 # Note: offset must be a multiple of 16!
58
 # Note: offset must be a multiple of 16!
71
 sub readspd($$$)
59
 sub readspd($$$)
72
@@ -1633,22 +1659,14 @@
60
@@ -2339,22 +2364,14 @@ sub readspd($$$)
73
 	if ($use_hexdump) {
61
 	if ($use_hexdump) {
74
 		@bytes = read_hexdump($dimm_i);
62
 		@bytes = read_hexdump($dimm_i);
75
 		return @bytes[$offset..($offset + $size - 1)];
63
 		return @bytes[$offset..($offset + $size - 1)];
Lines 99-105 Link Here
99
 		}
87
 		}
100
 	}
88
 	}
101
 	return @bytes;
89
 	return @bytes;
102
@@ -1702,7 +1720,7 @@
90
@@ -2415,7 +2432,7 @@ sub check_crc($)
103
 # Parse command-line
91
 # Parse command-line
104
 foreach (@ARGV) {
92
 foreach (@ARGV) {
105
 	if ($_ eq '-h' || $_ eq '--help') {
93
 	if ($_ eq '-h' || $_ eq '--help') {
Lines 108-122 Link Here
108
 			"       $0 -h\n\n",
96
 			"       $0 -h\n\n",
109
 			"  -f, --format            Print nice html output\n",
97
 			"  -f, --format            Print nice html output\n",
110
 			"  -b, --bodyonly          Don't print html header\n",
98
 			"  -b, --bodyonly          Don't print html header\n",
111
@@ -1711,6 +1729,7 @@
99
@@ -2426,6 +2443,7 @@ foreach (@ARGV) {
112
 			"      --merge-cells       Merge neighbour cells with identical values\n",
100
 			"      --no-merge-cells    Don't merge neighbour cells with identical values\n",
113
 			"                          (side-by-side output only)\n",
101
 			"                          (side-by-side output only)\n",
114
 			"  -c, --checksum          Decode completely even if checksum fails\n",
102
 			"  -c, --checksum          Decode completely even if checksum fails\n",
115
+			"  -d,                     Read data from the device\n",
103
+			"  -d,                     Read data from the device\n",
116
 			"  -x,                     Read data from hexdump files\n",
104
 			"  -x,                     Read data from hexdump files\n",
117
 			"  -X,                     Same as -x except treat multibyte hex\n",
105
 			"  -X,                     Same as -x except treat multibyte hex\n",
118
 			"                          data as little endian\n",
106
 			"                          data as little endian\n",
119
@@ -1746,6 +1765,10 @@
107
@@ -2465,6 +2483,10 @@ EOF
120
 		$opt_igncheck = 1;
108
 		$opt_igncheck = 1;
121
 		next;
109
 		next;
122
 	}
110
 	}
Lines 127-156 Link Here
127
 	if ($_ eq '-x') {
115
 	if ($_ eq '-x') {
128
 		$use_hexdump = BIGENDIAN;
116
 		$use_hexdump = BIGENDIAN;
129
 		next;
117
 		next;
130
@@ -1760,7 +1783,11 @@
118
@@ -2479,7 +2501,11 @@ EOF
131
 		exit;
119
 		exit;
132
 	}
120
 	}
133
 
121
 
134
-	push @dimm, { eeprom => basename($_), file => $_ } if $use_hexdump;
135
+	if ($opt_smbdev) {
122
+	if ($opt_smbdev) {
136
+		$use_smbdev = $_;
123
+		$use_smbdev = $_;
137
+	} else {
124
+	} else {
138
+		push @dimm, { eeprom => basename($_), file => $_ } if $use_hexdump;
125
 	push @dimm, { eeprom => basename($_), file => $_ } if $use_hexdump;
139
+	}
126
+	}
140
 }
127
 }
141
 
128
 
142
 if ($opt_html && !$opt_bodyonly) {
129
 # Default values
143
@@ -1777,61 +1804,20 @@
130
@@ -2487,63 +2513,21 @@ $opt_merge = 1 unless defined $opt_merge;
144
 Jean Delvare, Trent Piepho and others');
145
 
131
 
146
 
132
 # From a sysfs device path and an attribute name, return the attribute
147
-# From a sysfs device path and an attribute name, return the attribute
133
 # value, or undef (stolen from sensors-detect)
148
-# value, or undef (stolen from sensors-detect)
149
-sub sysfs_device_attribute
134
-sub sysfs_device_attribute
150
-{
135
-{
151
-	my ($device, $attr) = @_;
136
-	my ($device, $attr) = @_;
152
-	my $value;
137
-	my $value;
153
-
138
 
154
-	open(local *FILE, "$device/$attr") or return "";
139
-	open(local *FILE, "$device/$attr") or return "";
155
-	$value = <FILE>;
140
-	$value = <FILE>;
156
-	close(FILE);
141
-	close(FILE);
Lines 165-171 Link Here
165
-	my (@dirs, $dir, $opened, $file, @files);
150
-	my (@dirs, $dir, $opened, $file, @files);
166
-
151
-
167
-	if ($use_sysfs) {
152
-	if ($use_sysfs) {
168
-		@dirs = ('/sys/bus/i2c/drivers/eeprom', '/sys/bus/i2c/drivers/at24');
153
-		@dirs = ('/sys/bus/i2c/drivers/eeprom',
154
-			 '/sys/bus/i2c/drivers/at24',
155
-			 '/sys/bus/i2c/drivers/ee1004');	# DDR4
169
-	} else {
156
-	} else {
170
-		@dirs = ('/proc/sys/dev/sensors');
157
-		@dirs = ('/proc/sys/dev/sensors');
171
-	}
158
-	}
Lines 183-189 Link Here
183
-				# or spd (driver at24)
170
-				# or spd (driver at24)
184
-				my $attr = sysfs_device_attribute("$dir/$file", "name");
171
-				my $attr = sysfs_device_attribute("$dir/$file", "name");
185
-				next unless defined $attr &&
172
-				next unless defined $attr &&
186
-					    ($attr eq "eeprom" || $attr eq "spd");
173
-					    ($attr eq "eeprom" ||
174
-					     $attr eq "spd" ||
175
-					     $attr eq "ee1004");	# DDR4
187
-			} else {
176
-			} else {
188
-				next unless $file =~ /^eeprom-/;
177
-				next unless $file =~ /^eeprom-/;
189
-			}
178
-			}
Lines 195-224 Link Here
195
-
184
-
196
-	if (!$opened) {
185
-	if (!$opened) {
197
-		print STDERR "No EEPROM found, try loading the eeprom or at24 module\n";
186
-		print STDERR "No EEPROM found, try loading the eeprom or at24 module\n";
198
-		exit;
199
+	my @dimms;
187
+	my @dimms;
200
+	if (! -c $use_smbdev) {
188
+	if (! -c $use_smbdev) {
201
+        	print "SMBus device not found\n";
189
+        	print "SMBus device not found\n";
202
+	        exit;
190
 		exit;
203
+	}
191
 	}
192
-
193
-	return sort { $a->{file} cmp $b->{file} } @files;
204
+	for my $spd (0xA0 .. 0xAE) {
194
+	for my $spd (0xA0 .. 0xAE) {
205
+		next if ($spd % 2 != 0);
195
+		next if ($spd % 2 != 0);
206
+		my @test_bytes = readspd(0, 4, $spd);
196
+		my @test_bytes = readspd(0, 4, $spd);
207
+		next unless spd_written(@test_bytes);
197
+		next unless spd_written(@test_bytes);
208
+		push @dimms, { eeprom => sprintf('0x%02X', $spd), file => $spd };
198
+		push @dimms, { eeprom => sprintf('0x%02X', $spd), file => $spd };
209
 	}
199
+	}
210
-
211
-	return sort { $a->{file} cmp $b->{file} } @files;
212
+	return @dimms;
200
+	return @dimms;
213
 }
201
 }
214
 
202
 
215
 # @dimm is a list of hashes. There's one hash for each EEPROM we found.
203
 # @dimm is a list of hashes. There's one hash for each EEPROM we found.
216
@@ -2022,7 +2008,7 @@
217
 		print "\n\n";
218
 	} else {
219
 		print "<b><u>" if $opt_html;
220
-		printl2("\n\nDecoding EEPROM", $dimm[$current]->{file});
221
+		printl2("\n\nDecoding EEPROM", $dimm[$current]->{eeprom});
222
 		print "</u></b>" if $opt_html;
223
 	}
224
 	print "<table border=1>\n" if $opt_html;
(-)sysutils/i2c-tools/files/patch-eeprom_decode-dimms.1 (-7 / +7 lines)
Lines 1-6 Link Here
1
--- eeprom/decode-dimms.1.orig	2014-02-20 04:59:56.488360000 -0500
1
--- eeprom/decode-dimms.1.orig	2018-11-30 14:15:21 UTC
2
+++ eeprom/decode-dimms.1	2014-06-19 16:20:15.000000000 -0400
2
+++ eeprom/decode-dimms.1
3
@@ -21,7 +21,7 @@
3
@@ -22,7 +22,7 @@
4
 decode-dimms \- decode the information found in memory module SPD EEPROMs
4
 decode-dimms \- decode the information found in memory module SPD EEPROMs
5
 .SH SYNOPSIS
5
 .SH SYNOPSIS
6
 .B decode-dimms
6
 .B decode-dimms
Lines 9-21 Link Here
9
 .br
9
 .br
10
 .B decode-dimms
10
 .B decode-dimms
11
 -h
11
 -h
12
@@ -53,6 +53,9 @@
12
@@ -53,6 +53,9 @@ Don't merge neighbour cells with identical values (sid
13
 .TP
13
 .B \-c, --checksum
14
 .B \-c, --checksum
14
 Decode completely even if checksum fails
15
 Decode completely even if checksum fails
15
 .TP
16
+.TP
16
+.B \-d
17
+.B \-d
17
+Read data from the device
18
+Read data from the device
18
+.TP
19
 .TP
19
 .B \-x
20
 .B \-x
20
 Read data from hexdump files
21
 Read data from hexdump files
21
 .TP

Return to bug 244696