I had the same problem of getting my iwl4965 to associate to various access points. By accident I noticed that "iwconfig $dev ap any" did trigger that process (I now read that essid works as well). I created a script that hooks into if-pre-up.d and waits for the wireless interface to come up. That way, the connection will be ready when dhcpclient comes along. I also included a triggering mechanism that tries to force reassociation when no access point is found. After a timeout of around 10 seconds, the script passes on, whether an agreement with the ap could be reached or not.
I attached the script to this mail and uploaded it to http://wertarbyte.de/debian/wireless-tools-snooze I hope it helps :-)
#!/bin/sh # # wireless-tools-snooze # # This script can be placed in /etc/network/if-pre-up.d/ to buy # some more time for access point association. Some wifi chipsets # also give up after missing one association, so the script does # trigger a configurable number of reassociations. # # By Stefan Tomanek <[EMAIL PROTECTED]> # http://wertarbyte.de/ IWCONFIG=/sbin/iwconfig if [ ! -x $IWCONFIG ]; then exit 0 fi if [ "$IF_WIRELESS" != "yes" ]; then exit 0 fi if [ "$IF_WIRELESS_MODE" != "managed" ]; then echo "Not a managed interface, snooze disabled" >&2 exit 0 fi is_associated() { [ "$(/sbin/iwgetid --raw --ap "$IFACE")" != "00:00:00:00:00:00" ] } trigger_association() { $IWCONFIG "$IFACE" ap "${IF_WIRELESS_AP:-any}" essid "${IF_WIRELESS_ESSID:-any}" } COUNTDOWN=10 while ! is_associated && [ "$COUNTDOWN" -ge 0 ]; do echo "Device $IFACE is not yet associated, waking it... ($COUNTDOWN tries left)" >&2 trigger_association let COUNTDOWN-- sleep 1 done if is_associated; then echo "Successfully triggered $IFACE association" >&2 else echo "Giving up on interface $IFACE" >&2 fi

