int createRingRequest(WifiRequest& request) { int result = request.create(GOOGLE_OUI, LOGGER_START_LOGGING); if (result != WIFI_SUCCESS) { ALOGE("Failed to create start ring logger request; result = %d", result); return result; } nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA); result = request.put_u32(LOGGER_ATTRIBUTE_LOG_LEVEL, mVerboseLevel); if (result != WIFI_SUCCESS) { ALOGE("Failed to put log level; result = %d", result); return result; } result = request.put_u32(LOGGER_ATTRIBUTE_RING_FLAGS, mFlags); if (result != WIFI_SUCCESS) { ALOGE("Failed to put ring flags; result = %d", result); return result; } result = request.put_u32(LOGGER_ATTRIBUTE_LOG_TIME_INTVAL, mMaxIntervalSec); if (result != WIFI_SUCCESS) { ALOGE("Failed to put log time interval; result = %d", result); return result; } result = request.put_u32(LOGGER_ATTRIBUTE_LOG_MIN_DATA_SIZE, mMinDataSize); if (result != WIFI_SUCCESS) { ALOGE("Failed to put min data size; result = %d", result); return result; } result = request.put_string(LOGGER_ATTRIBUTE_RING_NAME, mRingName); if (result != WIFI_SUCCESS) { ALOGE("Failed to put ringbuffer name; result = %d", result); return result; } request.attr_end(data); return WIFI_SUCCESS; }
int createRequest(WifiRequest &request) { int result; switch (mType) { case GET_FW_VER: { result = request.create(GOOGLE_OUI, LOGGER_GET_VER); if (result != WIFI_SUCCESS) { ALOGE("Failed to create get fw version request; result = %d", result); return result; } nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA); // Driver expecting only attribute type, passing mbuff as data with // length 0 to avoid undefined state result = request.put(LOGGER_ATTRIBUTE_FW_VER, mBuff, 0); if (result != WIFI_SUCCESS) { ALOGE("Failed to put get fw version request; result = %d", result); return result; } request.attr_end(data); break; } case GET_DRV_VER: { result = request.create(GOOGLE_OUI, LOGGER_GET_VER); if (result != WIFI_SUCCESS) { ALOGE("Failed to create get drv version request; result = %d", result); return result; } nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA); // Driver expecting only attribute type, passing mbuff as data with // length 0 to avoid undefined state result = request.put(LOGGER_ATTRIBUTE_DRIVER_VER, mBuff, 0); if (result != WIFI_SUCCESS) { ALOGE("Failed to put get drv version request; result = %d", result); return result; } request.attr_end(data); break; } case GET_RING_DATA: { result = request.create(GOOGLE_OUI, LOGGER_GET_RING_DATA); if (result != WIFI_SUCCESS) { ALOGE("Failed to create get ring data request; result = %d", result); return result; } nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA); result = request.put_string(LOGGER_ATTRIBUTE_RING_NAME, mRingName); if (result != WIFI_SUCCESS) { ALOGE("Failed to put ring data request; result = %d", result); return result; } request.attr_end(data); break; } case GET_RING_STATUS: { result = request.create(GOOGLE_OUI, LOGGER_GET_RING_STATUS); if (result != WIFI_SUCCESS) { ALOGE("Failed to create get ring status request; result = %d", result); return result; } break; } case GET_FEATURE: { result = request.create(GOOGLE_OUI, LOGGER_GET_FEATURE); if (result != WIFI_SUCCESS) { ALOGE("Failed to create get feature request; result = %d", result); return result; } break; } case START_RING_LOG: result = createRingRequest(request); break; default: ALOGE("Unknown Debug command"); result = WIFI_ERROR_UNKNOWN; } return result; }