Subject: iwi WiFi interface firmware load on boot
To: None <>
From: Curt Sampson <>
List: current-users
Date: 12/03/2005 18:44:26
This is going to the current-users list because I feel that the people
here are probably best qualified to answer this. But please cc me on
responses if you wouldn't normally, as I'm not on the list itself.

I'm consing up an rc.d script to load up the firmware for an iwi network
interface, so that dhclient can work immediately on boot. However, I need
a name for the darn thing. I'm thinking "iwisetup," but does anybody have
a better idea?

For anybody interested, I've appended a quick (and as yet entirely untested)
sketch of the script; comments are welcome.

Oh, I'm developing this on a 3.0_BETA system, if there's some reason
this wouldn't work on -current, can someone let me know? I can't
off-hand think of any obvious way to be able to easily switch between
netbsd-3 and current on my laptop.

Curt Sampson            <>             +81 90 7737 2974
   The power of accurate observation is commonly called cynicism
   by those who have not got it.    --George Bernard Shaw

# $Id$

# REQUIRE: mountcritlocal
# BEFORE: bootconf

# Notes: 
#  1. The firmware images must be on a "critical" local filesystem. When
#     using the iwi-firmware package, you can just add /usr to
#     critical_filesystems_local. If you cannot do this, you'll need
#     to copy the firmware to, say, your root partition and set XXX
#     apropriately.
#  2. We run before bootconf because some boot configurations may want to
#     set up a WEP key or something similar that we might then wipe out
#     when we clear and reload the firmware. (Or is this really the case?)

$_rc_subr_loaded . /etc/rc.subr


     echo -n "iwi0: installing firmware."

     # I'm not sure that these are optimum values for the sleeps,
     # but not sleeps at all appeared to be a possible source of
     # some problems in my initial trials. --cjs

     ifconfig iwi0 down; sleep 1; echo -n "."
     # Resetting the interface before loading seems to eliminate some problems.
     iwictl iwi0 -k; sleep 2; echo -n "."
     iwictl iwi0 -d /usr/pkg/libdata/if_iwi; sleep 2; echo -n "."

load_rc_config $name
run_rc_command "$1"