зеркало из https://github.com/mozilla/gecko-dev.git
Bug 811635 - Part 5: Starting wpa_supplicant with proper 'p2pSupported' flag. r=vchang
We use 'ro.moz.wifi.p2p_supported' to determine if p2p is supported.
This commit is contained in:
Родитель
8ba8195b75
Коммит
200b1f45f3
|
@ -5,6 +5,7 @@
|
||||||
#include "WifiUtils.h"
|
#include "WifiUtils.h"
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <cutils/properties.h>
|
||||||
#include "prinit.h"
|
#include "prinit.h"
|
||||||
#include "js/CharacterEncoding.h"
|
#include "js/CharacterEncoding.h"
|
||||||
#include "NetUtils.h"
|
#include "NetUtils.h"
|
||||||
|
@ -34,6 +35,14 @@ GetSharedLibrary()
|
||||||
return sWifiLib;
|
return sWifiLib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
GetWifiP2pSupported()
|
||||||
|
{
|
||||||
|
char propP2pSupported[PROPERTY_VALUE_MAX];
|
||||||
|
property_get("ro.moz.wifi.p2p_supported", propP2pSupported, "0");
|
||||||
|
return (0 == strcmp(propP2pSupported, "1"));
|
||||||
|
}
|
||||||
|
|
||||||
// This is the same algorithm as in InflateUTF8StringToBuffer with Copy and
|
// This is the same algorithm as in InflateUTF8StringToBuffer with Copy and
|
||||||
// while ignoring invalids.
|
// while ignoring invalids.
|
||||||
// https://mxr.mozilla.org/mozilla-central/source/js/src/vm/CharacterEncoding.cpp#231
|
// https://mxr.mozilla.org/mozilla-central/source/js/src/vm/CharacterEncoding.cpp#231
|
||||||
|
@ -276,7 +285,7 @@ bool WpaSupplicant::ExecuteCommand(CommandOptions aOptions,
|
||||||
} else if (aOptions.mCmd.EqualsLiteral("unload_driver")) {
|
} else if (aOptions.mCmd.EqualsLiteral("unload_driver")) {
|
||||||
aResult.mStatus = mImpl->do_wifi_unload_driver();
|
aResult.mStatus = mImpl->do_wifi_unload_driver();
|
||||||
} else if (aOptions.mCmd.EqualsLiteral("start_supplicant")) {
|
} else if (aOptions.mCmd.EqualsLiteral("start_supplicant")) {
|
||||||
aResult.mStatus = mImpl->do_wifi_start_supplicant(0);
|
aResult.mStatus = mImpl->do_wifi_start_supplicant(GetWifiP2pSupported() ? 1 : 0);
|
||||||
} else if (aOptions.mCmd.EqualsLiteral("stop_supplicant")) {
|
} else if (aOptions.mCmd.EqualsLiteral("stop_supplicant")) {
|
||||||
aResult.mStatus = mImpl->do_wifi_stop_supplicant();
|
aResult.mStatus = mImpl->do_wifi_stop_supplicant();
|
||||||
} else if (aOptions.mCmd.EqualsLiteral("connect_to_supplicant")) {
|
} else if (aOptions.mCmd.EqualsLiteral("connect_to_supplicant")) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче