summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2012-11-03 23:21:39 -0700
committerIrfan Sheriff <isheriff@google.com>2012-11-06 15:55:30 -0800
commit745e7fd4e09db2b47371338ee54c54255e286473 (patch)
tree4b77c211236cbc49ca0789b01c752484ed9e80fc
parent62fcb21577ccdd68dddd6b6984ad0ce58ee0c228 (diff)
downloadhardware_libhardware_legacy-745e7fd4e09db2b47371338ee54c54255e286473.tar.gz
hardware_libhardware_legacy-745e7fd4e09db2b47371338ee54c54255e286473.tar.bz2
hardware_libhardware_legacy-745e7fd4e09db2b47371338ee54c54255e286473.zip
Fix stop supplicant api
Bug: 7227463 Change-Id: I4576e223c69dd67bd714fefecf0a1047770362fd
-rw-r--r--include/hardware_legacy/wifi.h2
-rw-r--r--wifi/wifi.c11
2 files changed, 11 insertions, 2 deletions
diff --git a/include/hardware_legacy/wifi.h b/include/hardware_legacy/wifi.h
index 4d051e7..be6a83e 100644
--- a/include/hardware_legacy/wifi.h
+++ b/include/hardware_legacy/wifi.h
@@ -55,7 +55,7 @@ int wifi_start_supplicant(int p2pSupported);
*
* @return 0 on success, < 0 on failure.
*/
-int wifi_stop_supplicant();
+int wifi_stop_supplicant(int p2pSupported);
/**
* Open a connection to supplicant on interface
diff --git a/wifi/wifi.c b/wifi/wifi.c
index d62b30f..b905897 100644
--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -604,11 +604,19 @@ int wifi_start_supplicant(int p2p_supported)
return -1;
}
-int wifi_stop_supplicant()
+int wifi_stop_supplicant(int p2p_supported)
{
char supp_status[PROPERTY_VALUE_MAX] = {'\0'};
int count = 50; /* wait at most 5 seconds for completion */
+ if (p2p_supported) {
+ strcpy(supplicant_name, P2P_SUPPLICANT_NAME);
+ strcpy(supplicant_prop_name, P2P_PROP_NAME);
+ } else {
+ strcpy(supplicant_name, SUPPLICANT_NAME);
+ strcpy(supplicant_prop_name, SUPP_PROP_NAME);
+ }
+
/* Check whether supplicant already stopped */
if (property_get(supplicant_prop_name, supp_status, NULL)
&& strcmp(supp_status, "stopped") == 0) {
@@ -625,6 +633,7 @@ int wifi_stop_supplicant()
}
usleep(100000);
}
+ ALOGE("Failed to stop supplicant");
return -1;
}