How does my computer determine which wireless device to use?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
The original script was to know the ip addresses (or only one by the given interface name) on the system, which I found somewhere in this forum a long long time ago
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
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.
Correct. The wifi0 device which the madwifi driver creates is not something you'd want to mess with.
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:
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*
If only it were that easy :-)
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)
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?
The ndiswrapper driver for instance creates an eth? device.
Really? Not on my system. My card is being driven with ndiswrapper and is wlan0. ndiswrapper doesn't "create" a device name, it's just a driver wrapper.
The card names are determined by how your config files are set up.
Really? Not on my system. My card is being driven with ndiswrapper and is wlan0. ndiswrapper doesn't "create" a device name, it's just a driver wrapper.
You're right and I should have said "the ip2w2200 driver creates a eth? device...".
The ndiswrapper *does* create the ethernet device. The Windows driver it "wraps" does not know anything about Linux network interfaces.
Quote:
The card names are determined by how your config files are set up.
Well some drivers do not allow to define the device name in a config file, and some do (using "modinfo drivername" sometimes reveals what you can do to the interface name).
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?
No, I've never met him in person (we're 9 timezone hours apart) but we exchange emails frequently - just like anyone else with Slackware feedback/bug reports/suggestions by the way.
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.
You're right and I should have said "the ip2w2200 driver creates a eth? device...".
Yep.
Quote:
The ndiswrapper *does* create the ethernet device. The Windows driver it "wraps" does not know anything about Linux network interfaces.
Yeah, ok, I get your point here.
Quote:
Well some drivers do not allow to define the device name in a config file, and some do (using "modinfo drivername" sometimes reveals what you can do to the interface name).
Eric
That's also true, and I concede that point. I suppose I would have done better in saying that in some cases the device name is determined by your config files. (I'm on my 4th beer, ya can't expect perfection at this point LOL)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.