hostapd: Add debug level control

Add new API: setDebugParams

Bug: 129111866
Test: manual test
Test: atest VtsHalWifiHostapdV1_2TargetTest

Change-Id: I0e61db3d029c89380b687ecddd38a00aafcff0cc
This commit is contained in:
Roger Wang 2019-12-30 12:58:18 +08:00
parent 89642b46a8
commit 9e00293747
4 changed files with 39 additions and 2 deletions

View file

@ -650,8 +650,8 @@ a3eddd9bbdc87e8c22764070037dd1154f1cf006e6fba93364c4f85d4c134a19 android.hardwar
94e803236398bed1febb11cc21051bc42ec003700139b099d6c479e02a7ca3c3 android.hardware.neuralnetworks@1.3::IPreparedModelCallback
cf1d55e8c68300090747ab90b94c22e4c859b29c84ced68a317c595bb115eab2 android.hardware.neuralnetworks@1.3::types
3e01d4446cd69fd1c48f8572efd97487bc179564b32bd795800b97bbe10be37b android.hardware.wifi@1.4::IWifi
36b3acf78ac4ecf8156be8741c1d8332cdce7a1ebf4dfa1562952f14a94e6c87 android.hardware.wifi.hostapd@1.2::IHostapd
2defa258951e25a132aaeb36e3febe6f41bf9c6dbb1b1ebdf0b41708ab4e107e android.hardware.wifi.hostapd@1.2::types
9bc274c9d73aae170fd9e18df2476ade4c19b629cfb38dd03dd237a6cc2d932b android.hardware.wifi.hostapd@1.2::IHostapd
11f6448d15336361180391c8ebcdfd2d7cf77b3782d577e594d583aadc9c2877 android.hardware.wifi.hostapd@1.2::types
a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardware.wifi.supplicant@1.3::ISupplicant
c72cb37b3f66ef65aeb5c6438a3fbe17bbe847fdf62d1a76eafd7f3a8a526105 android.hardware.wifi.supplicant@1.3::ISupplicantStaIface
342a8e12db4dca643f2755eb4167e8f103d96502053a25a1f51f42107a4530f1 android.hardware.wifi.supplicant@1.3::ISupplicantStaIfaceCallback

View file

@ -21,6 +21,7 @@ import @1.1::IHostapd;
import HostapdStatus;
import MacAddress;
import Ieee80211ReasonCode;
import DebugLevel;
/**
* Top-level object for managing SoftAPs.
@ -120,4 +121,17 @@ interface IHostapd extends @1.1::IHostapd {
*/
forceClientDisconnect(string ifaceName, MacAddress clientAddress,
Ieee80211ReasonCode reasonCode) generates (HostapdStatus status);
/**
* Set debug parameters for the hostapd.
*
* @param level Debug logging level for the hostapd.
* (one of |DebugLevel| values).
* @return status Status of the operation.
* Possible status codes:
* |HostapdStatusCode.SUCCESS|,
* |HostapdStatusCode.FAILURE_UNKNOWN|
*/
setDebugParams(DebugLevel level)
generates (HostapdStatus status);
};

View file

@ -53,3 +53,17 @@ struct HostapdStatus {
*/
string debugMessage;
};
/**
* Debug levels for the hostapd.
* Only log messages with a level greater than the set level
* (via |setDebugParams|) will be logged.
*/
enum DebugLevel : uint32_t {
EXCESSIVE = 0,
MSGDUMP = 1,
DEBUG = 2,
INFO = 3,
WARNING = 4,
ERROR = 5
};

View file

@ -31,6 +31,7 @@ using ::android::sp;
using ::android::hardware::hidl_string;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::wifi::hostapd::V1_2::DebugLevel;
using ::android::hardware::wifi::hostapd::V1_2::HostapdStatusCode;
using ::android::hardware::wifi::hostapd::V1_2::Ieee80211ReasonCode;
using ::android::hardware::wifi::hostapd::V1_2::IHostapd;
@ -319,6 +320,14 @@ TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) {
EXPECT_EQ(HostapdStatusCode::FAILURE_CLIENT_UNKNOWN, status_1_2.code);
}
/*
* SetDebugParams
*/
TEST_P(HostapdHidlTest, SetDebugParams) {
auto status = HIDL_INVOKE(hostapd_, setDebugParams, DebugLevel::EXCESSIVE);
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
INSTANTIATE_TEST_CASE_P(
PerInstance, HostapdHidlTest,
testing::Combine(