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>

index | next in thread | raw e-mail

[-- Attachment #1 --]
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

[-- Attachment #2 --]
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,

[-- Attachment #3 --]

home | help

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