I was writing some scripts to automatically build kismet source lines, and I noticed that hostap devices don't have device files, unlike my prism54 and ipw2200 cards:
$ ls -l /sys/class/net/eth0/device /sys/class/net/eth0/device -> ../../../devices/pci0000:00/0000:00:1e.0/0000:02:01.0 $ ls -l /sys/class/net/wifi0 ls: /sys/class/net/wifi0/device: No such file or directory $ ls -l /sys/class/net/wlan0 ls: /sys/class/net/wlan0/device: No such file or directory The following (quite small) patch makes sure that both the wlan and wifi net devices have that pointer to the bus device. This way, I can do things like for i in /sys/class/net/*; do if ! [ -e $i/device/drive ]; then continue; fi; driver=$(basename $(readlink $i/device/driver)) case $driver in hostap*) echo -- hostap,$i,$i-$driver break; ipw2?00) echo -- $driver,$i,$i-$driver break; prism54) echo prism54g,$i esac done Which should generate a working set of source lines for kismet no matter what order I plug the cards in. It might also be handy to have a link between the two net devices, but that's a patch for another day. That patch is against 2.6.13-rc1-mm1. -- Dave Signed-off-by: Dave Hansen <[EMAIL PROTECTED]> diff -ru linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap.c linux-2.6-mm/drivers/net/wireless/hostap/hostap.c --- linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap.c 2005-07-15 10:57:18.000000000 -0700 +++ linux-2.6-mm/drivers/net/wireless/hostap/hostap.c 2005-07-15 12:29:15.000000000 -0700 @@ -141,6 +141,7 @@ if (strchr(dev->name, '%')) ret = dev_alloc_name(dev, dev->name); + SET_NETDEV_DEV(dev, mdev->class_dev.dev); if (ret >= 0) ret = register_netdevice(dev); diff -ru linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap_cs.c linux-2.6-mm/drivers/net/wireless/hostap/hostap_cs.c --- linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap_cs.c 2005-07-15 10:57:18.000000000 -0700 +++ linux-2.6-mm/drivers/net/wireless/hostap/hostap_cs.c 2005-07-15 12:30:57.000000000 -0700 @@ -739,7 +739,8 @@ } /* Need to allocate net_device before requesting IRQ handler */ - dev = prism2_init_local_data(&prism2_pccard_funcs, 0); + dev = prism2_init_local_data(&prism2_pccard_funcs, 0, + &handle_to_dev(link->handle)); if (dev == NULL) goto failed; link->priv = dev; diff -ru linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap_hw.c linux-2.6-mm/drivers/net/wireless/hostap/hostap_hw.c --- linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap_hw.c 2005-07-15 10:57:18.000000000 -0700 +++ linux-2.6-mm/drivers/net/wireless/hostap/hostap_hw.c 2005-07-15 12:27:59.000000000 -0700 @@ -3268,7 +3268,8 @@ static struct net_device * -prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx) +prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx, + struct device *sdev) { struct net_device *dev; struct hostap_interface *iface; @@ -3439,6 +3440,7 @@ rtnl_lock(); ret = dev_alloc_name(dev, "wifi%d"); + SET_NETDEV_DEV(dev, sdev); if (ret >= 0) ret = register_netdevice(dev); rtnl_unlock(); diff -ru linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap_pci.c linux-2.6-mm/drivers/net/wireless/hostap/hostap_pci.c --- linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap_pci.c 2005-07-15 10:57:18.000000000 -0700 +++ linux-2.6-mm/drivers/net/wireless/hostap/hostap_pci.c 2005-07-15 12:17:35.000000000 -0700 @@ -308,7 +308,8 @@ pci_set_master(pdev); #endif /* PRISM2_BUS_MASTER */ - dev = prism2_init_local_data(&prism2_pci_funcs, cards_found); + dev = prism2_init_local_data(&prism2_pci_funcs, cards_found, + &pdev->dev); if (dev == NULL) goto fail; iface = netdev_priv(dev); diff -ru linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap_plx.c linux-2.6-mm/drivers/net/wireless/hostap/hostap_plx.c --- linux-2.6-mm.orig/drivers/net/wireless/hostap/hostap_plx.c 2005-07-15 10:57:18.000000000 -0700 +++ linux-2.6-mm/drivers/net/wireless/hostap/hostap_plx.c 2005-07-15 12:17:01.000000000 -0700 @@ -522,7 +522,8 @@ * not present; but are there really such cards in use(?) */ } - dev = prism2_init_local_data(&prism2_plx_funcs, cards_found); + dev = prism2_init_local_data(&prism2_plx_funcs, cards_found, + &pdev->dev); if (dev == NULL) goto fail; iface = netdev_priv(dev); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html