How does my computer determine which wireless device to use?
Hello Slackers,
First, let me explain the question a little bit more. I need to know how the device name is chosen for a wireless card. I know how to figure this out myself (by knowing the type of card and what driver it uses, ath_pci=ath0 in my case), but I need a script that I'm writing to be able to tell this, preferably with having to search google. ;) First off, does it even matter? Can I just tell the system to use whichever device name I tell it to? I doubt it, but thought I should ask anyways. If it does matter, then what's the best way to determine the device name my script should be configuring? Can I extract it from some text like in like 'cat /proc/stuff' for instance? If not, what do you think the easiest way to if-then it is? Thanks for the help! ...drkstr **edit** The script will be generating an /etc/rc.d/rc.inet1.conf if it makes any difference. |
I don't know if this helps, but I had this script somewhere in my machine. Asks for the network devices' names to ifconfig and cuts out everything else
Code:
# cat ~/zeeDevices.sh Code:
#cat ~/myIp.sh |
I though you might find this useful as well,
I found in man ifconfig that the required files for the command are
I checked /proc/net/dev and guess what.... |
Awsome, thanks for the help! That was exactly what I was looking for.
Quick question though. I notice that it also shows wifi0 in the listing. Now from what I read, this isn't an actual device. I also noticed that in the rc.inet1.conf, the example device name is for wlan0. My question is this (and sorry, if you can't tell allready, I don't know anything about this wireless stuff). How are the device names decided? Is it just whatever the user defines? And is ath0 just the default? Would it be safe to assume when reading in the /proc/net/dev that if it is not any of these: lo eth* wifi* then it must be the wireless device I'm looking for? Everything I've been reading either refers to a wlan0 or an ath0, can I just check if it's one or the other? Programming became so much more complicated now that I'm not just doing it for my own use ;) thanks again for your help! ...drkstr |
Quote:
And yes, the example in rc.inet1.conf uses "wlan0", but you're free to change it to whatever name your real wireless device uses of course. Quote:
The ndiswrapper driver for instance creates an eth? device. The ralink drivers create a ra? device. And there will probably even more variants, too. If you want to determine whether an interface is wireless, check how I do int in /etc/rc.d/rc.wireless (the is_wireless_device{} function) Cheers, Eric |
Ahhh, neato!
So it looks like I can extract all the device names from /proc/net/dev and put them in an array. I could then loop through them using each one as a parameter to iwconfig. If it returns back "no wireless extensions.", then it's not a wireless device. Brilliant, thanks Eric! Thanks for both your help, think I got what I need now. ...drkstr PS: A little off topic, sorry. Eric, have you ever met Pat? Just curious since you have a webpage on the official Slackware site, and contributions to the Slackware project. Are there any other parts of Slackware that you've done/helped with? |
Quote:
The card names are determined by how your config files are set up. |
Quote:
The ndiswrapper *does* create the ethernet device. The Windows driver it "wraps" does not know anything about Linux network interfaces. Quote:
Eric |
Quote:
I added the wireless support a couple of years ago, and the arbitrary interface names (instead of just eth?) and for the rest it is just a lot of suggestions/bug reports/feedback over the years :-) It helps actually sending patches instead of just reporting weird stuff. Then there are the SlackBuilds I wrote and the Wiki I started, which are not contributions to the Slackware distro but to the Slackware community if you will. Eric |
Quote:
Quote:
Quote:
|
All times are GMT -5. The time now is 08:58 AM. |