hal: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Mon Mar 3 14:18:55 PST 2008


 doc/spec/hal-spec-properties.xml |   39 +++++++++++++++++++++++++++++++++++++++
 hald/linux/device.c              |    7 +++++++
 2 files changed, 46 insertions(+)

New commits:
commit 85c47efadda75e2601a6e5518bdf60f39451c943
Author: Marcel Holtmann <marcel at holtmann.org>
Date:   Mon Mar 3 17:18:02 2008 -0500

    add bridge classification support
    
    This adds support to properly classify Linux bridge devices with
    net.bridge capability. Otherwise they are classifed as normal
    Ethernet devices with net.80203 capability.

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 9361486..9a6dd9b 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -4680,6 +4680,45 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
       <para>
       </para>
     </sect2>
+    <sect2 id="device-properties-net-bridge">
+      <title>
+        net.bridge namespace
+      </title>
+      <para>
+        Bridge ethernet networking devices is described in this namespace
+        for device objects with the capability
+        <literal>net.bridge</literal>.
+        Note that device
+        objects can only have the <literal>net.bridge</literal> capability
+        if they already have the capability <literal>net</literal>.
+      </para>
+      <informaltable>
+        <tgroup cols="2">
+          <thead>
+            <row>
+              <entry>Key (type)</entry>
+              <entry>Values</entry>
+              <entry>Mandatory</entry>
+              <entry>Description</entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry>
+                <literal>net.bridge.mac_address</literal> (uint64)
+              </entry>
+              <entry>example: 0x0010605d8ef4</entry>
+              <entry>
+                Only if the <literal>net.bridge</literal> capability is set
+              </entry>
+              <entry>48-bit address</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </informaltable>
+      <para>
+      </para>
+    </sect2>
     <sect2 id="device-properties-net-bluetooth">
       <title>
         net.bluetooth namespace
diff --git a/hald/linux/device.c b/hald/linux/device.c
index e50da32..e7f4b05 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -532,6 +532,7 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 	if (media_type == ARPHRD_ETHER) {
 		const char *addr;
 		const char *parent_subsys;
+		char bridge_path[HAL_PATH_MAX];
 		char wireless_path[HAL_PATH_MAX];
 		char wiphy_path[HAL_PATH_MAX];
 		struct stat s;
@@ -553,6 +554,7 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 			}
 		}
 
+		snprintf (bridge_path, HAL_PATH_MAX, "%s/bridge", sysfs_path);
 		snprintf (wireless_path, HAL_PATH_MAX, "%s/wireless", sysfs_path);
 		/* wireless dscape stack e.g. from rt2500pci driver*/
 		snprintf (wiphy_path, HAL_PATH_MAX, "%s/wiphy", sysfs_path);
@@ -569,6 +571,11 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 			hal_device_property_set_string (d, "info.category", "net.80211");
 			hal_device_add_capability (d, "net.80211");
 			hal_device_property_set_uint64 (d, "net.80211.mac_address", mac_address);
+		} else if (stat (bridge_path, &s) == 0 && (s.st_mode & S_IFDIR)) {
+			hal_device_property_set_string (d, "info.product", "Bridge Interface");
+			hal_device_property_set_string (d, "info.category", "net.bridge");
+			hal_device_add_capability (d, "net.bridge");
+			hal_device_property_set_uint64 (d, "net.bridge.mac_address", mac_address);
 		} else {
 			hal_device_property_set_string (d, "info.product", "Networking Interface");
 			hal_device_property_set_string (d, "info.category", "net.80203");


More information about the hal-commit mailing list