5,595,067 Members 40,257 Now Online
XDA Developers Android and Mobile Development Forum

Running 3G and WiFi connections simultaneously

Tip us?
 
hkultraman
Old
(Last edited by hkultraman; 5th December 2013 at 12:58 PM.)
#21  
Senior Member
Thanks Meter 1
Posts: 144
Join Date: Nov 2005
Quote:
Originally Posted by sordna View Post
It's possible with a rooted phone.



Read here:
http://forum.xda-developers.com/show....php?t=2197776



Actually it is, I found this thread that describes how to do it on an optimus G phone, and based on that I was able to do in on vanilla android 4.3 as well (my rooted nexus 4).
You need to put a couple of scripts together, since you need a series of shell commands for turning this on and off, I recommend the wonderful SH Script Runner for this.
Here is what I did on my Nexus 4. It works perfectly but note that you don't actually see the wifi icon turning on, but if you run "netcfg | grep UP" you will see that the wlan0 interface is up and running (as well as the rmnet_usb0 mobile data interface, both of them will be up and will have the expected IP addresses) and you can access your local LAN while your mobile data 3g/4g whatever provides your default route to the outside world.

Code:
# 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

# disable dual-networking:
ip route del x.x.x.x/x via x.x.x.y
pkill dhcpcd
pkill wpa_supplicant 
rm -rf /data/misc/wifi/wlan0
netcfg wlan0 down
svc wifi disable
svc data disable
Hi, Thanks for your share, I am currently developing an Internal app which need to have wifi and 3G/4G at the same time. I am using LG G2 and I have rooted it.

I try to follow the script you posted step by step here. However, it seems that right after pkill dhcpdc, svc wifi disable and svc data enable, when I execute netcfg wlan0 up,, it states that wlan0 not found.

I suspect I need to load the wifi driver first before execute netcfg wlan0 up, isn't?

(BTW, are you installing busybox on your phone so that you can have the pkill command)?


And also, by following the link you posted, the LG guy seems have loaded 2 drivers as well.

insmod /system/lib/modules/cfg80211.ko
insmod /system/lib/modules/wlan.ko

Should I also need to load these 2 files as well?

Many thanks.
 
sordna
Old
#22  
sordna's Avatar
Senior Member
Thanks Meter 435
Posts: 934
Join Date: Dec 2012
Depending on your phone/ROM/kernel you may need to load drivers/kernel modules. I'm on stock nexus 4, with Franco kernel.
And yes, I am using busybox by sterickson.
If my post was useful, please hit the THANKS button!
The Following User Says Thank You to sordna For This Useful Post: [ Click to Expand ]
 
hkultraman
Old
(Last edited by hkultraman; 6th December 2013 at 01:34 PM.)
#23  
Senior Member
Thanks Meter 1
Posts: 144
Join Date: Nov 2005
Quote:
Originally Posted by sordna View Post
Depending on your phone/ROM/kernel you may need to load drivers/kernel modules. I'm on stock nexus 4, with Franco kernel.
And yes, I am using busybox by sterickson.

Thanks so much. I manage to have both WIFI and 3G/4G at the same time by following your steps.

But I have to make sure to load my driver first. From case, I have to run:

insmod /system/lib/modules/bcmdhd.ko

And right after I finished using wifi, I have to run following cmd to unload my driver in order to resume normal wifi behavior.

rmmod bcmdhd

Working great!
The Following User Says Thank You to hkultraman For This Useful Post: [ Click to Expand ]
 
Captus
Old
#24  
Member
Thanks Meter 1
Posts: 32
Join Date: Mar 2007
Quote:
Originally Posted by hkultraman View Post
Thanks so much. I manage to have both WIFI and 3G/4G at the same time by following your steps.

But I have to make sure to load my driver first. From case, I have to run:

insmod /system/lib/modules/bcmdhd.ko

And right after I finished using wifi, I have to run following cmd to unload my driver in order to resume normal wifi behavior.

rmmod bcmdhd

Working great!
I'm running P.A.C on Galaxy S4. I have tried to look in the same folder for modules. I don't see clearly what i should be loading.
Any ideas?

I get the error wlan0 interface not found.
 
hkultraman
Old
#25  
Senior Member
Thanks Meter 1
Posts: 144
Join Date: Nov 2005
Quote:
Originally Posted by Captus View Post
I'm running P.A.C on Galaxy S4. I have tried to look in the same folder for modules. I don't see clearly what i should be loading.
Any ideas?

I get the error wlan0 interface not found.
Did you try dhd.ko?

---------- Post added at 02:47 PM ---------- Previous post was at 02:43 PM ----------

Quote:
Originally Posted by Captus View Post
I'm running P.A.C on Galaxy S4. I have tried to look in the same folder for modules. I don't see clearly what i should be loading.
Any ideas?

I get the error wlan0 interface not found.
You may also check the link below:
http://blog.csdn.net/roger__wong/art...etails/9131421
 
eledra
Old
(Last edited by eledra; 19th February 2014 at 10:04 PM.)
#26  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: Feb 2014
Tried to follow this tutorial for a week. The idea is to create a program which connect to an internal network while keeping connection to the internet so that I can send command from server to that internal network.

However i still have problem

My device:
Samsung Galaxy S3 LTE - I9305
I have tried both vanilla 4.3 and stable version of Cyanogen Mod.

My commands:

Code:
pkill dhcpcd
svc wifi disable
svc data enable
netcfg wlan0 up
cd /data/misc/wifi/
insmod /system/lib/modules/dhd.ko "firmware_path=/system/etc/wifi/bcmdhd_apsta.bin nvram_path=/system/etc/wifi/nvram_net.txt"
wpa_supplicant -B -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -d
dhcpcd wlan0
However, it stucked:

Code:
dhcpcd[5397]: version 5.5.6 starting
dhcpcd[5397]: wlan0: waiting for carrier
It seems there is something wrong with wpa_supplicant. Here is the log:

Code:
/wpa_supplicant( 5235): wpa_supplicant v2.0-devel-4.2.2
D/wpa_supplicant( 5235): random: Trying to read entropy from /dev/random
I/wpa_supplicant( 5235): Successfully initialized wpa_supplicant
D/wpa_supplicant( 5235): Initializing interface 'wlan0' conf '/data/misc/wifi/wpa_supplicant.conf' driver 'nl80211' ctrl_interface 'N/A' bridge
D/wpa_supplicant( 5235): Configuration file '/data/misc/wifi/wpa_supplicant.conf' -> '/data/misc/wifi/wpa_supplicant.conf'
D/wpa_supplicant( 5235): Reading configuration file '/data/misc/wifi/wpa_supplicant.conf'
D/wpa_supplicant( 5235): ctrl_interface='wlan0'
D/wpa_supplicant( 5235): update_config=1
D/wpa_supplicant( 5235): device_name='m3xx'
D/wpa_supplicant( 5235): manufacturer='samsung'
D/wpa_supplicant( 5235): model_name='GT-I9305'
D/wpa_supplicant( 5235): model_number='GT-I9305'
D/wpa_supplicant( 5235): serial_number='42f7426e1456afbb'
D/wpa_supplicant( 5235): config_methods='physical_display virtual_push_button keypad'
D/wpa_supplicant( 5235): p2p_listen_reg_class=81
D/wpa_supplicant( 5235): p2p_listen_channel=1
D/wpa_supplicant( 5235): p2p_oper_reg_class=115
D/wpa_supplicant( 5235): p2p_oper_channel=48
D/wpa_supplicant( 5235): Priority group 1
D/wpa_supplicant( 5235):    id=0 ssid='Long'
D/wpa_supplicant( 5235): nl80211: interface wlan0 in phy phy0
I/wpa_supplicant( 5235): rfkill: Cannot open RFKILL control device
D/wpa_supplicant( 5235): nl80211: RFKILL status not available
D/wpa_supplicant( 5235): nl80211: Set mode ifindex 8 iftype 2 (STATION)
D/wpa_supplicant( 5235): nl80211: Subscribe to mgmt frames with non-AP handle 0x41dee21
...................
#####  a bunch of Registerframe ####
..................
D/wpa_supplicant( 5235): nl80211: Register frame type=0xd0 nl_handle=0x41dee210           
D/wpa_supplicant( 5235): nl80211: Register frame match - hexdump(len=2): 0a 07            
D/wpa_supplicant( 5235): netlink: Operstate: linkmode=1, operstate=5                      
D/wpa_supplicant( 5235): nl80211: Using driver-based off-channel TX                       
D/wpa_supplicant( 5235): nl80211: TDLS supported                                          
D/wpa_supplicant( 5235): nl80211: Supports Probe Response offload in AP mode              
D/wpa_supplicant( 5235): nl80211: Driver is new enough to support monitor-less mode       
D/wpa_supplicant( 5235): nl80211: driver param='(null)'                                   
D/wpa_supplicant( 5235): nl80211: Regulatory information - country=00                     
D/wpa_supplicant( 5235): nl80211: 2402-2472 @ 40 MHz                                      
D/wpa_supplicant( 5235): nl80211: 2457-2482 @ 40 MHz                                      
D/wpa_supplicant( 5235): nl80211: 2474-2494 @ 20 MHz                                      
D/wpa_supplicant( 5235): nl80211: 5170-5250 @ 40 MHz                                      
D/wpa_supplicant( 5235): nl80211: 5735-5835 @ 40 MHz                                      
D/wpa_supplicant( 5235): nl80211: Added 802.11b mode based on 802.11g information         
D/wpa_supplicant( 5235): wlan0: Own MAC address: 90:18:7c:4a:61:56                        
D/wpa_supplicant( 5235): wpa_driver_nl80211_set_key: ifindex=8 alg=0 addr=0x0 key_idx=0 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 5235): wpa_driver_nl80211_set_key: ifindex=8 alg=0 addr=0x0 key_idx=1 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 5235): wpa_driver_nl80211_set_key: ifindex=8 alg=0 addr=0x0 key_idx=2 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 5235): wpa_driver_nl80211_set_key: ifindex=8 alg=0 addr=0x0 key_idx=3 set_tx=0 seq_len=0 key_len=0
D/wpa_supplicant( 5235): wlan0: RSN: flushing PMKID list in the driver                                              
D/wpa_supplicant( 5235): nl80211: Flush PMKIDs                                                                      
D/wpa_supplicant( 5235): wlan0: Setting scan request: 0 sec 100000 usec                                             
D/wpa_supplicant( 5235): WPS: Set UUID for interface wlan0                                                          
D/wpa_supplicant( 5235): WPS: UUID based on MAC address - hexdump(len=16): b7 c8 22 f4 13 ac 55 83 99 f0 1a f0 a2 2d 95 8a
D/wpa_supplicant( 5235): EAPOL: SUPP_PAE entering state DISCONNECTED                                                      
D/wpa_supplicant( 5235): EAPOL: Supplicant port status: Unauthorized                                                      
D/wpa_supplicant( 5235): EAPOL: KEY_RX entering state NO_KEY_RECEIVE                                                      
D/wpa_supplicant( 5235): EAPOL: SUPP_BE entering state INITIALIZE                                                         
D/wpa_supplicant( 5235): EAP: EAP entering state DISABLED                                                                 
D/wpa_supplicant( 5235): EAPOL: Supplicant port status: Unauthorized                                                      
D/wpa_supplicant( 5235): EAPOL: Supplicant port status: Unauthorized                                                      
D/wpa_supplicant( 5235): Using existing control interface directory.                                                      
D/wpa_supplicant( 5235): wlan0: Added interface wlan0                                                                     
D/wpa_supplicant( 5235): wlan0: State: DISCONNECTED -> DISCONNECTED
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes