1

Is there a way to enable the USB Tethering option in Android 2.2 FRG22D using a shell command?

My goal is turn a Motorola Droid running Android 2.2 into a micro server. This device cannot connect to 3G and Wifi is not option. The device will always be connected via USB to a computer with a network connection. I have gotten the reverse tethering working, but I still have to manually check the USB Tethering check box (Settings->Wireless & Networks -> Tethering -> USB Tethering) every time the USB connection resets (such as when the computer is rebooted, the cable is unplugged, etc). My goal is write a script that can be ran on the host computer to bring the USB Tethering up without having to touch the Droid (I have root access and the device will always be connected via USB so I can issue shell commands using ADB).

I have been searching for a shell command to do this but nothing has turned up. Another possible solution is that I could write a small app (either using the NDK or SDK) and call that from the script, but again I cannot find any information on how to change system settings (at least network level settings) via code.

Any suggestions?

1
  • After searching the android source code I found 2 possible solutions. "IConnectivityManager.tether(String iface)" and "int CommandListener::TetherCmd::runCommand(SocketClient *cli, int argc, char **argv)". But I cannot seem to figure out how to use either method. The first would be via Java, the second would be a native app. Commented Nov 21, 2010 at 6:11

1 Answer 1

1

in the source code of Settings app, mWifiManager.setWifiApEnabled(null, enable) is used, but this functionality seems to be missing in the SDK (checked 2.2 and 2.3).

Sign up to request clarification or add additional context in comments.

2 Comments

Yes, this would be missing as it's the kind of functionality android does not have any mechanism in place to authorize to an SDK app, but only permits as a result of direct user interaction.
Thanks, I will look into this when I have time again, but from I have seen thus far it will have to be an NDK level app as there appears to be no way to access these settings via the SDK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.