Slackware This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
09-02-2006, 01:25 PM
|
#1
|
Senior Member
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191
Rep:
|
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.
Last edited by drkstr; 09-02-2006 at 01:27 PM.
|
|
|
09-02-2006, 02:47 PM
|
#2
|
Member
Registered: Aug 2004
Location: Aguascalientes, AGS. Mexico.
Distribution: Slackware 13.0 kernel 2.6.29.6
Posts: 816
Rep:
|
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
#!/bin/bash
/sbin/ifconfig | /bin/grep "Link encap:" | /bin/awk -F: {'print $1'} | /bin/cut -d\ -f 1
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
Code:
#cat ~/myIp.sh
#!/bin/bash
/sbin/ifconfig $1 | /bin/grep "inet addr:" | /bin/awk -F: {'print $2'} | /bin/cut -d\ -f 1
|
|
|
09-02-2006, 02:50 PM
|
#3
|
Member
Registered: Aug 2004
Location: Aguascalientes, AGS. Mexico.
Distribution: Slackware 13.0 kernel 2.6.29.6
Posts: 816
Rep:
|
I though you might find this useful as well,
I found in man ifconfig that the required files for the command are - /proc/net/socket
- /proc/net/dev
- /proc/net/if_inet6
I checked /proc/net/dev and guess what....
|
|
|
09-02-2006, 04:17 PM
|
#4
|
Senior Member
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191
Original Poster
Rep:
|
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
|
|
|
09-03-2006, 03:21 PM
|
#5
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
Quote:
Originally Posted by drkstr
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)
Cheers, Eric
|
|
|
09-03-2006, 03:50 PM
|
#6
|
Senior Member
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191
Original Poster
Rep:
|
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?
|
|
|
09-03-2006, 03:52 PM
|
#7
|
Senior Member
Registered: Mar 2003
Location: Following the white rabbit
Distribution: Slackware64 -current
Posts: 2,300
Rep:
|
Quote:
Originally Posted by Alien Bob
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.
|
|
|
09-03-2006, 04:27 PM
|
#8
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
Quote:
Originally Posted by masonm
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
|
|
|
09-03-2006, 04:34 PM
|
#9
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
Quote:
Originally Posted by drkstr
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.
Eric
|
|
|
09-03-2006, 04:53 PM
|
#10
|
Senior Member
Registered: Mar 2003
Location: Following the white rabbit
Distribution: Slackware64 -current
Posts: 2,300
Rep:
|
Quote:
Originally Posted by Alien Bob
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)
|
|
|
All times are GMT -5. The time now is 12:03 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|