Re: How to detect Wifi device?
Re: How to detect Wifi device?
- Subject: Re: How to detect Wifi device?
- From: Jay Koutavas <email@hidden>
- Date: Wed, 20 Jul 2005 22:53:46 -0400
Title: Re: How to detect Wifi device?
scutil is cool, I played around with it tonight. On a
machine that has an actual Airport card, it's pretty obvious what keys
to use to get all sorts of useful info.
Alas, if you'll notice in my previous emails, I've been speaking
about "wifi detection", not "airport detection".
The machine I am doing pathological testing on is an old Lombard
powerbook with a USB-based wifi dongle (D-Link DWL-122) running Mac OS
X 10.3.4, and when I run scutil on it, I see things like this:
>
open
> list
subKey [0] = DirectoryService:PID
subKey [1] = Plugin:IPConfiguration
subKey [2] = Setup:
subKey [3] = Setup:/
subKey [4] = Setup:/Network/Global/IPv4
subKey [5] = Setup:/Network/HostNames
subKey [6] =
Setup:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F
subKey [7] =
Setup:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F/Ethernet
subKey [8] =
Setup:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F/IPv4
subKey [9] =
Setup:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F/IPv6
subKey [10] =
Setup:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F/Interface
subKey [11] =
Setup:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F/Proxies
subKey [12] = Setup:/System
subKey [13] = State:/IOKit/PowerManagement/CurrentSettings
subKey [14] = State:/IOKit/PowerSources/InternalBattery-0
subKey [15] = State:/IOKit/PowerSources/InternalBattery-1
subKey [16] = State:/Network/Global/DNS
subKey [17] = State:/Network/Global/IPv4
subKey [18] = State:/Network/Global/Proxies
subKey [19] = State:/Network/Interface
subKey [20] = State:/Network/Interface/en1/IPv4
subKey [21] = State:/Network/Interface/en1/IPv6
subKey [22] = State:/Network/Interface/en1/Link
subKey [23] = State:/Network/Interface/lo0/IPv4
subKey [24] = State:/Network/Interface/lo0/IPv6
subKey [25] =
State:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F/DHCP
subKey [26] =
State:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F/DNS
subKey [27] =
State:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F/IPv4
subKey [28] = State:/Users/ConsoleUser
subKey [29] =
com.apple.DirectoryService.NotifyTypeStandard:DirectoryNodeAdded
subKey [30] =
com.apple.DirectoryService.NotifyTypeStandard:DirectoryNodeDeleted
subKey [31] =
com.apple.DirectoryService.NotifyTypeStandard:SearchPolicyChanged
> get Setup:/Network/Global/IPv4
> d.show
<dictionary> {
ServiceOrder : <array> {
0 : 6830952F-0E1E-11D8-B1E3-0050E4307A2F
1 : 0
2 : F3FF3F0C-033C-11D9-8A73-0050E4307A2F
}
PPPOverridePrimary : 0
}
>
The ServiceOrder info is way "geeky-er" than on my nice
ethernet-based Tiger G5 dualie's output:
> get State:/Network/Global/IPv4
> d.show
<dictionary> {
PrimaryService : 0
Router : 192.168.1.1
PrimaryInterface : en0
}
>
And is fundamentally different. Why's that?
And the
Setup:/Network/Service/F3FF3F0C-033C-11D9-8A73-0050E4307A2F/
name is way geeky-er. Why the geeky name there? and how will I know to
match on it? I surely can't just grep-around for a string like
"airport" in such a configuration. How will I know that
"F3FF3F0C-033C-11D9-8A73-0050E4307A2F"
means "it's a wifi device"?
The piece of code I am crafting will provide answers to these
sorts of questions, on all kinds of wifi/ethernet environments:
1. is wifi present?
2. is wifi the primary service?
3. is ethernet present?
4. is ethernet *and* wifi in use currently?
5. are there more than one wifi network available nearby?
Will I be able to get all this info out of SCF queries?
/jay
At 12:10 PM -0700 7/20/05, Quinn "The Eskimo!"
wrote:
At 21:40 -0400 19/7/05, Jay Koutavas
wrote:
>What is/are the recommended System Configuration query/queries
to
>make to determine if the machine has an active wifi internet
>connection?
I'd look in the "Setup" domain for an service whose
"Interface"
dictionary (the key pattern would be something like
"Setup:/Network/Service/<serviceID>/Interface")
contains a "Type" key
of value "Ethernet" and a
"Hardware" key of value "AirPort". That
will tell you whether AirPort is configured. You can then look
for a
matching entry in the State domain to see whether IPv4 (the key
would
be "State:/Network/Interface/<ifName>/IPv4") is set up
and has a
reasonable IP address.
As Duane noted, this becomes a lot clearer after you do a little
poking around with "scutil".
S+E
--
Quinn "The
Eskimo!"
<http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications,
Hardware
--
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Jay
Koutavas
mailto:email@hidden
Heynow
Software
http://www.heynow.com
Windham, New Hampshire, USA
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden