It seems you need to run "ip link set wlan0 up" before setting the ESSID. From that url:
--------------------------------
If the card accepts the essid, for example, by doing
iwconfig wlan0 essid YourESSID
but does not associate to the access point even when no encryption is
needed: The driver seems to need the interface to be in the up state
when it gets the essid. So first do
ip link set wlan0 up
then set the essid as before.
--------------------------------
See http:// wiki.debian. org/iwlwifi
It seems you need to run "ip link set wlan0 up" before setting the ESSID. From that url:
------- ------- ------- ------- ----
If the card accepts the essid, for example, by doing
iwconfig wlan0 essid YourESSID
but does not associate to the access point even when no encryption is
needed: The driver seems to need the interface to be in the up state
when it gets the essid. So first do
ip link set wlan0 up
then set the essid as before. ------- ------- ------- ----
-------
It is working for me with this.