Post Reply

Running 3G and WiFi connections simultaneously

OP Cherilee

5th December 2013, 12:54 PM   |  #21  
Senior Member
Thanks Meter: 2
 
144 posts
Join Date:Joined: Nov 2005
Quote:
Originally Posted by sordna

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.
Last edited by hkultraman; 5th December 2013 at 12:58 PM.
5th December 2013, 02:54 PM   |  #22  
sordna's Avatar
Senior Member
Thanks Meter: 596
 
1,123 posts
Join Date:Joined: 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.
The Following User Says Thank You to sordna For This Useful Post: [ View ]
6th December 2013, 10:11 AM   |  #23  
Senior Member
Thanks Meter: 2
 
144 posts
Join Date:Joined: Nov 2005
Thumbs up
Quote:
Originally Posted by sordna

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!
Last edited by hkultraman; 6th December 2013 at 01:34 PM.
The Following User Says Thank You to hkultraman For This Useful Post: [ View ]
27th December 2013, 07:19 PM   |  #24  
Member
Thanks Meter: 2
 
40 posts
Join Date:Joined: Mar 2007
Quote:
Originally Posted by hkultraman

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.
28th December 2013, 06:47 AM   |  #25  
Senior Member
Thanks Meter: 2
 
144 posts
Join Date:Joined: Nov 2005
Quote:
Originally Posted by Captus

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

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
The Following User Says Thank You to hkultraman For This Useful Post: [ View ]
19th February 2014, 12:56 PM   |  #26  
Junior Member
Thanks Meter: 0
 
2 posts
Join Date:Joined: 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
Last edited by eledra; 19th February 2014 at 10:04 PM.
8th May 2014, 12:09 AM   |  #27  
Junior Member
Thanks Meter: 0
 
1 posts
Join Date:Joined: May 2014
Hi

Can someone help me? I am trying to run your commands to enable dual networks, only While trying to load this command: busybox insmod /system/lib/modules/cfg80211.kobusybox insmod /system/lib/modules/wlan.ko
It states not found.

Can any explain how to do this for me?
I'm rooted on stock 4.1 rom with busybox pro installed.

Sent from my SGH-T599N using XDA Free mobile app
11th May 2014, 12:55 PM   |  #28  
djawho's Avatar
Member
Flag paris
Thanks Meter: 3
 
41 posts
Join Date:Joined: Dec 2010
More
it's good
hi
have you create a app for that ?
20th May 2014, 04:23 PM   |  #29  
Junior Member
Thanks Meter: 0
 
1 posts
Join Date:Joined: May 2014
Quote:
Originally Posted by sordna

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,

I tried the similar as you did above with my nexus 4 but it seems to disconnect immediately after connecting:

Output of script:

1|root@mako:/mnt/sdcard/Scripts # sh dualnet_enable.sh
dhcpcd[27977]: version 5.5.6 starting
dhcpcd[27977]: wlan0: waiting for carrier
dhcpcd[27977]: wlan0: carrier acquired
dhcpcd[27977]: wlan0: rebinding lease of 192.168.64.124
dhcpcd[27977]: wlan0: carrier lost
dhcpcd[27977]: wlan0: carrier acquired
dhcpcd[27977]: wlan0: rebinding lease of 192.168.64.124
dhcpcd[27977]: wlan0: NAK: requested address not available from 192.168.64.1
dhcpcd[27977]: wlan0: broadcasting for a lease
dhcpcd[27977]: wlan0: offered 192.168.64.125 from 192.168.64.1
dhcpcd[27977]: wlan0: acknowledged 192.168.64.125 from 192.168.64.1
dhcpcd[27977]: wlan0: checking for 192.168.64.125
dhcpcd[27977]: wlan0: carrier lost
dhcpcd[27977]: wlan0: removing interface


Logcat:

I/wpa_supplicant(28194): wlan0: Trying to associate with SSID 'enga'
I/wpa_supplicant(28194): wlan0: Associated with 70:73:cb:b5:11:c1
I/wpa_supplicant(28194): wlan0: WPA: Key negotiation completed with 70:73:cb:b5:11:c1 [PTK=CCMP GTK=CCMP]
I/wpa_supplicant(28194): wlan0: CTRL-EVENT-CONNECTED - Connection to 70:73:cb:b5:11:c1 completed (auth) [id=0 id_str=]
I/wpa_supplicant(28194): wlan0: CTRL-EVENT-DISCONNECTED bssid=70:73:cb:b5:11:c1 reason=0 locally_generated=1
I/wpa_supplicant(28331): Successfully initialized wpa_supplicant
I/wpa_supplicant(28331): rfkill: Cannot open RFKILL control device
I/wpa_supplicant(28331): rfkill: Cannot open RFKILL control device
W/wpa_supplicant(28331): wlan0: Failed to initiate AP scan
W/wpa_supplicant(28331): wlan0: Failed to initiate AP scan
W/wpa_supplicant(28331): wlan0: Failed to initiate AP scan
I/wpa_supplicant(28331): CTRL_IFACE monitor[0]: 2 - No such file or directory
I/wpa_supplicant(28194): wlan0: Trying to associate with SSID 'enga'
I/wpa_supplicant(28194): wlan0: Associated with 70:73:cb:b5:11:c1
I/wpa_supplicant(28331): wlan0: No network configuration found for the current AP
I/wpa_supplicant(28331): wlan0: CTRL-EVENT-DISCONNECTED bssid=70:73:cb:b5:11:c1 reason=3 locally_generated=1
I/wpa_supplicant(28194): wlan0: CTRL-EVENT-DISCONNECTED bssid=70:73:cb:b5:11:c1 reason=0 locally_generated=1
I/wpa_supplicant(28194): wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
I/wpa_supplicant(28194): wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="enga" auth_failures=1 duration=10
W/wpa_supplicant(28194): wlan0: Failed to initiate AP scan

I tried both android 4.3 and 4.4.2, same error.

Jørgen
21st May 2014, 07:27 AM   |  #30  
sordna's Avatar
Senior Member
Thanks Meter: 596
 
1,123 posts
Join Date:Joined: Dec 2012
Quote:
Originally Posted by jorgenbl

I tried both android 4.3 and 4.4.2, same error.

Not sure what the reason could be. I'm on stock android, and have been using this since 4.3, and it worked in 4.3, 4.4, and now in 4.4.2. I just tried it and it still works. I get "carrier acquired" and I don't lose it afterwards. I get a dhcp lease for my wlan0 interface, and then dhcpcd forks in the background. I can ssh to my phone on my wifi LAN, and from there traceroute to external websites over my phone's cellular network verifying it uses that and not my home ISP.
"netcfg | grep UP" shows both my wlan0 and rmnet_usb0 interfaces having IP addresses and being up.
I can even proxy between my home wifi and my celullar carrier as if doing tethering, only using a proxy server on my phone instead (and specifying the phone's IP as the proxy in my home computers' browsers).

I also need to mention I use Franco kernel. Not sure if it makes a difference, but I believe franco kernel has the modules compiled in, and I don't need to "insmod" anything like some other folks seem to be doing.
Last edited by sordna; 21st May 2014 at 07:41 AM.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Q&A, Help & Troubleshooting by ThreadRank