Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2011 22:36:50 -0500
From:      Justin Hibbits <chmeeedalf@gmail.com>
To:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Cc:        Andreas Tobler <andreast@fgznet.ch>
Subject:   fix for sysctl of DS1775 on MDD
Message-ID:  <DF581F3E-FA9B-427C-931C-5975AE959E74@gmail.com>

next in thread | raw e-mail | index | archive | help

--Apple-Mail-8-988914148
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed;
	delsp=yes
Content-Transfer-Encoding: 7bit

Just recompiled my kernel with the ds1775 sensor for my MDD, and  
noticed the sensor name sysctl is blank (shows up as 'dev.ds1775.0.',  
no sensor name), because there is no hwsensor-location property for  
the MDD sensor.  Attached is a patch that adds a generic 'cpu' name.   
Feel free to adjust it as you see fit (checking OF_getprop return  
instead, etc).

- Justin

--Apple-Mail-8-988914148
Content-Disposition: attachment;
	filename=ds1775_mdd.diff
Content-Type: application/octet-stream; x-unix-mode=0644;
	name="ds1775_mdd.diff"
Content-Transfer-Encoding: 7bit

Index: ds1775.c
===================================================================
--- ds1775.c	(revision 217356)
+++ ds1775.c	(working copy)
@@ -194,12 +194,17 @@
 		   sizeof(sens->location));
 	units = "C";
 
-	for (i = 0; i < strlen(sens->location); i++) {
-		sysctl_name[i] = tolower(sens->location[i]);
-		if (isspace(sysctl_name[i]))
-			sysctl_name[i] = '_';
+	if (sens->location[0] == 0) {
+		strcpy(sysctl_name, "cpu");
 	}
-	sysctl_name[i] = 0;
+	else {
+		for (i = 0; i < strlen(sens->location); i++) {
+			sysctl_name[i] = tolower(sens->location[i]);
+			if (isspace(sysctl_name[i]))
+				sysctl_name[i] = '_';
+		}
+		sysctl_name[i] = 0;
+	}
 
 	sprintf(sysctl_desc,"%s (%s)", sens->location, units);
 	SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO,

--Apple-Mail-8-988914148
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed
Content-Transfer-Encoding: 7bit



--Apple-Mail-8-988914148--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DF581F3E-FA9B-427C-931C-5975AE959E74>