Question

I’m using C# to write a wireless management software on Linux which running by mono.

I have a question for wpa_supplicant.conf. I want to know if the Profile of wireless networks is store in wpa_supplicant.conf directly by wpa_cli OR store at other place(for example, store as XML), read selected one to wpa_supplicant.conf, or there are other methods to do it.

When I use script to add second wireless networks, the first will be always disabled.


#!/bin/sh

conf_file =/etc/wpa_supplicant.conf

killall wpa_supplicant

/etc/init.d/S25-wpa_supplicant restart

wpa_cli -iwlan0 disconnect

networkid= echo wpa_cli -iwlan0 add_network

wpa_cli -iwlan0 set_network networkid ssid '"agile"'

wpa_cli -iwlan0 set_network networkid scan_ssid 1

wpa_cli -iwlan0 set_network networkid auth_alg OPEN

wpa_cli -iwlan0 set_network networkid mode 0

wpa_cli -iwlan0 select_network networkid

wpa_cli save_config

wpa_cli reconfigure

wpa_cli -iwlan0 reassociate

wpa_cli -a /etc/network/wpa_action -B

--

here is an example of wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
update_config=1

network={
    ssid="test"
    scan_ssid=1
    psk="testpwd"
    key_mgmt=WPA-PSK
}

network={
       disabled=1
}
Was it helpful?

Solution

I made a mistake on shell, the networkid variable should be start with $, it should be $enetworkid

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top