diff --git a/include/wifi/hdf_wifi_event.h b/include/wifi/hdf_wifi_event.h index cfae47b1196f1caa733c350e92d162ee9052bc75..4aad40b7681bb68c0e0f7bc7c34d5dbf37c02411 100644 --- a/include/wifi/hdf_wifi_event.h +++ b/include/wifi/hdf_wifi_event.h @@ -474,7 +474,7 @@ int32_t HdfWifiEventEapolRecv(const char *name, void *context); * @since 1.0 * @version 1.0 */ -int32_t HdfWifiEventResetResult(const uint8_t chipId, int32_t resetStatus); +int32_t HdfWifiEventResetResult(const uint8_t chipId, int32_t resetStatus, const char *ifName); #ifdef __cplusplus #if __cplusplus diff --git a/model/network/wifi/core/module/wifi_base.c b/model/network/wifi/core/module/wifi_base.c index 6f291138754726fe06c5baac744584d3ed93d4bf..1857174d78e37adad2b741e48b5bf1f09474c256 100644 --- a/model/network/wifi/core/module/wifi_base.c +++ b/model/network/wifi/core/module/wifi_base.c @@ -1107,6 +1107,7 @@ static int32_t WifiCmdDoResetChip(const RequestContext *context, struct HdfSBuf { int32_t ret; uint8_t chipId; + const char *ifName = NULL; struct HdfWlanDevice *wlanDevice = NULL; ret = ResetParaCheck(context, reqData, rspData); @@ -1118,11 +1119,20 @@ static int32_t WifiCmdDoResetChip(const RequestContext *context, struct HdfSBuf HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "chipId"); return HDF_FAILURE; } + ifName = HdfSbufReadString(reqData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } /* callback function use chipId */ if (!HdfSbufWriteUint8(rspData, chipId)) { HDF_LOGE("%s: %s!", __func__, ERROR_DESC_WRITE_RSP_FAILED); return HDF_FAILURE; } + if (!HdfSbufWriteString(rspData, ifName)) { + HDF_LOGE("%s: Serialize failed!", __func__); + return HDF_FAILURE; + } ret = WifiResetEntranceCheck(chipId); if (ret != HDF_SUCCESS) { @@ -1156,6 +1166,7 @@ void SendMessageResetDriverCallBack(const RequestContext *context, struct HdfSBu ErrorCode rspCode) { uint8_t chipId; + const char *ifName = NULL; (void)context; if (rspData == NULL || reqData == NULL) { @@ -1167,8 +1178,13 @@ void SendMessageResetDriverCallBack(const RequestContext *context, struct HdfSBu HDF_LOGE("%s: read data failed! ParamName=%s", __func__, "chipId"); return; } + ifName = HdfSbufReadString(rspData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return; + } - int32_t ret = HdfWifiEventResetResult(chipId, rspCode); + int32_t ret = HdfWifiEventResetResult(chipId, rspCode, ifName); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: send resetDriver event fail!", __func__); } diff --git a/model/network/wifi/platform/src/hdf_wifi_event.c b/model/network/wifi/platform/src/hdf_wifi_event.c index 8ad90b5a24a594b19d20a1c5ac2d40d173d4d407..109577831121d85a2ec02e194a584ebdc97ff2b2 100644 --- a/model/network/wifi/platform/src/hdf_wifi_event.c +++ b/model/network/wifi/platform/src/hdf_wifi_event.c @@ -400,7 +400,7 @@ int32_t HdfWifiEventEapolRecv(const char *name, void *context) return ret; } -int32_t HdfWifiEventResetResult(const uint8_t chipId, int32_t resetStatus) +int32_t HdfWifiEventResetResult(const uint8_t chipId, int32_t resetStatus, const char *ifName) { struct HdfSBuf *data = NULL; int32_t ret; @@ -410,6 +410,11 @@ int32_t HdfWifiEventResetResult(const uint8_t chipId, int32_t resetStatus) HDF_LOGE("%s InitDataBlock failed", __func__); return HDF_FAILURE; } + if (!HdfSbufWriteString(data, ifName)) { + HDF_LOGE("%s: Serialize failed!", __func__); + HdfSBufRecycle(data); + return HDF_FAILURE; + } if (!HdfSbufWriteInt32(data, resetStatus)) { HDF_LOGE("%s sbuf write failed", __func__); HdfSBufRecycle(data);