PDA

View Full Version : iwconfig equivilent in Darwin?


csirac
02-18-2005, 04:34 AM
Hello,

Sorry if after I post this my original post comes up... I waited two days but it never got modded by a human (since I created a new account to post here).

I've searched everywhere and I can't find a way to configure the airport card in my shiny new iBook from a Darwin >console login. This is my first mac since about 10 years ago when I had an Apple II/c and an LC475 running System 7 as a kid. Loving it so far :-)

I know all about ifconfig - I'd consider myself a "pretty hardcore" Linux guy (I've installed & admin Linux servers at a few businesses as part of my job) - but I just can't seem to find a way to set WEP keys, SSID, etc. from the CLI. Am I blind? Stupid? Or can it only be configured from the OS X network prefs GUI utility?

I've tried google to death, man -k, apt-cache search (with fink), searching these forums... nothing has come up :0(

The only way I can use my Airport at the moment is if I log into MacOS X properly, connect, and log out again to the >console prompt. If my iBook goes to sleep, I have to log out of >console, back in as my MacOS X user, connect, log out...

Originally I was going to run Debian GNU/Linux on this thing but the lack of Airport support has turned me off and the wonderful world of apt thanks to fink has made me delay a proper Linux install for the time being... if only I could get a proper Gnome/XDarwin working environment with all my favourite apps setup like my workstations I'd be set. MacOS X is nice, but I'd like a consistent working environment across all my computers and the inconsistency of keyboard shortcuts is driving me insane...

Other things I haven't researched/solved yet:
- Command-Option-A doesn't switch between XDarwin/MacOSX if I run full-screen from MacOSX. By the way, what is the "command" key on my iBook? The apple logo or the alt key?
- Running XDarwin full-screen with Aqua/Quartz shut down (i.e. from >console login), I can't shut it down when I'm finished. All X apps are terminated yet X keeps running.
- Can't configure touchpad to do single-tap=left-click, double-tap=drag etc. when MacOS X is shut down
- At first glance I can't see a node in /dev that represents a sound device (in Linux it would be /dev/dsp or something similar). What sound API do multimedia apps compiled from fink use? OSS? eSound? How do I get sound from eg. XMMS installed from fink?

Haven't bothered to research any of those additional problems yet, one step at a time... by the way, the W-pad driver hack thing that lets you scroll using two fingers works great on my iBook G4 12"!

Buying this Apple is probably one of the wierdest purchases I've made in ages.. I never buy anything :) The Unix integration is cute. Very cute. The fact I can "shut down the GUI part" of the mac using >console totally wierds me out! Last I used a mac for more than 10mins was system 8 at school... being able to use ssh, grep, vim etc. is also going to be a novelty for me for quite a while I suspect. Oh yeah, and the fact I can run more than one app at a time :P

In the spirit of "hints" here's some info you probably already have on this site. The following assumes you use a white-on-black terminal.

Good Syntax Highlighting in Vim - chuck this in your ~/.vimrc:
version 4.0 " avoid warning for wrong version
set nocompatible " Use Vim defaults like multi-undo (much better!)
set noedcompatible " turn off wierd :s///g behaviour (g always means g)
set background=dark " use light colors for a dark background (def: light)
syntax on " turn on syntax checking (after background is set)
" no-bold for color terminal comments
hi Comment cterm=NONE
" default non-text (formating) characters (default bold blue)
hi NonText term=bold cterm=bold ctermfg=0 " bold black --> IE: grey

This is my PS1 variable for my bash prompt in ~/.bashrc:
PS1="\[\033[1;32m\]\u\[\033[0;37m\]@\[\033[0;36m\]\h-\l\[\033[0;37m\]:\\w\\\$ "

Which gives me a prompt that looks like:
csirac@calypso-ttyp1:/var/log$

(it's supposed to go with a black background...)

And I set the colours on all computers I have an account on so that user account names are green except for root (which is red), and each host has its own unique colour for the hostname part. That way, when I've got 6 ssh sessions open to 4 different computers it's a bit clearer which host is which and whether that session is root or not :-)

There are better PS1 prompt strings out there, I had a good two-line prompt at one stage I ripped from someone but lost it...

Thanks

yellow
02-18-2005, 08:03 AM
The Command key is the Apple key.

sao
02-18-2005, 09:23 AM
csirac wrote:
Running XDarwin full-screen with Aqua/Quartz shut down (i.e. from >console login), I can't shut it down when I'm finished. All X apps are terminated yet X keeps running.
When you 'exit' X windows and you get an apparently frozen screen with only a spinning beachball cursor on it, type "logout'' (although nothing you type shows up on the screen in fact your keystrokes are being received by the console). With Darwin this should put you back at the text console login prompt. With Mac OS X, CoreGraphics will restart and you should be given a login window.


csirac wrote:
How do I get sound from eg. XMMS installed from fink?
Be sure to select the "eSound Output Plugin" in the xmms preferences.

.

csirac
02-18-2005, 09:59 AM
So nobody else has tried configuring the airport's SSID and network key properties from the CLI?

Surely I'm not the only one :(

sao
02-18-2005, 11:10 AM
csirac wrote:
So nobody else has tried configuring the airport's SSID and network key properties from the CLI?
Politness indicates first you should give thanks for the answers you got to your other problems.. :)

As for your airport problem from Darwin, I would refer you to the Darwin-userlevel (http://www.lists.apple.com/archives/darwin-userlevel) mailing lists, you might get a better answer there. Although the last time I looked, Apple provided a binary driver but no way to configure it and as such it was rather useless. Take a look at the MacStumbler web site (http://www.macstumbler.com/), I think they ship a airport.h. There is a command line tool to control the airport interface, but unfortunately it uses Foundation. Rob Braun wrote a client (http://www.opendarwin.org/~bbraun/ap.tar.gz) for this which you may try to see if it works in Darwin.

.

Krauti
02-18-2005, 12:31 PM
There is a way, but you'll need the GUI to make the initial settings and to join new networks.

Following steps:
1) link two utilities buried deep in /System to convenient locations (/usr/bin or something): First one is NetCfgTool, located at /System/Library/PrivateFrameworks/NetworkConfig.framework/Versions/A/Resources/NetCfgTool, second is airport located at /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport. ln -s both to some folder in your PATH so you can use them.

2) Create your Network Location sets in the usual way, via System Preferences.

Now log in to the console (or disable Aqua altogether by editing /etc/ttys). When logged in, start NetCfgTool to run in the background (NetCfgTool &).
Now use the scselect utility to select your airport Network Location set, it's pretty self-explanatory -- scselect will give you a list of available sets if invoked without any arguments, just append the name of the set you want. You will get a NetCfgTool stopped-message. Kill that process now.
Now use airport --autojoin to have the SSID and keys configured.

Done. Works for me, hope it does for you.:)

Note: obviously you will need scselect only to change sets. Once the airport set is selected, it will remain the preference so you'll only need to do airport --autojoin after bootup. Pretty easy.

csirac
02-18-2005, 11:24 PM
Politness indicates first you should give thanks for the answers you got to your other problems.. :)
.

Ooops! I'm really not that rude, honest ;-)

Thankyou yellow, sao and krauti for your answers. I guess asking which one is the command key was a stupid question, demonstrating lack of research effort on my part :D

Krauti, I think your answer will get me out of trouble for sure - in the middle of moving house at the moment so I'll post back when I make sure it works.

I think this information should definately be turned into a hint!

Thanks again