wireless device recognition

Johannes Berg johannes at sipsolutions.net
Sat Mar 3 03:40:14 PST 2007


Hi,

Just thought I'd let you know about the current state in the Linux
wireless community. We've been quietly working on a wireless extensions
replacement which is a combination of cfg80211 and nl80211 (for
in-kernel and userspace API respectively.)

With all these changes happening, there's currently some discussion
going on what part we will be exporting to userspace. But the ultimate
goal is to allow compiling a kernel with wireless interfaces but without
CONFIG_WIRELESS_EXT (which is currently not user-selectable.)

Additionally, because the /proc/net/wireless file depends on wireless
extensions and cannot be cleanly supported by cfg80211, I intend to send
a feature removal schedule patch for it real soon now. This means that
in whatever timeframe I put into the feature removal schedule (not
decided yet) hal will need to be updated to not rely on
/proc/net/wireless exclusively. Luckily, the /sys/class/net/*/wireless
directory has been around since at least 2.6.16.

I'm also thinking about a different change in sysfs, namely making
"wireless" a symlink to "ieee80211" in the case where no wireless
extensions are present but cfg80211 is, but that should not affect hal
with the patch below.

In any case, I propose something like below patch to hal (against CVS)
which first stats the wireless entry in sysfs (that's cheaper than first
reading through /proc/net/wireless and new systems should always have
the sysfs entry). The patch can be made better but I wanted to
illustrate the point with as few lines of code changed as possible.

johannes


--- hald/linux2/classdev.c	25 May 2006 15:16:19 -0000	1.44
+++ hald/linux2/classdev.c	3 Mar 2007 11:35:10 -0000
@@ -209,13 +209,19 @@
 
 	media_type = hal_device_property_get_int (d, "net.arp_proto_hw_id");
 	if (media_type == ARPHRD_ETHER) {
-		FILE *f;
+		FILE *f = NULL;
 		gboolean is_wireless;
 		const char *addr;
 
 		is_wireless = FALSE;
 
-		f = fopen ("/proc/net/wireless", "ro");
+		/* 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)
+			is_wireless = TRUE;
+		else
+			f = fopen ("/proc/net/wireless", "ro");
+
 		if (f != NULL) {
 			unsigned int i;
 			unsigned int ifname_len;
@@ -244,11 +250,6 @@
 		}
 
 		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) {
-		*/
 			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");

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/hal/attachments/20070303/df759dfc/attachment.pgp


More information about the hal mailing list