summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2006-09-11 19:32:56 -0400
committerDavid Zeuthen <davidz@redhat.com>2006-09-11 19:32:56 -0400
commit692f7d8b37db80b5eef2b4b26dadbd77ca6da933 (patch)
tree5f60cb0f514aad631820db39b993dc00a9eedb3d
parentf920a972a83bc7f74b182a29d1704a498632577b (diff)
parent5d11ae01e6ea1b2adceb1fed20ce4288d43a2748 (diff)
Merge branch 'master' of ssh://david@git.freedesktop.org/git/hal
-rw-r--r--doc/spec/hal-spec-properties.xml30
-rw-r--r--hald/linux/classdev.c55
2 files changed, 47 insertions, 38 deletions
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 77fac0bd..97d2580f 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -3711,6 +3711,36 @@
<para>
</para>
</sect2>
+ <sect2 id="device-properties-net-irda">
+ <title>
+ <literal>net.irda</literal> namespace
+ </title>
+ <para>
+ IrDA (Infrared Data Association) Networking devices are described in
+ this namespace for device objects with the capability
+ <literal>net.irda</literal>.
+ Note that device objects can only have the <literal>net.irda</literal>
+ capability if they already have the capability <literal>net</literal>.
+ </para>
+ <para>
+ </para>
+ </sect2>
+ <sect2 id="device-properties-net-80211control">
+ <title>
+ <literal>net.80211control</literal> namespace
+ </title>
+ <para>
+ Control devices for Wireless ethernet networking devices are described in
+ this namespace for device objects with the capability
+ <literal>net.80211control</literal>.
+ Note that device objects can only have the <literal>net.80211control</literal>
+ capability if they already have the capability <literal>net</literal>.
+ Warning: You should know what you do if you touch this devices. They are
+ not always stable and can cause (kernel) crashes (on linux).
+ </para>
+ <para>
+ </para>
+ </sect2>
<sect2 id="device-properties-input">
<title>
<literal>input</literal> namespace
diff --git a/hald/linux/classdev.c b/hald/linux/classdev.c
index 98ab2bcb..4e6d2c23 100644
--- a/hald/linux/classdev.c
+++ b/hald/linux/classdev.c
@@ -36,6 +36,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
+#include <sys/stat.h>
#include <unistd.h>
#include <dbus/dbus.h>
@@ -189,53 +190,22 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev,
media_type = hal_device_property_get_int (d, "net.arp_proto_hw_id");
if (media_type == ARPHRD_ETHER) {
- FILE *f;
- gboolean is_wireless;
const char *addr;
+ char wireless_path[HAL_PATH_MAX];
+ gboolean is_wireless;
+ struct stat s;
- is_wireless = FALSE;
-
- f = fopen ("/proc/net/wireless", "ro");
- if (f != NULL) {
- unsigned int i;
- unsigned int ifname_len;
- char buf[128];
-
- ifname_len = strlen (ifname);
-
- do {
- if (fgets (buf, sizeof (buf), f) == NULL)
- break;
-
- for (i=0; i < sizeof (buf); i++) {
- if (isspace (buf[i]))
- continue;
- else
- break;
- }
-
- if (strncmp (ifname, buf + i, ifname_len) == 0) {
- is_wireless = TRUE;
- break;
- }
-
- } while (TRUE);
- fclose (f);
- }
-
- if (is_wireless) {
- /* Check to see if this interface supports wireless extensions */
- /*
- snprintf (wireless_path, SYSFS_PATH_MAX, "%s/wireless", sysfs_path);
- if (stat (wireless_path, &statbuf) == 0) {
- */
+ snprintf (wireless_path, HAL_PATH_MAX, "%s/wireless", sysfs_path);
+ if (stat (wireless_path, &s) == 0 && (s.st_mode & S_IFDIR)) {
hal_device_property_set_string (d, "info.product", "WLAN Interface");
hal_device_property_set_string (d, "info.category", "net.80211");
hal_device_add_capability (d, "net.80211");
+ is_wireless = TRUE;
} else {
hal_device_property_set_string (d, "info.product", "Networking Interface");
hal_device_property_set_string (d, "info.category", "net.80203");
hal_device_add_capability (d, "net.80203");
+ is_wireless = FALSE;
}
addr = hal_device_property_get_string (d, "net.address");
@@ -259,6 +229,15 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev,
mac_address);
}
}
+ } else if (media_type == ARPHRD_IRDA) {
+ hal_device_property_set_string (d, "info.product", "Networking Interface");
+ hal_device_property_set_string (d, "info.category", "net.irda");
+ hal_device_add_capability (d, "net.irda");
+ } else if (media_type == ARPHRD_IEEE80211 || media_type == ARPHRD_IEEE80211_PRISM ||
+ media_type == ARPHRD_IEEE80211_RADIOTAP) {
+ hal_device_property_set_string (d, "info.product", "Networking Wireless Control Interface");
+ hal_device_property_set_string (d, "info.category", "net.80211control");
+ hal_device_add_capability (d, "net.80211control");
}
return d;