summaryrefslogtreecommitdiffstats
path: root/core/jni/android_net_wifi_Wifi.cpp
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@sonyericsson.com>2010-04-07 16:45:58 +0200
committerJohan Redestig <johan.redestig@sonyericsson.com>2010-06-10 14:51:43 +0200
commitea8bd1d1676dd96f8f9726bb8f67fa18dec7b9c1 (patch)
treea872f24e1ee79dc729b5eb644e42128c6390abfe /core/jni/android_net_wifi_Wifi.cpp
parent9226a713ff7a372f8efc68c17da3ba8fd7f22365 (diff)
downloadframeworks_base-ea8bd1d1676dd96f8f9726bb8f67fa18dec7b9c1.zip
frameworks_base-ea8bd1d1676dd96f8f9726bb8f67fa18dec7b9c1.tar.gz
frameworks_base-ea8bd1d1676dd96f8f9726bb8f67fa18dec7b9c1.tar.bz2
WLAN: Reset power save mode to startup value after DHCP response.
When the driver was configured to run with power save mode disabled the power save mode incorrectly got reverted back to AUTO mode right after DHCP response. The power save mode value is now saved so that the device properly reverts back to a previous mode after DHCP response. Change-Id: I5035aad10146812ecef1be8ea4b22a03e230ccc9
Diffstat (limited to 'core/jni/android_net_wifi_Wifi.cpp')
-rw-r--r--core/jni/android_net_wifi_Wifi.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp
index 38f3fda..f5d9eb0 100644
--- a/core/jni/android_net_wifi_Wifi.cpp
+++ b/core/jni/android_net_wifi_Wifi.cpp
@@ -390,6 +390,20 @@ static jboolean android_net_wifi_setPowerModeCommand(JNIEnv* env, jobject clazz,
return (jboolean)!cmdTooLong && doBooleanCommand(cmdstr, "OK");
}
+static jint android_net_wifi_getPowerModeCommand(JNIEnv* env, jobject clazz)
+{
+ char reply[256];
+ int power;
+
+ if (doCommand("DRIVER GETPOWER", reply, sizeof(reply)) != 0) {
+ return (jint)-1;
+ }
+ // reply comes back in the form "powermode = XX" where XX is the
+ // number we're interested in.
+ sscanf(reply, "%*s = %u", &power);
+ return (jint)power;
+}
+
static jboolean android_net_wifi_setNumAllowedChannelsCommand(JNIEnv* env, jobject clazz, jint numChannels)
{
char cmdstr[256];
@@ -538,6 +552,7 @@ static JNINativeMethod gWifiMethods[] = {
{ "startPacketFiltering", "()Z", (void*) android_net_wifi_startPacketFiltering },
{ "stopPacketFiltering", "()Z", (void*) android_net_wifi_stopPacketFiltering },
{ "setPowerModeCommand", "(I)Z", (void*) android_net_wifi_setPowerModeCommand },
+ { "getPowerModeCommand", "()I", (void*) android_net_wifi_getPowerModeCommand },
{ "setNumAllowedChannelsCommand", "(I)Z", (void*) android_net_wifi_setNumAllowedChannelsCommand },
{ "getNumAllowedChannelsCommand", "()I", (void*) android_net_wifi_getNumAllowedChannelsCommand },
{ "setBluetoothCoexistenceModeCommand", "(I)Z",