Intergrating lm_sensors support into hal

Hans de Goede j.w.r.degoede at hhs.nl
Wed Aug 31 05:33:08 PDT 2005


Hi,

After wrestling a couple of times with lm_sensors, I came to the 
conclusion that it might be a good idea to create some kinda plug and 
play support for lm_sensors.

The idea is to:
-get motherboard info from dmidecode
-search for lm_sensors config for this mainboard in a database
-write out config to /etc/sensors.conf and /etc/sysconfig/lm_sensors

I didn't want to start yet another auto hw config app / project . So I 
decided that it might be a good idea to add this to hal.

After some studying this seems doable. Currently I have a simple patch 
which adds the motherboard (baseboard) info to the "Computer" node of 
the device tree, see attachment.

The next step I planned was to add fdi files which when they 
successfully matched an mb would add other devices to the tree, but that 
doesn't seem possible from an fdi.

So now I have 3 questions:
1) Do you think that the above is a good idea?
2) Is hal a good place to add this functionality too
3) Where do I go from now?
   My idea/ understanding of question 3:
  -add a callout program which gets executed when "Computer" is done
   probing
  -this program will then read the database of motherboards and load
   appropiate modules or generate config and let the lm_sensors
   init script load modules
  -modules generate hotplugs which i need to write another piece of
   software to catch and generate device tree nodes based on the
   hotplugs, here fdi's can be used for info not available from the
   hotplug event.

Thanks & Regards,

Hans


-------------- next part --------------
--- hal-0.5.3/hald/linux2/probing/probe-smbios.c.hdg	2005-04-08 20:10:20.000000000 +0200
+++ hal-0.5.3/hald/linux2/probing/probe-smbios.c	2005-08-31 13:29:39.000000000 +0200
@@ -42,7 +42,8 @@
 #define DMIPARSER_STATE_IGNORE 0
 #define DMIPARSER_STATE_BIOS 1
 #define DMIPARSER_STATE_SYSTEM 2
-#define DMIPARSER_STATE_CHASSIS 3
+#define DMIPARSER_STATE_BASE_BOARD 3
+#define DMIPARSER_STATE_CHASSIS 4
 
 #define strbegin(buf, str) (strncmp (buf, str, sizeof (str) - 1) == 0)
 
@@ -73,6 +74,7 @@
 	/* on some system chassis pops up several times; so only take the first entry for each */
 	int dmiparser_done_bios = FALSE;
 	int dmiparser_done_system = FALSE;
+	int dmiparser_done_base_board = FALSE;
 	int dmiparser_done_chassis = FALSE;
 
 	/* assume failure */
@@ -145,6 +147,9 @@
 			} else if (strbegin (buf, "\tSystem Information")) {
 				if (!dmiparser_done_system)
 					dmiparser_state = DMIPARSER_STATE_SYSTEM;
+			} else if (strbegin (buf, "\tBase Board Information")) {
+				if (!dmiparser_done_base_board)
+					dmiparser_state = DMIPARSER_STATE_BASE_BOARD;
 			} else if (strbegin (buf, "\tChassis Information")) {
 				if (!dmiparser_done_chassis)
 					dmiparser_state = DMIPARSER_STATE_CHASSIS;
@@ -167,6 +172,14 @@
 			dmiparser_done_system = TRUE;
 			break;
 
+		case DMIPARSER_STATE_BASE_BOARD:
+			setstr (buf, "\t\tManufacturer:", "smbios.base_board.manufacturer");
+			setstr (buf, "\t\tProduct Name:", "smbios.base_board.product");
+			setstr (buf, "\t\tVersion:", "smbios.base_board.version");
+			setstr (buf, "\t\tSerial Number:", "smbios.base_board.serial");
+			dmiparser_done_base_board = TRUE;
+			break;
+
 		case DMIPARSER_STATE_CHASSIS:
 			setstr (buf, "\t\tManufacturer:", "smbios.chassis.manufacturer");
 			setstr (buf, "\t\tType:", "smbios.chassis.type");


More information about the hal mailing list