On Mon, May 19, 2008 at 8:22 AM, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote: > [removing linux-kernel and netdev from CC, I suppose they won't care too > much about these details] > > On Mon, 2008-05-19 at 14:18 +0200, Johannes Berg wrote: >> > Instead of testing for wireless/, best thing would probably be to call >> > SIOCGIWRANGE on the device and if it returns EOPNOTSUP then it's not >> > wireless. Some drivers may have to load firmware to figure out >> > supported rates and encryption capabilities, but to be honest, NM does >> > this to detect wireless devices and I haven't run into any issues in 4 >> > years using it. If there are issues with drivers, then we need to fix >> > the driver too. >> >> I was about to propose calling SIOCGIWNAME since that is what >> wireless-tools do and that linux/wireless.h indicates. > > Here's a patch, comments? > > johannes > > --- > hald/linux/device.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > --- hal.orig/hald/linux/device.c 2008-05-19 06:46:23.000000000 +0200 > +++ hal/hald/linux/device.c 2008-05-19 06:55:25.000000000 +0200 > @@ -45,6 +45,10 @@ > #include <linux/input.h> > #endif > > +/* for wireless extensions */ > +#include <linux/if.h> > +#include <linux/wireless.h> > + > #include <dbus/dbus.h> > #include <dbus/dbus-glib.h> > > @@ -532,10 +536,14 @@ net_add (const gchar *sysfs_path, const > const char *addr; > const char *parent_subsys; > char bridge_path[HAL_PATH_MAX]; > - char wireless_path[HAL_PATH_MAX]; > char phy80211_path[HAL_PATH_MAX]; > struct stat s; > dbus_uint64_t mac_address = 0; > + int ioctl_fd; > + struct iwreq iwr; > + > + ioctl_fd = socket (PF_INET, SOCK_DGRAM, 0); > + strncpy (iwr.ifr_ifrn.ifrn_name, IFNAMSIZ, ifname); IFNAMSIZ should be the last argument. Luis -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html