hal: Branch 'origin' - 3 commits

Kay Sievers kay at kemper.freedesktop.org
Thu Nov 23 08:45:15 PST 2006


 doc/spec/hal-spec-properties.xml |   24 +++++++++++++++++++++++-
 hald/linux/blockdev.c            |    8 +++++++-
 hald/linux/device.c              |   18 ++++++++++++++++++
 3 files changed, 48 insertions(+), 2 deletions(-)

New commits:
diff-tree 2440190f73030e6550e97fec3f5f580166bb9181 (from 3d8bf144f9f2f8809baedc8b52631967db0e980b)
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Tue Nov 14 18:41:10 2006 +0100

    add hardware dependent/specific alsa sound devices to HAL
    
    This adds support/detection of hardware specific ALSA Sound devices (as
    e.g. Fortemedia FM801 PCI Audio with driver snd_fm801) to HAL. The driver
    can use this devices freely for purposes that are not covered by standard
    ALSA API (PCM, control, etc).
    
    Also changed alsa.device_pcm_class from mandatory to not mandatory
    because not all devices in the alsa namespace need to provide the property
    (e.g. if they aren't a PCM device).

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 4931aae..4ebe9fd 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -4137,7 +4137,7 @@
                 <literal>alsa.device_pcm_class</literal> (string)
               </entry>
               <entry></entry>
-              <entry>Yes</entry>
+              <entry>No</entry>
               <entry>
                 The PCM class of the device.
               </entry>
@@ -4242,6 +4242,28 @@
                 Stream is playback device.
               </entry>
             </row>
+	    <row>
+              <entry></entry>
+              <entry>
+                <literal>unknown</literal>
+              </entry>
+              <entry></entry>
+              <entry>
+                The type of the device is unknown.
+              </entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>
+                <literal>hw_specific</literal>
+              </entry>
+              <entry></entry>
+              <entry>
+                This is a hardware specific device (as e.g. from snd_fm801 for Fortemedia FM801 
+		PCI Audio). The driver can use it freely for purposes that are not covered by 
+		standard ALSA API. 
+              </entry>
+            </row>
             <row>
               <entry></entry>
               <entry>
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 6c8c259..ebe80c2 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -678,6 +678,24 @@ sound_add (const gchar *sysfs_path, cons
 				} else
 					hal_device_property_set_string (d, "info.product", "ALSA Device");
 			}
+		} else if (sscanf (device, "hwC%dD%d", &cardnum, &devicenum) == 2) {
+			
+			hal_device_property_set_string (d, "info.category", "alsa");
+			hal_device_add_capability (d, "alsa");
+			hal_device_property_set_string (d, "alsa.device_file", device_file);
+			hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+			hal_device_property_set_string (d, "alsa.physical_device", hal_device_get_udi (parent_dev));
+			hal_device_property_set_int (d, "alsa.card", cardnum);
+			hal_device_property_set_int (d, "alsa.device", devicenum);
+	
+			snprintf (aprocdir, sizeof (aprocdir), "%s/asound/card%d", get_hal_proc_path (), cardnum);
+			hal_util_set_string_from_file (d, "alsa.card_id", aprocdir, "id");
+
+			hal_device_property_set_string (d, "alsa.type", "hw_specific");
+			
+			snprintf (buf, sizeof (buf), "%s ALSA hardware specific Device", hal_device_property_get_string (d, "alsa.card_id"));
+			hal_device_property_set_string (d, "info.product", buf);
+	
 		} else if (!strncmp (device, "dsp", 3) || !strncmp (device, "adsp", 4) || 
 			   !strncmp (device, "midi", 4) || !strncmp (device, "amidi", 5) ||
 			   !strncmp (device, "audio", 5) || !strncmp (device, "mixer", 5)) {
diff-tree 3d8bf144f9f2f8809baedc8b52631967db0e980b (from parents)
Merge: b644d7fe9899f863013cc025764dd86c763e54ba a23312cd3c6673d735e63abf459c78810fe96f66
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Tue Nov 14 18:22:33 2006 +0100

    Merge branch 'master' of ssh://dkukawka@git.freedesktop.org/git/hal

diff-tree b644d7fe9899f863013cc025764dd86c763e54ba (from 754066cd7a0929c19cd9a0faf30844c8c9047bb9)
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Tue Nov 14 18:18:54 2006 +0100

    replace usage of g_assert() with error handling
    
    This removes the only one g_assert() within the complete daemon from
    blockdev.c and replace this with code to check also the tdl instead of
    only gdl and go to the (already existing) error case if HAL don't get
    the device  searching for and simply print a warning and error mesage
    and don't add the device to the device tree. In worst case we have
    just have one device less instead of dead HAL.
    
    Without the fix HAL die without any message sometimes on boot. See:
    https://bugzilla.novell.com/show_bug.cgi?id=217563 or
    https://bugs.freedesktop.org/show_bug.cgi?id=8210

diff --git a/hald/linux/blockdev.c b/hald/linux/blockdev.c
index b3f9b11..b7b2b86 100644
--- a/hald/linux/blockdev.c
+++ b/hald/linux/blockdev.c
@@ -832,7 +832,13 @@ hotplug_event_begin_add_blockdev (const 
 
 			/* Find device */
 			d_it = hal_device_store_find (hald_get_gdl (), udi_it);
-			g_assert (d_it != NULL);
+			if (d_it == NULL) { 
+				d_it = hal_device_store_find (hald_get_tdl (), udi_it);
+				if (d_it == NULL) {
+					HAL_WARNING (("Could not get device '%s' from gdl or tdl.", udi_it));
+					goto error;
+				}
+			}
 
 			/* Check info.bus */
 			if ((bus = hal_device_property_get_string (d_it, "info.bus")) != NULL) {


More information about the hal-commit mailing list