5

I have a LG G3 running 5.1.1 and I can successfully enable Portable Wi-Fi hotspot through the Settings menu. I can see my portable Wi-Fi SSID on another Android device when enabled through the Settings menu.

Additionally, I can confirm that hostapd is running with an auto-generated config file.

root@d851:/ # ps | grep hostapd
wifi      6841  302   10892  1280  c026dd60 b6ed98b4 S /system/bin/hostapd
root@d851:/ # cat /proc/6841/cmdline
/system/bin/hostapd -e /data/misc/wifi/entropy.bin /data/misc/wifi/hostapd.conf

My problem arises when I attempt to run hostapd manually through adb shell using the exact same arguments as hostapd spawned through the Settings menu. I am disabling Wi-Fi manually through the settings menu and issuing the following command. It appears that hostapd initializes successfully but the Wi-Fi SSID is never seen by other devices.

root@d851:/ # /system/bin/hostapd -ddd -e /data/misc/wifi/entropy.bin /data/misc/wifi/hostapd.conf

The following was captured from logcat when the above command was issued.

D/hostapd ( 7885): Add randomness: count=1 entropy=0
D/hostapd ( 7885): random pool - hexdump(len=128): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=8): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random pool - hexdump(len=128): [REMOVED]
D/hostapd ( 7885): random: Added entropy from /data/misc/wifi/entropy.bin (own_pool_ready=2)
D/hostapd ( 7885): random: Trying to read entropy from /dev/random
D/hostapd ( 7885): Get randomness: len=20 entropy=1
D/hostapd ( 7885): random from os_get_random - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random from internal pool - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random from internal pool - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): mixed random - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random: Updated entropy file /data/misc/wifi/entropy.bin (own_pool_ready=2)
E/hostapd ( 7885): Configuration file: /data/misc/wifi/hostapd.conf
D/hostapd ( 7885): rfkill: initial event: idx=0 type=2 op=0 soft=1 hard=0
D/hostapd ( 7885): rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
D/hostapd ( 7885): rfkill: initial event: idx=2 type=1 op=0 soft=0 hard=0
D/hostapd ( 7885): nl80211: Supported cipher 00-0f-ac:1
D/hostapd ( 7885): nl80211: Supported cipher 00-0f-ac:5
D/hostapd ( 7885): nl80211: Supported cipher 00-0f-ac:2
D/hostapd ( 7885): nl80211: Supported cipher 00-0f-ac:4
D/hostapd ( 7885): nl80211: Supported cipher 00-0f-ac:6
D/hostapd ( 7885): nl80211: Using driver-based off-channel TX
D/hostapd ( 7885): nl80211: TDLS supported
D/hostapd ( 7885): nl80211: Supported key managment offloads 0x0
D/hostapd ( 7885): nl80211: Supported key derivation offloads 0x0
D/hostapd ( 7885): nl80211: Use separate P2P group interface (driver advertised support)
D/hostapd ( 7885): nl80211: Enable multi-channel concurrent (driver advertised support)
D/hostapd ( 7885): nl80211: Disable use_monitor with device_ap_sme since no monitor mode support detected
D/hostapd ( 7885): nl80211: interface wlan0 in phy phy0
D/hostapd ( 7885): nl80211: Set mode ifindex 23 iftype 3 (AP)
D/hostapd ( 7885): nl80211: Setup AP(wlan0) - device_ap_sme=1 use_monitor=0
D/hostapd ( 7885): nl80211: Subscribe to mgmt frames with AP handle 0xb643e0a0 (device SME)
D/hostapd ( 7885): nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xb643e0a0 match=
D/hostapd ( 7885): nl80211: Enable Probe Request reporting nl_preq=0xb643e0d0
D/hostapd ( 7885): nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0xb643e0d0 match=
D/hostapd ( 7885): nl80211: Add own interface ifindex 23
D/hostapd ( 7885): nl80211: if_indices[16]: 23
D/hostapd ( 7885): Unknown/unsupported wowlan trigger 'any'
D/hostapd ( 7885): phy: phy0
D/hostapd ( 7885): BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
D/hostapd ( 7885): nl80211: Regulatory information - country=00
D/hostapd ( 7885): nl80211: 2402-2472 @ 40 MHz 20 mBm
D/hostapd ( 7885): nl80211: 2457-2482 @ 40 MHz 20 mBm (no IR)
D/hostapd ( 7885): nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR)
D/hostapd ( 7885): nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR)
D/hostapd ( 7885): nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR)
D/hostapd ( 7885): nl80211: 57240-63720 @ 2160 MHz 0 mBm
D/hostapd ( 7885): nl80211: Added 802.11b mode based on 802.11g information
D/hostapd ( 7885): Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=144 freq=5720 MHz max_tx_power=0 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm
D/hostapd ( 7885): Completing interface initialization
D/hostapd ( 7885): Mode: IEEE 802.11g  Channel: 6  Frequency: 2437 MHz
D/hostapd ( 7885): DFS 0 channels required radar detection
D/hostapd ( 7885): nl80211: Set freq 2437 (ht_enabled=1, vht_enabled=0, bandwidth=20 MHz, cf1=2437 MHz, cf2=0 MHz)
D/hostapd ( 7885): RATE[0] rate=10 flags=0x1
D/hostapd ( 7885): RATE[1] rate=20 flags=0x1
D/hostapd ( 7885): RATE[2] rate=55 flags=0x1
D/hostapd ( 7885): RATE[3] rate=110 flags=0x1
D/hostapd ( 7885): RATE[4] rate=60 flags=0x0
D/hostapd ( 7885): RATE[5] rate=90 flags=0x0
D/hostapd ( 7885): RATE[6] rate=120 flags=0x0
D/hostapd ( 7885): RATE[7] rate=180 flags=0x0
D/hostapd ( 7885): RATE[8] rate=240 flags=0x0
D/hostapd ( 7885): RATE[9] rate=360 flags=0x0
D/hostapd ( 7885): RATE[10] rate=480 flags=0x0
D/hostapd ( 7885): RATE[11] rate=540 flags=0x0
D/hostapd ( 7885): hostapd_setup_bss(hapd=0xb6456600 (wlan0), first=1)
D/hostapd ( 7885): wlan0: Flushing old station entries
D/hostapd ( 7885): nl80211: flush -> DEL_STATION wlan0 (all)
D/hostapd ( 7885): wlan0: Deauthenticate all stations
D/hostapd ( 7885): nl80211: sta_remove -> DEL_STATION wlan0 ff:ff:ff:ff:ff:ff --> 0 (Success)
D/hostapd ( 7885): wpa_driver_nl80211_set_key: ifindex=23 (wlan0) alg=0 addr=0x0 key_idx=0 set_tx=0 seq_len=0 key_len=0
D/hostapd ( 7885): wpa_driver_nl80211_set_key: ifindex=23 (wlan0) alg=0 addr=0x0 key_idx=1 set_tx=0 seq_len=0 key_len=0
D/hostapd ( 7885): wpa_driver_nl80211_set_key: ifindex=23 (wlan0) alg=0 addr=0x0 key_idx=2 set_tx=0 seq_len=0 key_len=0
D/hostapd ( 7885): wpa_driver_nl80211_set_key: ifindex=23 (wlan0) alg=0 addr=0x0 key_idx=3 set_tx=0 seq_len=0 key_len=0
E/hostapd ( 7885): Using interface wlan0 with hwaddr 00:90:4c:c5:12:38 and ssid "Redskins"
D/hostapd ( 7885): wpa_driver_set_ap_wps_p2p_ie: Entry
D/hostapd ( 7885): random: Got 20/20 bytes from /dev/random
D/hostapd ( 7885): Get randomness: len=20 entropy=0
D/hostapd ( 7885): random from os_get_random - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random from internal pool - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random from internal pool - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): mixed random - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random: Updated entropy file /data/misc/wifi/entropy.bin (own_pool_ready=2)
D/hostapd ( 7885): Get randomness: len=32 entropy=0
D/hostapd ( 7885): random from os_get_random - hexdump(len=32): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random from internal pool - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random from internal pool - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): mixed random - hexdump(len=32): [REMOVED]
D/hostapd ( 7885): GMK - hexdump(len=32): [REMOVED]
D/hostapd ( 7885): Get randomness: len=32 entropy=0
D/hostapd ( 7885): random from os_get_random - hexdump(len=32): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random from internal pool - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random from internal pool - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): mixed random - hexdump(len=32): [REMOVED]
D/hostapd ( 7885): Key Counter - hexdump(len=32): [REMOVED]
D/hostapd ( 7885): WPA: Delay group state machine start until Beacon frames have been configured
D/hostapd ( 7885): nl80211: Set beacon (beacon_set=0)
D/hostapd ( 7885): nl80211: Beacon head - hexdump(len=59): 80 00 00 00 ff ff ff ff ff ff 00 90 4c c5 12 38 00 90 4c c5 12 38 00 00 00 00 00 00 00 00 00 00 ...
D/hostapd ( 7885): nl80211: Beacon tail - hexdump(len=109): 2a 01 04 32 04 30 48 60 6c 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 0c 00 2d ...
D/hostapd ( 7885): nl80211: ifindex=23
D/hostapd ( 7885): nl80211: beacon_int=100
D/hostapd ( 7885): nl80211: dtim_period=2
D/hostapd ( 7885): nl80211: ssid - hexdump(len=8): 52 65 64 73 6b 69 6e 73
D/hostapd ( 7885): nl80211: hidden SSID not in use
D/hostapd ( 7885): nl80211: privacy=1
D/hostapd ( 7885): nl80211: auth_algs=0x3
D/hostapd ( 7885): nl80211: wpa_version=0x2
D/hostapd ( 7885): nl80211: key_mgmt_suites=0x2
D/hostapd ( 7885): nl80211: pairwise_ciphers=0x18
D/hostapd ( 7885): nl80211: group_cipher=0x10
D/hostapd ( 7885): WPA: Start group state machine to set initial keys
D/hostapd ( 7885): WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
D/hostapd ( 7885): Get randomness: len=16 entropy=0
D/hostapd ( 7885): random from os_get_random - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): random_mix_pool - hexdump(len=20): [REMOVED]
D/hostapd ( 7885): random from internal pool - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): mixed random - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): GTK - hexdump(len=16): [REMOVED]
D/hostapd ( 7885): WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
D/hostapd ( 7885): wpa_driver_nl80211_set_key: ifindex=23 (wlan0) alg=3 addr=0xb6f9988a key_idx=1 set_tx=1 seq_len=0 key_len=16
D/hostapd ( 7885): nl80211: KEY_DATA - hexdump(len=16): [REMOVED]
D/hostapd ( 7885):    broadcast key
D/hostapd ( 7885): nl80211: Set wlan0 operstate 0->1 (UP)
D/hostapd ( 7885): netlink: Operstate: ifindex=23 linkmode=-1 (no change), operstate=6 (IF_OPER_UP)
D/hostapd ( 7885): Failed to set TX queue parameters for queue 0.
D/hostapd ( 7885): Failed to set TX queue parameters for queue 1.
D/hostapd ( 7885): Failed to set TX queue parameters for queue 2.
D/hostapd ( 7885): Failed to set TX queue parameters for queue 3.
I/hostapd ( 7885): wlan0: interface state UNINITIALIZED->ENABLED
I/hostapd ( 7885): wlan0: AP-ENABLED 
D/hostapd ( 7885): wlan0: Setup of interface done.
D/hostapd ( 7885): ctrl_iface not configured!
D/hostapd ( 7885): RTM_NEWLINK: ifi_index=23 ifname=wlan0 operstate=6 linkmode=0 ifi_family=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])

Why does running hostapd with the exact same config file through adb shell not create Wi-Fi network visible by other devices? SELinux is in permissive mode so I have ruled that out. What am I possibly missing? Is there some other piece of configuration that is necessary to actual enable the portable Wi-Fi hotspot from adb shell?

Any assistance is greatly appreciated.

0

There is actually another step before running the command line when executing the hostapd with conf file, which is to load the firmware. And this is exactly why there is this print:

D/hostapd ( 7885): ctrl_iface not configured!

The loaded firmware will probe an interface in /data/misc/wifi/hostapd and this is the Unix domain socket for which the hostapd client can communicate with the kernel.

Add some debug prints in SoftAPController.cpp and you'll see the whole picture.

  • 1
    So how does one load the firmware before running hostapd? – Dan Hulme Apr 7 '16 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.