I can start wpa_supplicant just fine through adb shell. The firmware and stuff for my WiFi radio is all loaded before this.
However, I want to start it via execv() in a C program. When I execute execv(), I get the following error:
E/wpa_supplicant( 3008): Failed to initialize control interface 'wlan0'.
E/wpa_supplicant( 3008): You may have another wpa_supplicant process already running or the file was
E/wpa_supplicant( 3008): left by an unclean termination of wpa_supplicant in which case you will need
E/wpa_supplicant( 3008): to manually remove this file before starting wpa_supplicant again.
I/wpa_supplicant( 3008): ELOOP: remaining socket: sock=15 eloop_data=0xa5320 user_data=0x0 handler=0x6acd9
I also have this in the serial console:
mkdir[ctrl_interface]: Permission denied
The full strace ouput is here: http://pastebin.com/fuQnqjXK
Here's the strace output snippet of interest:
2380 mkdir("wlan0", 0770) = -1 EACCES (Permission denied)
2380 write(2, "mkdir[ctrl_interface]", 21) = 21
2380 write(2, ": ", 2) = 2
2380 write(2, "Permission denied", 17) = 17
2380 write(2, "\n", 1) = 1
Also, here's the logcat snippet. I've already verified that there's no wpa_supplicant running in the background, and the file that is created when wpa_supplicant is successfully run (/data/misc/wifi/wlan0/wlan0) does not exist. Are there other files that wpa_supplicant is creating?
D/wpa_supplicant( 3627): wpa_supplicant v0.8.x
D/wpa_supplicant( 3627): random: Trying to read entropy from /dev/random
D/wpa_supplicant( 3627): Initializing interface 'wlan0' conf '/data/misc/wifi/wpa_supplicant.conf' driver 'nl80211' ctr
_interface 'N/A' bridge 'N/A'
D/wpa_supplicant( 3627): Configuration file '/data/misc/wifi/wpa_supplicant.conf' -> '/data/misc/wifi/wpa_supplicant.co
f'
D/wpa_supplicant( 3627): Reading configuration file '/data/misc/wifi/wpa_supplicant.conf'
D/wpa_supplicant( 3627): update_config=1
D/wpa_supplicant( 3627): ctrl_interface='wlan0'
D/wpa_supplicant( 3627): eapol_version=1
D/wpa_supplicant( 3627): ap_scan=1
D/wpa_supplicant( 3627): fast_reauth=1
D/wpa_supplicant( 3627): config_methods='push_button keypad display'
D/wpa_supplicant( 3627): device_name='U8500'
D/wpa_supplicant( 3627): default_bgscan='learn:60:-70:300:10:20:/data/misc/wifi/wpa_supplicant_bgscan.db'
D/wpa_supplicant( 3627): wmm_enabled=1
D/wpa_supplicant( 3627): uapsd_enabled=1
D/wpa_supplicant( 3627): nl80211: interface wlan0 in phy phy0
I/wpa_supplicant( 3627): rfkill: Cannot open RFKILL control device
D/wpa_supplicant( 3627): nl80211: RFKILL status not available
D/wpa_supplicant( 3627): nl80211: Set mode ifindex 5 iftype 2 (STATION)
D/wpa_supplicant( 3627): netlink: Operstate: linkmode=1, operstate=5
D/wpa_supplicant( 3627): nl80211: Using driver-based off-channel TX
D/wpa_supplicant( 3627): nl80211: driver param='(null)'
D/wpa_supplicant( 3627): wapi_initialization()
D/wpa_supplicant( 3627): wlan0: Own MAC address: 00:80:e1:c2:89:9a
D/wpa_supplicant( 3627): Country: 00
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_key: ifindex=5 alg=0 addr=0x0 key_idx=0 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_key: ifindex=5 alg=0 addr=0x0 key_idx=1 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_key: ifindex=5 alg=0 addr=0x0 key_idx=2 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_key: ifindex=5 alg=0 addr=0x0 key_idx=3 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 3627): wlan0: RSN: flushing PMKID list in the driver
D/wpa_supplicant( 3627): nl80211: Flush PMKIDs
D/wpa_supplicant( 3627): wlan0: State: DISCONNECTED -> INACTIVE
I/wpa_supplicant( 3627): WPS: Converting display to virtual_display for WPS 2.0 compliance
I/wpa_supplicant( 3627): WPS: Converting push_button to virtual_push_button for WPS 2.0 compliance
D/wpa_supplicant( 3627): nl80211: Regulatory information - country=00
D/wpa_supplicant( 3627): nl80211: 2402-2472 @ 40 MHz
D/wpa_supplicant( 3627): nl80211: 2457-2482 @ 20 MHz
D/wpa_supplicant( 3627): nl80211: 2474-2494 @ 20 MHz
D/wpa_supplicant( 3627): nl80211: 5170-5250 @ 40 MHz
D/wpa_supplicant( 3627): nl80211: 5735-5835 @ 40 MHz
D/wpa_supplicant( 3627): nl80211: Added 802.11b mode based on 802.11g information
D/wpa_supplicant( 3627): WPS: Set UUID for interface wlan0
E/wpa_supplicant( 3627): WPS: UUID based on MAC address - hexdump(len=16): b2 15 b7 6a cb d7 55 cf b9 d4 3e 8c 40 ae 2d
30
D/wpa_supplicant( 3627): EAPOL: SUPP_PAE entering state DISCONNECTED
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
D/wpa_supplicant( 3627): EAPOL: KEY_RX entering state NO_KEY_RECEIVE
D/wpa_supplicant( 3627): EAPOL: SUPP_BE entering state INITIALIZE
D/wpa_supplicant( 3627): EAP: EAP entering state DISABLED
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
E/wpa_supplicant( 3627): Failed to initialize control interface 'wlan0'.
E/wpa_supplicant( 3627): You may have another wpa_supplicant process already running or the file was
E/wpa_supplicant( 3627): left by an unclean termination of wpa_supplicant in which case you will need
E/wpa_supplicant( 3627): to manually remove this file before starting wpa_supplicant again.
D/wpa_supplicant( 3627): Failed to add interface wlan0
D/wpa_supplicant( 3627): wlan0: No keys have been configured - skip key clearing
D/wpa_supplicant( 3627): wlan0: State: INACTIVE -> DISCONNECTED
D/wpa_supplicant( 3627): wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)
D/wpa_supplicant( 3627): netlink: Operstate: linkmode=-1, operstate=5
D/wpa_supplicant( 3627): EAPOL: External notification - portEnabled=0
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
D/wpa_supplicant( 3627): EAPOL: External notification - portValid=0
D/wpa_supplicant( 3627): EAPOL: Supplicant port status: Unauthorized
D/wpa_supplicant( 3627): wlan0: No keys have been configured - skip key clearing
D/wpa_supplicant( 3627): wlan0: Cancelling scan request
D/wpa_supplicant( 3627): wlan0: Cancelling authentication timeout
D/wpa_supplicant( 3627): nl80211: Set TX rates failed: ret=-22 (Invalid argument)
D/wpa_supplicant( 3627): netlink: Operstate: linkmode=0, operstate=6
D/wpa_supplicant( 3627): nl80211: Set mode ifindex 5 iftype 2 (STATION)
I/wpa_supplicant( 3627): ELOOP: remaining socket: sock=15 eloop_data=0xa5320 user_data=0x0 handler=0x6acd9
Anyone can hint to me what I might be doing wrong? Permissions?