Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,742,083 Members 50,511 Now Online
XDA Developers Android and Mobile Development Forum

[App-Mod/Source] WifiTether for JB TouchWiz Roms

Tip us?
 
TrevE
Old
(Last edited by TrevE; 20th April 2013 at 06:16 AM.)
#1  
Retired Recognized Developer - OP
Thanks Meter 3653
Posts: 2,031
Join Date: Apr 2007

 
DONATE TO ME
Cool [App-Mod/Source] WifiTether for JB TouchWiz Roms

Before we start I have to throw out props to Eschelon, NxtGenCowboy, Virus, Ziggy471 and of course to the wifi-tether guys as well as cyanogen for the needed source/binaries (pre-11/18 versions) which allowed me to find the right path to get this 100% working. Also had awesome testers proxhack / jlmr731 and especially joshbeach. They all were essential to getting this all working. I still don't have a GS3 so poor Eschelon/NxtGenCowboy probably wiped/installed about 100 builds before this worked (and after when I lost source... grumble). Thanks to everyone that helped.

Legal/GPL Stuff
Carriers hate tethering, you all know that. Use at your own risk/with common sense & dont blame me for anything that goes wrong

WifiTether is under the GPLv3 license, so below is the source for the mods
Code:
Select Code
Original Source - https://code.google.com/p/android-wifi-tether/
Modded Source - http://svn.ziggy471.com/treve-tether

Configuration:
*Latest Build recommended, these are just a few devices I have tested on*

Setup-Method:: (auto should have right defaults, might need to force)
Quote:
Galaxy S3 - Netd-ndc with driver reload 2
Evo 3d SoftAP with driver reload 2
Sensation SoftAP with no driver reloads
Evo 4g SoftAP with no driver reloads
Other Settings
Quote:
-Device-Profile: Leave this on auto (default)
-Netdndc Max Client Cmd: Required for GS3ish devices. If not enabled you will likely get an AP but cannot connect.
-MSS clamping: on (default)
-Routing fix: on (default)
Heres some geek details on basic binaries how the backend of wifi-tether works. The main modes I played with and required files are as detailed below:
Code:
Select Code
Netd-ndc mode (Wifi Tether JB Default)
-/system/bin/ndc (wrapper for netd)
-/system/bin/netd (actual netd service)

--Commands Executed
/system/bin/ndc softap stopap
/system/bin/ndc softap stop wlan0
/system/bin/ndc softap fwreload wlan0 AP
/system/bin/ndc softap start wlan0
/system/bin/ndc softap set wlan0 wlan0 SSID encryption key channel (maxclients) 0 8
/system/bin/ndc softap startap
/system/bin/ndc interface setcfg wlan0 192.168.2.254 255.255.255.0 up 


Netd mode
-/system/bin/netd (netd service)

--Commands are basically the same as above, but direct to netd service

HostAP mode (used by stock tether app/fallback mode)
-/system/bin/hostap (hostap service, init.qcom.rc looks for config /data/hostapd/hostapd.conf)
New Options
Framework Tether(Fallback)
Use this if you have issues with wifitether mode. It forces on a wifihotspot using just framework. This has been reported to not throw up the paywall nag screen on some devices/carriers but YMMV. It may be able to be used nonroot as well if you ignore the initial warning.

Send NetdNDC Max Client CMD
This modifies the standard ndc command string to add in the Max Client parameter. More details are in post here

Wifi-Driver reload
This is the standard driver reload for wifi tether. It runs inside one script "./tether start|stop".

Wifi-Driver reload 2
This is a modified command that reloads firmware in a separate su request before the tether-edify code is run. May require SuperSU.apk

Use Cyanogen Hostapd Binary
This is the old method and is totally removed stating with the 11/20 update

The hostapd binary contained in atleast touchwiz JB contains extra fields explained above. If the extra commands are not working on X device you can try to fall back to this binary. This uses a dirty hack which installs hostapd and symlinks between versions for native or WifiTether mode. As long as you start and stop wifitether things should always line up. If you get into an issue where you crash things might get out of sync but should fix themselves next toggle of wifi tether. I have also added in menu items for the gs3 to manually swap binaries around.

*You must have a proper setup busybox for the GS3 code to work right. It moves system files around - you might win a reflash if things really go bad*
*Cyanogen Hostapd Symlink option only*- Make a system backup, it modifies sys files so theres a chance it will break something



Bugs
  • You might have to toggle stuff on and off once first if you run into errors. I think there's an error on first creation of config
  • If you switch modes between native wifitether and fallback mode (or stock tethering), your phone may spontaneously combust(wifi crashes) after the routing mess that ensues. Just reboot and you'll be all set again.
  • Seems to work better on SuperSU - Probably due to the per-app permissions vs per command.



Download:
**EVERY BUILD YOU MUST UNINSTALL OLD VERSIONS FIRST OR ATLEAST CLEAR APP DATA, IT DOES NOT UPGRADE NICELY**
-If you have problems, scroll down and read FAQ in post2 before posting

WifiTether-TrevE_Mod_04-17-2013.apk - Link Soon


Older Versions:
Quote:
WifiTether_TrevE_Mod_11_22_2012 (defaults to Wifi Driver Reload 1) - http://www.androidfilehost.com/?fid=9390195663897100312
WifiTether-TrevE_Mod_11_22_2012_driverReload2 (defaults to Wifi Driver Reload 2) - http://www.androidfilehost.com/?fid=9390208427046731813

Try to merge together what worked for everyone across different devices. There are 2 options in settings with mild enhancements
-Wifi-Driver Reload - Driver reload inside of tether script. Similar to 11/20 version
-Wifi-Driver Reload 2 - Driver reload outside of tether script. Similar to 11/18 version

Please report in with Carrier/Device and what option works best for you. Valid combinations are no reloads checked or one of the reload methods. Do not check both (theres no code to stop you from doing it now)
There is no code differences between the two apk versions, I just recently added in reload method 2 so rom devs can cook in whatever apk just works without changing settings.
Quote:
Apparently I botched code along the line somewhere between 18-20. Please let me know which one of these versions you are on and what works.

WifiTether_TrevE_Mod_11_20_2012_insmodv3.apk - If v2 doesnt work this should - http://www.androidfilehost.com/?fid=9390169635556426691
If insmod v2 doesnt work, insmod v3 switches to insmod on load, rrmod to unload, then reloads the driver when finished with with mfgloader -u / mfgloader -l

WifiTether_TrevE_Mod_11_20_2012_insmodv2.apk
- Hopefully working- http://www.androidfilehost.com/?fid=9390169635556426686
Driver Reload did not like loading with mfgloader in original build. This switches to insmod on load, mfgloader/rrmod to unload, then reloads the driver when finished with mfgloader -u / mfgloader -l

WifiTether_TrevE_Mod_11_20_2012.apk - Broken - Thanks halmo20 for catching that

GS3/E3D driver load/unload methods cleaned up, wifi driver reload checkbox should now be used, it was forced previously in code.

NetDndc Max client mode ported down to netd as well. Setting enables/disables with netd
all superuser code removed outside of tether binary, should have less popups for non-supersu users
Framework tether mode moved to setup
Fixed settings being applied reverting user settings at first start
All Cyanogen hostapd binary leftovers removed
Busybox check removed




WifiTether_TrevE_Mod_11_18_2012.apk - http://www.androidfilehost.com/?fid=9390190389996027907
Bam - Symlinks gone by default thanks joshbeach for all testing
New option Netdndc Max mode, this should be devices default setting.
Encryption works starting this build with netdndc max mode


WifiTether-TrevE_Mod_11-17-2012.apk - http://www.androidfilehost.com/?fid=9390188424645836869

cut down symlinks to only move hostapd around.
Made a checkbox that controls symlink code. Trying to axe it all. Moved this and fallback to settings screen. now save/load
define wifi.interface where it is undefined like on t0ltespr (hack to wire it to ndc settngs)
try to work with t0ltespr's /lib/ directory
cut down root code significantly (hopefully spam/timing issues resolved)

WifiTether_TrevE_Mod_11_15_12.apk -
Code cleanup
e3d code driver reload mess moved
samsung symlink mess in separate class, hoping to ditch this all soon
fallback mode in separate class, wired up to wifitether settings (encryption should work)


WifiTether_TrevE_Mod_11_12_12.apk - http://www.androidfilehost.com/?fid=9390169635556426338
***This app is signed with my certificate, you will need to uninstall old versions of wifitether first to use this***
DONATE TO THE EFF Let them know XDA-Developers sent you or you support the cause (https://www.eff.org/deeplinks/2011/1...s-legal-threat)
The Following 275 Users Say Thank You to TrevE For This Useful Post: [ Click to Expand ]
 
TrevE
Old
(Last edited by TrevE; 1st December 2012 at 05:20 AM.)
#2  
Retired Recognized Developer - OP
Thanks Meter 3653
Posts: 2,031
Join Date: Apr 2007

 
DONATE TO ME
FAQ
  • AP Starts but unable to connect - Make sure Send Netd max client mode option is on if your on JellyBean. read p1 for required settings
  • Tether does not start / Adapter does not work after tether- Try to turn off Wifi-Driver Reload #1 and turn on Wifi-Driver Reload #2
  • Tether cuts off on on charger connect/disconnect- Try to turn off connection optimizer. More here from eyecon82 http://forum.xda-developers.com/show...&postcount=148
    mystery_tx_man suggests removing connection manager apk - http://forum.xda-developers.com/show...&postcount=218
  • Phone takes back control of wifi- Youll notice a "What the hell" toast message. Somehow the phone moved wifi state, either you toggled an app that turns on wifi or some system process was thinking for you. Disable whatever is doing it.

    cyrnel suggests disabling wireless network location services - http://forum.xda-developers.com/show...&postcount=200

    If you get it on screen shut off try changing "Wifi During Sleep" - on htc its menu -> settings - wifi -> menu -> Advanced -> Keep Wifi on during sleep -> Always
  • You get a Tmobile Hotspot page-
    Changing APNs is reported to work by Gandoff without changing useragent- http://forum.xda-developers.com/show...&postcount=191

    Changing user agents works as described by mad_unix http://forum.xda-developers.com/show...9#post34388089 and free_man http://forum.xda-developers.com/show...9#post34500399

    open1your1eyes0 has some vpn setup links which should also work - http://forum.xda-developers.com/show...&postcount=211
  • XXXX still doesnt work - First try SuperSU. This will avoid a lot of headaches. Then make sure you are on latest version and that you have uninstalled/cleared app data when you went to a newer version. Read over the last few pages of thread at least too to make sure its not a known issue then go for it and post away. Make sure you include Carrier / Device / Rom / SU application.


Debugging Issues

For those people having issues on other gs3 like devices / roms / whatever I do not even have a gs3 so this is all blind. To try to help debugging I created a script to hopefully grab information needed. This should help from both working/nonworking devices to help eliminate the stupid symlink code and fix up other devices.

The scripts point is to try to get a working AP. If you can post how you did it and we can get source changed. By default it does no driver reloads and starts an Open AP with SSID TrevScript.

First grab the latest script from svn (ill update it with more info after I get some logs so make sure you have latest)

http://svn.ziggy471.com/treve-tether/ grab tetherdebug.sh
Code:
Select Code
adb push tetherdebug.sh /system/xbin/
adb shell chmod 755 /system/xbin/tetherdebug.sh
adb shell busybox dos2unix /system/xbin/tetherdebug.sh
Make sure wifi is on but do not start witfitethering. All you want to do is run "Set Binaries to WifiTether" option in the menu of app then follow below code

Code:
Select Code
adb shell su -c tetherdebug.sh
adb pull /data/local/tmp/tether.log
rename the file to tether_wifibinaries.log. Check to see if any AP is available.


now run "Set Binaries to Native" option in app and reboot device
adb reboot

When the device comes back up, rerun the script.
Code:
Select Code
adb shell su -c tetherdebug.sh
adb pull /data/local/tmp/tether.log
rename the file to tether_nativebinaries.log. Check to see if any AP is available.

reboot after you get the file.
adb reboot

ADVANCED
If you know what you are doing you can try to find a working combo. I added in the following command line args

ARG1 = ENCRYPTION. NONE/WPA2
ARG2 = DRIVERRELOAD. NONE/insmod/mfgloader
ARG3 = DRIVERTOLOAD. /system/lib/modules/dhd.ko (or whatever module is, required if ARG2 is set)


Examples:
Make sure wifi is on but do not start witfitethering. All you want to do is run "Set Binaries to WifiTether" option in the menu of app to start with a known working base then follow below code

try no encryption with insmod where your wifi module is /system/lib/modules/dhd.ko
Code:
Select Code
adb shell su -c tetherdebug.sh NONE insmod /system/lib/modules/dhd.ko
try no encryption with mfgloader where your wifi module is /system/lib/modules/dhd.ko
Code:
Select Code
adb shell su -c tetherdebug.sh NONE mfgloader /system/lib/modules/dhd.ko
try wpa2 (password is Trev) with insmod where your wifi module is /system/lib/modules/dhd.ko
Code:
Select Code
adb shell su -c tetherdebug.sh WPA2 insmod /system/lib/modules/dhd.ko
There shouldn't be personal information in the debug logs, the most I can think of that would be displayed is if you have an encryption passphrase set in wifitether. Sending the 2 files named with what mode you were in will help get it going elsewhere and hopefully kill the symlink code
DONATE TO THE EFF Let them know XDA-Developers sent you or you support the cause (https://www.eff.org/deeplinks/2011/1...s-legal-threat)
The Following 39 Users Say Thank You to TrevE For This Useful Post: [ Click to Expand ]
 
Virus
Old
#3  
Virus's Avatar
Senior Recognized Developer
Thanks Meter 9262
Posts: 3,914
Join Date: Oct 2009
Location: COLUMBIA

 
DONATE TO ME
mineeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

The Following 10 Users Say Thank You to Virus For This Useful Post: [ Click to Expand ]
 
eschelon
Old
#4  
eschelon's Avatar
Recognized Developer
Thanks Meter 8965
Posts: 1,388
Join Date: Jun 2009

 
DONATE TO ME
askldfjalskdnflkasf
The Following 11 Users Say Thank You to eschelon For This Useful Post: [ Click to Expand ]
 
prdog1
Old
#5  
prdog1's Avatar
Recognized Contributor
Thanks Meter 4420
Posts: 7,780
Join Date: Mar 2012
Location: Houston, Texas
Worked great right out the box on Synergy Rev 111. Great job Trev.
TEAM MiK / TEAM CLEAN
Current Devices:
Samsung Galaxy SIII-I535
The Following User Says Thank You to prdog1 For This Useful Post: [ Click to Expand ]
 
jlyle
Old
#6  
jlyle's Avatar
Senior Member
Thanks Meter 637
Posts: 672
Join Date: Nov 2012
Location: On The Lake
worked like a charm

Thanks guys
The Following 2 Users Say Thank You to jlyle For This Useful Post: [ Click to Expand ]
 
bearklaws
Old
(Last edited by bearklaws; 13th November 2012 at 03:50 AM.)
#7  
Senior Member
Thanks Meter 2
Posts: 115
Join Date: Aug 2010
downloading now. Thank you very much... great work...





And working great....
The Following 2 Users Say Thank You to bearklaws For This Useful Post: [ Click to Expand ]
 
NxtGenCowboy
Old
#8  
NxtGenCowboy's Avatar
Senior Member
Thanks Meter 179
Posts: 419
Join Date: Dec 2007
Location: Chicago,IL
BAM!

Sent from the 3rd Galaxy
The Following 2 Users Say Thank You to NxtGenCowboy For This Useful Post: [ Click to Expand ]
 
Jurassitol
Old
(Last edited by Jurassitol; 13th November 2012 at 04:16 AM.)
#9  
Jurassitol's Avatar
Senior Member
Thanks Meter 60
Posts: 270
Join Date: Jul 2012
Confirmed working on Beans build2, you totally rock.

+1 encryption breaks, unsecure works great.

Sent from my SCH-I535 using xda premium
The Following User Says Thank You to Jurassitol For This Useful Post: [ Click to Expand ]
 
jlmr731
Old
#10  
Member
Thanks Meter 33
Posts: 81
Join Date: Jul 2012
Location: over here
cannot connect with wifi encryption

other than that working

big thanks

The Following User Says Thank You to jlmr731 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes