[Pkg-utopia-commits] r1035 - in packages/unstable/hal/debian: . patches

Sjoerd Simons sjoerd at costa.debian.org
Wed Sep 27 15:45:57 UTC 2006


Author: sjoerd
Date: 2006-09-27 15:45:34 +0000 (Wed, 27 Sep 2006)
New Revision: 1035

Added:
   packages/unstable/hal/debian/patches/05_one_formfactor_fallback.patch
   packages/unstable/hal/debian/patches/06_smbios_return.patch
   packages/unstable/hal/debian/patches/07_ppc_suspend.patch
   packages/unstable/hal/debian/patches/08_openfirmware.patch
Modified:
   packages/unstable/hal/debian/changelog
Log:
* debian/patches/05_one_formfactor_fallback.patch
  - Added. Use one fallback to an unknown formfactor instead of three. Fixes
  bugs caused by falling back when not needed.  
* debian/patches/06_smbios_return.patch
  - Added. Only let the prober return success if it actually found some
  usefull info.
* debian/patches/07_ppc_suspend.patch
  - Added. pmu systems can suspend by using hal's own tool. So actually flag
  it as being able to suspend even though mem isn't in /sys/power/state
* debian/patches/08_openfirmware.patch
  - Added. Extra model and machine compatibility from openfirmware and
  use that info to detect the formfactor. 

Modified: packages/unstable/hal/debian/changelog
===================================================================
--- packages/unstable/hal/debian/changelog	2006-09-27 15:37:42 UTC (rev 1034)
+++ packages/unstable/hal/debian/changelog	2006-09-27 15:45:34 UTC (rev 1035)
@@ -42,8 +42,20 @@
   * debian/patches/04_cd_write.patch
     - Added. don't crash on cd drives without write capabilities (From
       upstream git)
+  * debian/patches/05_one_formfactor_fallback.patch
+    - Added. Use one fallback to an unknown formfactor instead of three. Fixes
+    bugs caused by falling back when not needed.  
+  * debian/patches/06_smbios_return.patch
+    - Added. Only let the prober return success if it actually found some
+    usefull info.
+  * debian/patches/07_ppc_suspend.patch
+    - Added. pmu systems can suspend by using hal's own tool. So actually flag
+    it as being able to suspend even though mem isn't in /sys/power/state
+  * debian/patches/08_openfirmware.patch
+    - Added. Extra model and machine compatibility from openfirmware and
+    use that info to detect the formfactor. 
 
- -- Sjoerd Simons <sjoerd at debian.org>  Wed, 27 Sep 2006 17:24:29 +0200
+ -- Sjoerd Simons <sjoerd at debian.org>  Wed, 27 Sep 2006 17:41:09 +0200
 
 hal (0.5.7.1-2) unstable; urgency=low
 

Added: packages/unstable/hal/debian/patches/05_one_formfactor_fallback.patch
===================================================================
--- packages/unstable/hal/debian/patches/05_one_formfactor_fallback.patch	                        (rev 0)
+++ packages/unstable/hal/debian/patches/05_one_formfactor_fallback.patch	2006-09-27 15:45:34 UTC (rev 1035)
@@ -0,0 +1,58 @@
+commit 80b89a74fe53fb036b5826fbea4ebec18d3378c8
+Author: Sjoerd Simons <sjoerd at luon.net>
+Date:   Sun Sep 17 22:26:24 2006 +0200
+
+    Set system.formfactor fallback in exactly one place instead of three and be
+    carefull not to override if already set. Fixes bug on macintosh powerpc
+    machines where the detected value was overriden by the fallback.
+
+diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
+index b9fb922..8aca683 100644
+--- a/hald/linux/osspec.c
++++ b/hald/linux/osspec.c
+@@ -346,6 +346,10 @@ hotplug_queue_now_empty (void)
+ static void
+ computer_probing_helper_done (HalDevice *d)
+ {
++	/* if not set, set a default value */
++	if (!hal_device_has_property (d, "system.formfactor")) {
++		hal_device_property_set_string (d, "system.formfactor", "unknown");
++	}
+ 	di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
+ 	di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
+ 
+@@ -363,9 +367,6 @@ computer_probing_pcbios_helper_done (Hal
+ 	const char *system_version;
+ 
+ 	if (exit_type == HALD_RUN_FAILED) {
+-		/* set a default value */
+-		if (!hal_device_has_property (d, "system.formfactor"))
+-			hal_device_property_set_string (d, "system.formfactor", "unknown");
+ 		goto out;
+ 	}
+ 
+@@ -433,10 +434,7 @@ computer_probing_pcbios_helper_done (Hal
+ 				}
+ 			}
+ 		       
+-		} else {
+-			/* set a default value */
+-			hal_device_property_set_string (d, "system.formfactor", "unknown");
+-		}
++		} 
+ 	}
+ out:
+ 	computer_probing_helper_done (d);
+@@ -554,11 +552,9 @@ osspec_probe (void)
+ 		hald_runner_run (root, "hald-probe-smbios", NULL, HAL_HELPER_TIMEOUT,
+         	                 computer_probing_pcbios_helper_done, NULL, NULL);
+ 	} else {
+-		/* set a default value, can be overridden by others */
+-		hal_device_property_set_string (root, "system.formfactor", "unknown");
+ 		/* no probing */
+ 		computer_probing_helper_done (root);
+-  	}
++	}
+ }
+ 
+ DBusHandlerResult

Added: packages/unstable/hal/debian/patches/06_smbios_return.patch
===================================================================
--- packages/unstable/hal/debian/patches/06_smbios_return.patch	                        (rev 0)
+++ packages/unstable/hal/debian/patches/06_smbios_return.patch	2006-09-27 15:45:34 UTC (rev 1035)
@@ -0,0 +1,41 @@
+commit 7b4b27aa607baf38d1e8d8b38d748cff2e5210e3
+Author: Sjoerd Simons <sjoerd at luon.net>
+Date:   Sun Sep 17 21:57:11 2006 +0200
+
+    Let probe-smbios only return successfully if it actually got something
+    usefull to parse
+
+diff --git a/hald/linux/probing/probe-smbios.c b/hald/linux/probing/probe-smbios.c
+index 2beb809..bb9ace3 100644
+--- a/hald/linux/probing/probe-smbios.c
++++ b/hald/linux/probing/probe-smbios.c
+@@ -140,7 +140,7 @@ main (int argc, char *argv[])
+ 		break;
+ 	case -1:
+ 		HAL_ERROR (("Cannot fork!"));
+-		break;
++		goto out;
+ 	}
+ 	
+ 	/* parent continues from here */
+@@ -199,6 +199,10 @@ main (int argc, char *argv[])
+ 		if (dmiparser_state == DMIPARSER_STATE_IGNORE)
+ 			continue;
+ 
++		/* return success only if there was something usefull to parse */
++		ret = 0;
++
++
+ 		/* removes the leading tab */
+ 		nbuf = &buf[1];
+ 
+@@ -228,9 +232,6 @@ main (int argc, char *argv[])
+ 	/* as read to EOF, close */
+ 	fclose (f);
+ 
+-	/* return success */
+-	ret = 0;
+-
+ out:
+ 	/* free ctx */
+ 	if (ctx != NULL) {

Added: packages/unstable/hal/debian/patches/07_ppc_suspend.patch
===================================================================
--- packages/unstable/hal/debian/patches/07_ppc_suspend.patch	                        (rev 0)
+++ packages/unstable/hal/debian/patches/07_ppc_suspend.patch	2006-09-27 15:45:34 UTC (rev 1035)
@@ -0,0 +1,24 @@
+commit 0a14231944a194b6bc31b737ff9b0dbec91edebc
+Author: Sjoerd Simons <sjoerd at luon.net>
+Date:   Sun Sep 17 20:25:25 2006 +0200
+
+    Always set power_management.can_suspend to true if the power_management.type is
+    pmu. Recent kernels don't report mem in /sys/power/state for ppc, but we have
+    our own utility that issues ioctl's to suspend.
+
+diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
+index ed762a8..b9fb922 100644
+--- a/hald/linux/osspec.c
++++ b/hald/linux/osspec.c
+@@ -475,6 +475,11 @@ set_suspend_hibernate_keys (HalDevice *d
+ 		can_hibernate = TRUE;
+ 	free (poweroptions);
+ 
++	if (!strcmp(hal_device_property_get_string(d, "power_management.type"), "pmu")) {
++		/* We got our own helper for suspend PMU machines */
++		can_suspend = TRUE;
++	}
++
+ 	/* check for the presence of suspend2 */
+ 	if (access ("/proc/software_suspend", F_OK) == 0)
+ 		can_hibernate = TRUE;

Added: packages/unstable/hal/debian/patches/08_openfirmware.patch
===================================================================
--- packages/unstable/hal/debian/patches/08_openfirmware.patch	                        (rev 0)
+++ packages/unstable/hal/debian/patches/08_openfirmware.patch	2006-09-27 15:45:34 UTC (rev 1035)
@@ -0,0 +1,107 @@
+commit b83f4c83f60e8cf5da52a10e2546fef20053d25c
+Author: Sjoerd Simons <sjoerd at luon.net>
+Date:   Tue Sep 26 22:42:50 2006 +0200
+
+    Read out model and compatible property out of openfirmware if possible. And use the openfirmware module property to decide what formfactor the system has.
+
+diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
+index 8aca683..a2a1998 100644
+--- a/hald/linux/osspec.c
++++ b/hald/linux/osspec.c
+@@ -496,6 +496,68 @@ out:
+ 	hal_device_property_set_bool (d, "power_management.can_suspend_to_disk", can_hibernate);
+ }
+ 
++static void
++get_openfirmware_entry(HalDevice *d, char *property, char *entry, 
++                       gboolean multivalue) {
++	char *contents;
++	gsize length;
++	if (!g_file_get_contents(entry, &contents, &length, NULL)) {
++		return;
++	}
++	if (multivalue) {
++		gsize offset = 0;
++		while (offset < length) { 
++			hal_device_property_strlist_append(d, property, contents + offset);
++			for (; offset < length - 1 && contents[offset] != '\0'; offset++)
++				;
++			offset++;
++		}
++	} else {
++		hal_device_property_set_string(d, property, contents);
++	}
++	free(contents);
++}
++
++static void
++detect_openfirmware_formfactor(HalDevice *root) {
++	int x;
++	struct { gchar *model; gchar *formfactor; } model_formfactor[] =
++		{ 
++			{ "RackMac"   , "server" },
++			{ "AAPL,3400" , "laptop"  },
++			{ "AAPL,3500" , "laptop"  },
++			{ "PowerBook" , "laptop"  },
++			{ "AAPL"      , "desktop" },
++			{ "iMac"      , "desktop" },
++			{ "PowerMac"  , "desktop" },
++			{NULL, NULL }
++		};
++	const gchar *model =
++	  hal_device_property_get_string(root, "openfirmware.model");
++
++	for (x = 0 ; model_formfactor[x].model ; x++) {
++		if (strstr(model, model_formfactor[x].model)) {
++			hal_device_property_set_string (root, "system.formfactor",
++				model_formfactor[x].formfactor);
++			break;
++		}
++	}
++}
++
++static void
++probe_openfirmware(HalDevice *root) {
++#define DEVICE_TREE "/proc/device-tree/"
++	if (!g_file_test(DEVICE_TREE, G_FILE_TEST_IS_DIR)) {
++		return;
++	}
++	get_openfirmware_entry(root, "openfirmware.model", 
++		DEVICE_TREE "model", FALSE);
++	get_openfirmware_entry(root, "openfirmware.compatible", 
++		DEVICE_TREE "compatible", TRUE);
++	detect_openfirmware_formfactor(root);
++}
++
++
+ void 
+ osspec_probe (void)
+ {
+@@ -547,12 +609,12 @@ osspec_probe (void)
+ 	 */
+ 	set_suspend_hibernate_keys (root);
+ 
+-	/* TODO: add prober for PowerMac's */
+ 	if (should_decode_dmi) {
+ 		hald_runner_run (root, "hald-probe-smbios", NULL, HAL_HELPER_TIMEOUT,
+         	                 computer_probing_pcbios_helper_done, NULL, NULL);
+ 	} else {
+ 		/* no probing */
++		probe_openfirmware(root);
+ 		computer_probing_helper_done (root);
+ 	}
+ }
+diff --git a/hald/linux/pmu.c b/hald/linux/pmu.c
+index d2ce912..b43d5f0 100644
+--- a/hald/linux/pmu.c
++++ b/hald/linux/pmu.c
+@@ -381,9 +381,6 @@ pmu_synthesize_hotplug_events (void)
+ 		/* Add Laptop Panel */
+ 		snprintf (path, sizeof (path), "%s/pmu/info", get_hal_proc_path ());
+ 		pmu_synthesize_item (path, PMU_TYPE_LAPTOP_PANEL);
+-
+-		/* If the machine has got battery bays then this is a laptop. */
+-		hal_device_property_set_string (computer, "system.formfactor", "laptop");
+ 	}
+ 
+ 	/* setup timer for things that we need to poll */




More information about the Pkg-utopia-commits mailing list