Wednesday, January 20, 2016

wi fi - How to enable dual networking in Android shell?


I have a rooted HR933 tablet running Android 4.4.2, and an embedded device with a Wi-Fi access point but no Internet access. I need the tablet's browser to be able to reach the device's web server via Wi-Fi, and also connect to the Internet via mobile data at the same time.


Super Download (see How do I connect to a wifi ap and 3g network simultaneously?) will not work because I need to browse, not just download files.



I'm trying to enable the Wi-Fi and mobile network adapters simultaneously as described here:


# enable dual-networking:
pkill dhcpcd
svc wifi disable
svc data enable
netcfg wlan0 up
cd /data/misc/wifi/.
wpa_supplicant -B -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
dhcpcd wlan0
ip route add x.x.x.x via x.x.x.y # add any desired local route


The problem is that as soon as I do svc wifi disable, the wlan0 adapter disappears. The script above implies wlan0 is still available after disabling Wi-Fi, but on this tablet it isn't:


netcfg
tunl0 DOWN
lo UP
ifb1 DOWN
ifb0 DOWN
sit0 DOWN
ccmni1 DOWN
ccmni0 UP

ccmni2 DOWN
ip6tnl0 DOWN

So when I try netcfg wlan0 up, I get action 'up' failed (No such device).


EDIT:


After additional trial and error I've found that I can briefly get the dual network setup to work before the tablet disconnects itself from the embedded device's access point:



  1. svc data prefer makes the mobile connection data preferred.

  2. Manually enable wlan0 with netcfg wlan0 up.

  3. Connect to the device's AP via the Wi-Fi UI on the tablet.



I then have about 90 seconds where I can browse the embedded device's web server and pull up Internet websites in separate Chrome tabs at the same time. After that time the tablet disconnects from the device's Wi-Fi and wlan0 is shown as down with netcfg. My logcat output includes this:


D/WifiStateTracker(  682): New state:CONNECTING, mLastState:CONNECTING
D/ConnectivityService( 682): ConnectivityChange for WIFI: CONNECTING/CAPTIVE_PORTAL_CHECK
D/WifiWatchdogStateMachine( 682): Network state change CAPTIVE_PORTAL_CHECK
D/ConnectivityService( 682): Captive portal check NetworkInfo: type: WIFI[], state: CONNECTING/CAPTIVE_PORTAL_CHECK, reason: (unspecified), extra: "EMBEDDED_DEVICE", roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false, simId: 0
D/ConnectivityService( 682): Tear down low priority net WIFI

"EMBEDDED_DEVICE" is substituted for the actual SSID. That last line would seem to indicate it's a "low priority" network, but there doesn't seem to be a way to change its priority; it's also the only "known" network on the tablet.




No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...