Skip to content

Instantly share code, notes, and snippets.

@chartinger
Created November 2, 2014 09:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chartinger/2c4598859771dbd21474 to your computer and use it in GitHub Desktop.
Save chartinger/2c4598859771dbd21474 to your computer and use it in GitHub Desktop.
adb tether
http://rootzwiki.com/topic/41985-enable-wifi-tether-through-adb/
adb shell input keyevent 3 # home
adb shell am start -a android.intent.action.MAIN -n com.android.settings/.Settings
adb shell input keyevent 20 # down
adb shell input keyevent 20 # down
adb shell input keyevent 20 # down
adb shell input keyevent 66 # enter
adb shell input keyevent 20 # down
adb shell input keyevent 20 # down
adb shell input keyevent 66 # enter
adb shell input keyevent 20 # down
adb shell input keyevent 66 # enter
http://stackoverflow.com/questions/20226924/is-it-possible-to-usb-tether-an-android-device-using-adb-through-the-terminal
Must have root to change values with setprop, and I am on a Mac OS without a rndis driver so I could not test your method of USB tethering. Another way, if you have the connectivity service (adb shell service list):
adb shell su -c service call connectivity 34 i32 1 turns on USB tethering.
adb shell su -c service call connectivity 34 i32 0 turns off USB tethering.
Calls public int setUsbTethering(boolean enable) in android.net.IConnectivityManager.
http://stackoverflow.com/questions/12049547/how-i-can-enable-usb-tethering-programmatically-on-an-android-4-0-device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment