hal: Branch 'origin' - 2 commits

Kay Sievers kay at kemper.freedesktop.org
Tue Oct 10 14:32:57 PDT 2006


 hald/linux/acpi.c                 |    2 +-
 hald/linux/addons/addon-cpufreq.c |    2 +-
 hald/util.c                       |   16 +++++++++++++++-
 po/tr.po                          |    8 ++++----
 4 files changed, 21 insertions(+), 7 deletions(-)

New commits:
diff-tree 3f628b804aef5373991cb081e4fd55c0b59d1e62 (from efc17f28a6f5048924189c0b8831702c60c5bf6b)
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Oct 10 19:57:27 2006 +0100

    Make sure we get all of a multi-word battery.model value.
    
    me at trinity:~> cat /proc/acpi/battery/BAT*/info | grep 'model number'
    model number:            DELL Y13385
    
    Now, the current code does:
    
    hal_util_set_string_elem_from_file (d, 'battery.model', path, 'info',
                                        'model number', 0, TRUE);
    
    and hence battery.model = 'DELL'
    
    I need to know the complete model number with the 'Y13385'.I propose
    adding GUINTMAX to the elem section of hal_util_grep_string_elem_from_file to
    mean 'all of the line' rather than token x of the line.
    
    Obviously, this only applies to string elements.

diff --git a/hald/linux/acpi.c b/hald/linux/acpi.c
index 040cb33..3798f67 100644
--- a/hald/linux/acpi.c
+++ b/hald/linux/acpi.c
@@ -462,7 +462,7 @@ battery_refresh_add (HalDevice *d, const
 	hal_util_set_string_elem_from_file (d, "battery.vendor", path, "info",
 					    "OEM info", 0, TRUE);
 	hal_util_set_string_elem_from_file (d, "battery.model", path, "info",
-					    "model number", 0, TRUE);
+					    "model number", G_MAXUINT, TRUE);
 	hal_util_set_string_elem_from_file (d, "battery.serial", path, "info",
 					    "serial number", 0, TRUE);
 	hal_util_set_string_elem_from_file (d, "battery.vendor", path, "info",
diff --git a/hald/util.c b/hald/util.c
index 405cc23..b92b3f6 100644
--- a/hald/util.c
+++ b/hald/util.c
@@ -564,6 +564,20 @@ hal_util_grep_string_elem_from_file (con
 	if (((line = hal_util_grep_file (directory, file, linestart, reuse)) == NULL) || (strlen (line) == 0))
 		goto out;
 
+	/* this means take all elements, e.g. "DELL Y7637" */
+	if (elem == G_MAXUINT) {
+		/* just a null string ": " we want to discard */
+		if (strlen (line) < 2) {
+			res = NULL;
+			goto out;
+		}
+		/* strip leading spaces, missing out the ":" first char */
+		line = g_strchug (line + 1);
+		strncpy (buf, line, sizeof (buf));
+		res = buf;
+		goto out;
+	}
+
 	tokens = g_strsplit_set (line, " \t:", 0);
 	for (i = 0, j = 0; tokens[i] != NULL; i++) {
 		if (strlen (tokens[i]) == 0)
@@ -579,7 +593,6 @@ hal_util_grep_string_elem_from_file (con
 out:
 	if (tokens != NULL)
 		g_strfreev (tokens);
-
 	return res;
 }
 
@@ -626,6 +639,7 @@ out:
  *  @param  linestart           Start of line, e.g. "design voltage"
  *  @param  elem                Element number after linestart to extract
  *                              excluding whitespace and ':' characters.
+ *				If set to G_MAXUINT then all elements are set
  *  @return                     TRUE, if, and only if, the value could be
  *                              extracted and the property was set
  */
diff-tree efc17f28a6f5048924189c0b8831702c60c5bf6b (from 75e7bd870a27329a612a1220d9a16b141dce952a)
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Tue Oct 10 19:47:26 2006 +0100

    patch corrects some typos in tr.po and addon-cpufreq.c

diff --git a/hald/linux/addons/addon-cpufreq.c b/hald/linux/addons/addon-cpufreq.c
index f777a4e..e07ff69 100644
--- a/hald/linux/addons/addon-cpufreq.c
+++ b/hald/linux/addons/addon-cpufreq.c
@@ -313,7 +313,7 @@ gboolean write_governor(char *new_govern
 		goto Out;
 
 	governor_file = g_strdup_printf(SYSFS_GOVERNOR_FILE, cpu_id); 
-	HAL_DEBUG(("Trying ot write governor %s", new_governor));
+	HAL_DEBUG(("Trying to write governor %s", new_governor));
 
 	if (!write_line(governor_file, "%s", new_governor)) {
 		ret = FALSE;
diff --git a/po/tr.po b/po/tr.po
index 6278cc8..859cb5b 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -81,7 +81,7 @@ msgstr "DVD-ROM"
 
 #: ../libhal-storage/libhal-storage.c:413
 msgid "Blank DVD-RAM"
-msgstr "Boi DVD-RAM"
+msgstr "BoÅŸ DVD-RAM"
 
 #: ../libhal-storage/libhal-storage.c:415
 msgid "DVD-RAM"
@@ -105,7 +105,7 @@ msgstr "DVD-RW"
 
 #: ../libhal-storage/libhal-storage.c:434
 msgid "Blank DVD+R"
-msgstr "Boi DVD+R"
+msgstr "BoÅŸ DVD+R"
 
 #: ../libhal-storage/libhal-storage.c:436
 msgid "DVD+R"
@@ -113,7 +113,7 @@ msgstr "DVD+R"
 
 #: ../libhal-storage/libhal-storage.c:441
 msgid "Blank DVD+RW"
-msgstr "Boi DVD+RW"
+msgstr "BoÅŸ DVD+RW"
 
 #: ../libhal-storage/libhal-storage.c:443
 msgid "DVD+RW"
@@ -133,7 +133,7 @@ msgstr "BD-ROM"
 
 #: ../libhal-storage/libhal-storage.c:459
 msgid "Blank BD-R"
-msgstr "Boi BD-R"
+msgstr "BoÅŸ BD-R"
 
 #: ../libhal-storage/libhal-storage.c:461
 msgid "BD-R"


More information about the hal-commit mailing list