Manually Configuring WiFi? (using iw or iwconfig) (SOLVED with uci cmds)

From the linino side, ssh in as root... When I try

root@MyYun:~# iw dev wlan0 set type managed
root@MyYun:~# iw dev wlan0 connect School-Guest

root@MyYun:~# iw dev wlan0 link
Not connected.

But If I connect with Luci...

root@MyYun:~# iw dev wlan0 link
Connected to 00:0d:73:b2:28:01 (on wlan0)
	SSID: School-Guest
	freq: 2437
	RX: 48068 bytes (323 packets)
	TX: 5636 bytes (36 packets)
	signal: -55 dBm
	tx bitrate: 6.5 MBit/s MCS 0

	bss flags:	short-preamble short-slot-time
	dtim period:	1
	beacon int:	100
root@MyYun:~#

So... CAN this be done with the iw command?
What steps am I missing to connect to an open AP? (No encryption/WEP/WPA at al.)

Thanks

http://forum.arduino.cc/index.php?topic=216850.msg1586874#msg1586874

The UCI System
The abbreviation UCI stands for Unified Configuration Interface and is intended to centralize the configuration of OpenWrt.

uci show wireless
wireless.radio0=wifi-device
wireless.radio0.type=mac80211
wireless.radio0.channel=11
wireless.radio0.hwmode=11ng
wireless.radio0.path=platform/ar933x_wmac
wireless.radio0.htmode=HT20
wireless.radio0.ht_capab=SHORT-GI-20 SHORT-GI-40 RX-STBC1 DSSS_CCK-40
wireless.radio0.disabled=0
wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].device=radio0
wireless.@wifi-iface[0].network=lan
wireless.@wifi-iface[0].mode=ap
wireless.@wifi-iface[0].encryption=none
wireless.@wifi-iface[0].ssid=Arduino Yun-90A2DAXXXXXX

OK... so no answers from anyone... So I looked some more and am now trying UCI commands.

Problem is,... Then don't work as expected either.

I started with a config;

root@Python:~# uci show wireless
wireless.radio0=wifi-device
wireless.radio0.type=mac80211
wireless.radio0.hwmode=11ng
wireless.radio0.path=platform/ar933x_wmac
wireless.radio0.htmode=HT20
wireless.radio0.ht_capab=SHORT-GI-20 SHORT-GI-40 RX-STBC1 DSSS_CCK-40
wireless.radio0.channel=auto
wireless.radio0.country=US
wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].device=radio0
wireless.@wifi-iface[0].network=lan
wireless.@wifi-iface[0].mode=sta
wireless.@wifi-iface[0].ssid=myOLD_SSID
wireless.@wifi-iface[0].encryption=psk2
wireless.@wifi-iface[0].key=000000000

Then I made changes to make it look like it did when connected to my preferred SSID

root@Python:~# uci set  wireless.@wifi-iface[0].ssid=“MyWirelessNetwork”
root@Python:~# uci set  wireless.@wifi-iface[0].mode=sta
root@Python:~# uci set  wireless.@wifi-iface[0].encryption=wep
root@Python:~# uci set  wireless.@wifi-iface[0].key=myLittleKey

root@Python:~# uci show  wireless
wireless.radio0=wifi-device
(...stuff deleted....)
wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].device=radio0
wireless.@wifi-iface[0].network=lan
wireless.@wifi-iface[0].mode=sta
wireless.@wifi-iface[0].ssid=“MyWirelessNetwork”
wireless.@wifi-iface[0].encryption=wep
wireless.@wifi-iface[0].key=myLittleKey
root@Python:~# 
root@Python:~# uci commit wireless
root@Python:~# /etc/init.d/network restart
Successfully initialized wpa_supplicant

Then I wait a couple minutes and check it out...

root@Python:~# iw wlan0 link
Not connected.

So I connect try a full reboot

root@Python:~# reboot
then reconnect and try again.

root@Python:~# iw wlan0 link
Not connected.

But the Yun has restored all the default stuff!!!!

wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].device=radio0
wireless.@wifi-iface[0].network=lan
wireless.@wifi-iface[0].mode=ap
wireless.@wifi-iface[0].encryption=none
wireless.@wifi-iface[0].ssid=Arduino Yun-90A2DAF0165E

What gives? How come Yun Restrored its own stuff!

No Fair!

OK... SOLVED

Followed this procedure:

http://forum.arduino.cc/index.php?topic=216850.msg1586874#msg1586874

AND

Disabled wifi-live-or-reset as discussed early on in:

http://forum.arduino.cc/index.php?topic=217849.0