hal: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Mon Mar 3 14:12:31 PST 2008


 doc/spec/hal-spec-properties.xml |    8 ++++++++
 hald/linux/device.c              |   20 +++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit dc037f85fd38b47a13190554c80469e8564ba4f3
Author: Andy Shevchenko <andy at smile.org.ua>
Date:   Mon Mar 3 17:11:32 2008 -0500

    add support of the 'mmc.type' parameter
    
    In the recent Linux kernel (starting from 2.6.24) the MMC support
    stuff contains new sysfs file. This file represents the type of the
    MMC card including SDIO cards. The goal of the patch is to add this
    field to the mmc namespace in the HAL.

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 2d3e781..9361486 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -1833,6 +1833,14 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
               <entry>Yes</entry>
               <entry>Firmware revision</entry>
             </row>
+            <row>
+              <entry>
+                <literal>mmc.type</literal> (string)
+              </entry>
+              <entry>example: SDIO</entry>
+              <entry>No</entry>
+              <entry>Card type</entry>
+            </row>
           </tbody>
         </tgroup>
       </informaltable>
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 982e493..e50da32 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -2235,7 +2235,7 @@ mmc_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 	HalDevice *d;
 	const gchar *bus_id;
 	gint host_num, rca, manfid, oemid;
-	gchar *scr;
+	gchar *scr, *type;
 
 	if (parent_dev == NULL) {
 		d = NULL;
@@ -2256,6 +2256,11 @@ mmc_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 	hal_util_set_string_from_file (d, "mmc.cid", sysfs_path, "cid");
 	hal_util_set_string_from_file (d, "mmc.csd", sysfs_path, "csd");
 	
+	type = hal_util_get_string_from_file (sysfs_path, "type");
+	if (type != NULL)
+		/* Possible MMC/SD/SDIO */
+		hal_device_property_set_string (d, "mmc.type", type);
+
 	scr = hal_util_get_string_from_file (sysfs_path, "scr");
 	if (scr != NULL) {
 		if (strcmp (scr, "0000000000000000") == 0)
@@ -2265,12 +2270,17 @@ mmc_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 	}
 
 	if (!hal_util_set_string_from_file (d, "info.product", sysfs_path, "name")) {
-		if (scr != NULL) {
-			hal_device_property_set_string (d, "info.product", "SD Card");
-			hal_device_property_set_string (d, "mmc.product", "SD Card");
+		gchar buf[64];
+		if (type != NULL) {
+			g_snprintf(buf, sizeof(buf), "%s Card", type);
+			hal_device_property_set_string (d, "info.product", buf);
+		} else if (scr != NULL) {
+			g_snprintf(buf, sizeof(buf), "SD Card");
+			hal_device_property_set_string (d, "info.product", buf);
 		} else {
-			hal_device_property_set_string (d, "mmc.product", "MMC Card");
+			g_snprintf(buf, sizeof(buf), "MMC Card");
                 }
+		hal_device_property_set_string (d, "mmc.product", buf);
 	}
 	
 	if (hal_util_get_int_from_file (sysfs_path, "manfid", &manfid, 16)) {


More information about the hal-commit mailing list