Running the following command as root should enable USB tethering:
service call connectivity 32 i32 1
on Ice Cream Sandwich (4.0)service call connectivity 33 i32 1
on Jelly Bean (4.1 to 4.3)service call connectivity 34 i32 1
on KitKat (4.4)service call connectivity 30 i32 1
on Lollipop (5.0)service call connectivity 31 i32 1
on Lollipop (5.1) according to an answer by Firelordservice call connectivity 30 i32 1
on Marshmallow (6.0), untestedservice call connectivity 41 i32 1
on Samsung Marshmallow (6.0)service call connectivity 33 i32 1
on Nougat (7.0)service call connectivity 39 i32 1
on Samsung Nougat (7.0)
The first number you see in the commands is the setUsbTethering()
method's number in IConnectivityManager.aidl
(this depends on the Android version and doesn't exist on Gingerbread).
(Tip: to check this file for a particular Android version, select the appropriate branch.)
So what this command does is call setUsbTethering()
and pass either 1 (enable USB tethering) or 0 (to disable it).
For more information, see this related question on Stack Overflow.
If you're enabling USB tethering as part of a USB reverse tethering setup, setprop sys.usb.config rndis,adb
should be more than enough to get the rndis0
interface set up.