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

Search This thread

TrevE

Retired Recognized Developer
Apr 27, 2007
2,031
3,659
androidsecuritytest.com
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:
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)
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
-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:
[B]Netd-ndc mode[/B] (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 


[B]Netd mode[/B]
-/system/bin/netd (netd service)

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

[B]HostAP mode[/B] (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:
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.

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***
 
Last edited:

TrevE

Retired Recognized Developer
Apr 27, 2007
2,031
3,659
androidsecuritytest.com
FAQ


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:
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:
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:
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:
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:
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:
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
 
Last edited:

Jurassitol

Senior Member
Jul 13, 2012
273
64
Confirmed working on Beans build2, you totally rock.

+1 encryption breaks, unsecure works great.

Sent from my SCH-I535 using xda premium
 
Last edited:
  • Like
Reactions: TrevE

Alien-dx11

Senior Member
Aug 23, 2011
138
29
Works great without enabling the WiFi-Encryption, but when I do, it doesn't work...btw I'm on Synergy R111.
 

usatf1290

Senior Member
Nov 21, 2011
86
14
Confirmed working on CleanROM 4.5!! (unsecured)

+1 setting encryption breaks it. (setting it back to open fixes it)

progress!

Thank you so much!!
 

bond32

Senior Member
Jun 26, 2010
1,173
245
Franklin
Thank you very much for this. Been wanting to punch myself in the nuts every time I have to use the hotspot app because of the constant data drops.

Sent from my SCH-I535 using Tapatalk 2
 

open1your1eyes0

Senior Member
Dec 13, 2010
2,651
3,671
New York City
Last edited:

jjdevega

Senior Member
Jan 3, 2011
1,047
225
Bothell, Washington
VRBLJ1 stock. Not working no matter what settings I use. Not the one from the play store, neither this one. :/

Can't get it to show up in the Wifi list of connections on my laptop under any condition.

Ended up using this: https://play.google.com/store/apps/details?id=kr.core.technology.wifi.hotspot&hl=en

Bypasses the stock security check perfectly and uses native tethering. :)

^^^This! Thank you this worked after trying the moded wifi tether with no success.

Sent from my GT-N8013 using Tapatalk 2
 

quadracer06

Senior Member
Aug 27, 2007
80
14
Working on Jelly "Beans" build 2

Awesome! Works great! I was about to switch back to ICS because of not being able to tether and I am glad I waited! Thank you so much for this!
 

TrevE

Retired Recognized Developer
Apr 27, 2007
2,031
3,659
androidsecuritytest.com
Few things I've seen
-Encryption doesnt work.
Ill look into it, but I know its a longrunning bug for some devices. Use access control for now. I dont actually have a GS3 so its kinda a wonder this works at all :p

-Tether doesnt work
Please give some more details- what mode are you in regular or fallback?
does tethering turn on and show statistics at bottom of screen? if not what does the log show inside of wifitether? if so does windows see the accesspoint?

As far as Sprint LJ7 ill download the rom and check it but answers to above will help. a logcat of it turning on and off would be most helpful I threw a bunch of debugging lines in
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 275
    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:
    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)
    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
    -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:
    [B]Netd-ndc mode[/B] (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 
    
    
    [B]Netd mode[/B]
    -/system/bin/netd (netd service)
    
    --Commands are basically the same as above, but direct to netd service
    
    [B]HostAP mode[/B] (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:
    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.

    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***
    40
    FAQ


    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:
    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:
    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:
    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:
    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:
    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:
    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
    11
    askldfjalskdnflkasf
    10
    mineeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee :)
    9
    Guess androidfilehost is down