From ae677e4fb0ca192a946d1bed941d3f14f4335bd7 Mon Sep 17 00:00:00 2001 From: YOUR_NAME Date: Wed, 28 Jul 2021 03:21:35 +0000 Subject: [PATCH 1/3] =?UTF-8?q?Description:L2=20p2p=20=E7=89=B9=E6=80=A7?= =?UTF-8?q?=E9=80=82=E9=85=8D=20Feature=20or=20Bugfix:Feature=20Binary=20S?= =?UTF-8?q?ource:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: YOUR_NAME --- include/wifi/hdf_wifi_event.h | 4 + include/wifi/wifi_mac80211_ops.h | 28 +- model/network/wifi/core/module/wifi_base.c | 395 +++++++++++++++++- model/network/wifi/include/hdf_wifi_cmd.h | 10 + .../wifi/platform/include/hdf_wlan_services.h | 7 + .../wifi/platform/src/hdf_wifi_event.c | 45 ++ 6 files changed, 485 insertions(+), 4 deletions(-) diff --git a/include/wifi/hdf_wifi_event.h b/include/wifi/hdf_wifi_event.h index 4aad40b76..3cccdb6ef 100644 --- a/include/wifi/hdf_wifi_event.h +++ b/include/wifi/hdf_wifi_event.h @@ -476,6 +476,10 @@ int32_t HdfWifiEventEapolRecv(const char *name, void *context); */ int32_t HdfWifiEventResetResult(const uint8_t chipId, int32_t resetStatus, const char *ifName); +int32_t HdfWifiEventRemainOnChannel(const struct NetDevice *netDev, uint32_t freq, uint32_t duration); + +int32_t HdfWifiEventCancelRemainOnChannel(const struct NetDevice *netDev, uint32_t freq); + #ifdef __cplusplus #if __cplusplus } diff --git a/include/wifi/wifi_mac80211_ops.h b/include/wifi/wifi_mac80211_ops.h index 4e1244bfb..7869d6c48 100644 --- a/include/wifi/wifi_mac80211_ops.h +++ b/include/wifi/wifi_mac80211_ops.h @@ -168,7 +168,14 @@ enum Ieee80211ChannelWidth { */ enum WlanWorkMode { WLAN_WORKMODE_STA = 2, /**< STA mode */ - WLAN_WORKMODE_AP = 3 /**< AP mode */ + WLAN_WORKMODE_AP = 3, /**< AP mode */ + WLAN_WORKMODE_AP_VLAN, + WLAN_WORKMODE_WDS, + WLAN_WORKMODE_MONITOR, + WLAN_WORKMODE_MESH_POINT, + WLAN_WORKMODE_P2P_CLIENT, + WLAN_WORKMODE_P2P_GO, + WLAN_WORKMODE_P2P_DEVICE, }; /** @@ -302,7 +309,7 @@ struct WlanScanRequest { uint8_t freqsCount; /**< Number of frequencies */ uint8_t *bssid; /**< BSSID to scan for */ struct WlanSSID *ssids; /**< SSIDs to scan for */ - uint16_t *freqs; /**< An array of frequencies */ + uint32_t *freqs; /**< An array of frequencies */ uint32_t extraIEsLen; /**< Length of an extended information element (IE) */ uint8_t *extraIEs; /**< Extended IEs */ }; @@ -581,6 +588,23 @@ struct HdfMac80211BaseOps { * @version 1.0 */ int32_t (*GetHwCapability)(NetDevice *netDev, struct WlanHwCapability **capability); + + int32_t (*RemainOnChannel)(NetDevice *netDev, WifiOnChannel *onChannel); + + int32_t (*CancelRemainOnChannel)(NetDevice *netDev); + + int32_t (*ProbeReqReport)(NetDevice *netDev, int32_t report); + + int32_t (*AddIf)(NetDevice *netDev, WifiIfAdd *ifAdd); + + int32_t (*RemoveIf)(NetDevice *netDev, WifiIfRemove *ifRemove); + + int32_t (*SetApWpsP2pIe)(NetDevice *netDev, WifiAppIe *appIe); + + int32_t (*GetDriverFlag)(struct NetDevice *netDev, WifiGetDrvFlags **params); + + int32_t (*SendAction)(struct NetDevice *netDev, WifiActionData *actionData); + }; /** diff --git a/model/network/wifi/core/module/wifi_base.c b/model/network/wifi/core/module/wifi_base.c index 1857174d7..40406bfa4 100644 --- a/model/network/wifi/core/module/wifi_base.c +++ b/model/network/wifi/core/module/wifi_base.c @@ -719,13 +719,70 @@ static int32_t WifiSendMlme(const RequestContext *context, struct HdfSBuf *reqDa return HDF_SUCCESS; } +int32_t SendAction(struct NetDevice *netdev, WifiActionData *actionData) +{ + struct HdfChipDriver *chipDriver = GetChipDriver(netdev); + if (chipDriver == NULL) { + HDF_LOGE("%s:bad net device found!", __func__); + return HDF_FAILURE; + } + + RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->ops, SendAction); + return chipDriver->ops->SendAction(netdev, actionData); +} + static int32_t WifiCmdSendAction(const RequestContext *context, struct HdfSBuf *reqData, struct HdfSBuf *rspData) { + WifiActionData actionData = {0}; + const char *ifName = NULL; + uint32_t dataSize = 0; + struct NetDevice *netdev = NULL; + (void)context; - (void)reqData; (void)rspData; + if (reqData == NULL) { + HDF_LOGE("%s:reqData is NULL", __func__); + return HDF_ERR_INVALID_PARAM; + } + ifName = HdfSbufReadString(reqData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } - return HDF_SUCCESS; + if (!HdfSbufReadBuffer(reqData, (const void **)&(actionData.bssid), &dataSize) || + dataSize != ETH_ADDR_LEN) { + HDF_LOGE("%s: %s!ParamName=%s,readSize=%u", __func__, ERROR_DESC_READ_REQ_FAILED, "bssid", dataSize); + return HDF_FAILURE; + } + + if (!HdfSbufReadBuffer(reqData, (const void **)&(actionData.dst), &dataSize) || + dataSize != ETH_ADDR_LEN) { + HDF_LOGE("%s: %s!ParamName=%s,readSize=%u", __func__, ERROR_DESC_READ_REQ_FAILED, "dst", dataSize); + return HDF_FAILURE; + } + + if (!HdfSbufReadBuffer(reqData, (const void **)&(actionData.src), &dataSize) || + dataSize != ETH_ADDR_LEN) { + HDF_LOGE("%s: %s!ParamName=%s,readSize=%u", __func__, ERROR_DESC_READ_REQ_FAILED, "src", dataSize); + return HDF_FAILURE; + } + + if (!HdfSbufReadBuffer(reqData, (const void **)&(actionData.data), &(actionData.dataLen))) { + HDF_LOGE("%s: %s!ParamName=%s,readSize=%u", __func__, ERROR_DESC_READ_REQ_FAILED, "data", actionData.dataLen); + return HDF_FAILURE; + } + netdev = NetDeviceGetInstByName(ifName); + if (netdev == NULL || netdev->netDeviceIf == NULL) { + HDF_LOGE("%s:netdev not found!ifName=%s", __func__, ifName); + return HDF_FAILURE; + } + + int ret = SendAction(netdev, &actionData); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: fail to remain on channel,%d", __func__, ret); + } + return ret; } static int32_t WifiCmdGetNetworkInfo(const RequestContext *context, struct HdfSBuf *reqData, struct HdfSBuf *rspData) @@ -1214,6 +1271,333 @@ static int32_t WifiCmdResetDriver(const RequestContext *context, struct HdfSBuf return ret; } +static int32_t RemainOnChannel(struct NetDevice *netdev, WifiOnChannel *onChannel) +{ + struct HdfChipDriver *chipDriver = GetChipDriver(netdev); + if (chipDriver == NULL) { + HDF_LOGE("%s:bad net device found!", __func__); + return HDF_FAILURE; + } + + RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->ops, RemainOnChannel); + return chipDriver->ops->RemainOnChannel(netdev, onChannel); +} + +static int32_t WifiCmdRemainOnChannel(const RequestContext *context, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +{ + int32_t ret; + struct NetDevice *netdev = NULL; + const char *ifName = NULL; + WifiOnChannel wifiOnChannel = {0}; + + (void)context; + if (reqData == NULL || rspData == NULL) { + return HDF_ERR_INVALID_PARAM; + } + ifName = HdfSbufReadString(reqData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } + netdev = NetDeviceGetInstByName(ifName); + if (netdev == NULL) { + HDF_LOGE("%s: netdev not found!ifName=%s", __func__, ifName); + return HDF_FAILURE; + } + if (!HdfSbufReadUint32(reqData, &(wifiOnChannel.freq))) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "freq"); + return HDF_FAILURE; + } + if (!HdfSbufReadUint32(reqData, &(wifiOnChannel.duration))) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "duration"); + return HDF_FAILURE; + } + ret = RemainOnChannel(netdev, &wifiOnChannel); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: fail to remain on channel,%d",__func__, ret); + } + return ret; +} + +static int32_t ProbeReqReport(struct NetDevice *netdev, int32_t report) +{ + struct HdfChipDriver *chipDriver = GetChipDriver(netdev); + if (chipDriver == NULL) { + HDF_LOGE("%s:bad net device found!", __func__); + return HDF_FAILURE; + } + + RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->ops, ProbeReqReport); + return chipDriver->ops->ProbeReqReport(netdev, report); +} + +static int32_t WifiCmdProbeReqReport(const RequestContext *context, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +{ + int32_t ret; + struct NetDevice *netdev = NULL; + const char *ifName = NULL; + int32_t report; + + (void)context; + if (reqData == NULL || rspData == NULL) { + return HDF_ERR_INVALID_PARAM; + } + ifName = HdfSbufReadString(reqData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } + netdev = NetDeviceGetInstByName(ifName); + if (netdev == NULL) { + HDF_LOGE("%s: netdev not found!ifName=%s", __func__, ifName); + return HDF_FAILURE; + } + if (!HdfSbufReadInt32(reqData,&(report))) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "report"); + return HDF_FAILURE; + } + + ret = ProbeReqReport(netdev, report); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: fail to probe req report,%d",__func__, ret); + } + return ret; +} + +static int32_t CancelRemainOnChannel(struct NetDevice *netdev) +{ + struct HdfChipDriver *chipDriver = GetChipDriver(netdev); + if (chipDriver == NULL) { + HDF_LOGE("%s:bad net device found!", __func__); + return HDF_FAILURE; + } + + RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->ops, CancelRemainOnChannel); + return chipDriver->ops->CancelRemainOnChannel(netdev); +} + +static int32_t WifiCmdCancelRemainOnChannel(const RequestContext *context, struct HdfSBuf *reqData, + struct HdfSBuf *rspData) +{ + int32_t ret; + struct NetDevice *netdev = NULL; + const char *ifName = NULL; + + (void)context; + if (reqData == NULL || rspData == NULL) { + return HDF_ERR_INVALID_PARAM; + } + ifName = HdfSbufReadString(reqData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } + netdev = NetDeviceGetInstByName(ifName); + if (netdev == NULL) { + HDF_LOGE("%s: netdev not found!ifName=%s", __func__, ifName); + return HDF_FAILURE; + } + + ret = CancelRemainOnChannel(netdev); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: fail to cancel remain on channel,%d",__func__, ret); + } + return ret; +} + +static int32_t AddIf(struct NetDevice *netdev, WifiIfAdd *ifAdd) +{ + struct HdfChipDriver *chipDriver = GetChipDriver(netdev); + if (chipDriver == NULL) { + HDF_LOGE("%s:bad net device found!", __func__); + return HDF_FAILURE; + } + + RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->ops, AddIf); + return chipDriver->ops->AddIf(netdev, ifAdd); +} + +static int32_t WifiCmdAddIf(const RequestContext *context, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +{ + int32_t ret; + struct NetDevice *netdev = NULL; + const char *ifName = NULL; + WifiIfAdd ifAdd = {0}; + + (void)context; + if (reqData == NULL || rspData == NULL) { + return HDF_ERR_INVALID_PARAM; + } + ifName = HdfSbufReadString(reqData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } + netdev = NetDeviceGetInstByName(ifName); + if (netdev == NULL) { + HDF_LOGE("%s: netdev not found!ifName=%s", __func__, ifName); + return HDF_FAILURE; + } + + if (!HdfSbufReadUint8(reqData, &(ifAdd.type))) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "type"); + return HDF_FAILURE; + } + + ret = AddIf(netdev, &ifAdd); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: fail to cancel remain on channel,%d",__func__, ret); + } + return ret; +} + +static int32_t RemoveIf(struct NetDevice *netdev, WifiIfRemove *ifRemove) +{ + struct HdfChipDriver *chipDriver = GetChipDriver(netdev); + if (chipDriver == NULL) { + HDF_LOGE("%s:bad net device found!", __func__); + return HDF_FAILURE; + } + + RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->ops, RemoveIf); + return chipDriver->ops->RemoveIf(netdev, ifRemove); +} + +static int32_t WifiCmdRemoveIf(const RequestContext *context, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +{ + int32_t ret; + struct NetDevice *netdev = NULL; + const char *ifName = NULL; + WifiIfRemove *ifRemove = NULL; + + (void)context; + if (reqData == NULL || rspData == NULL) { + return HDF_ERR_INVALID_PARAM; + } + ifName = HdfSbufReadString(reqData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } + netdev = NetDeviceGetInstByName(ifName); + if (netdev == NULL) { + HDF_LOGE("%s: netdev not found!ifName=%s", __func__, ifName); + return HDF_FAILURE; + } + + uint32_t dataSize = 0; + if (!HdfSbufReadBuffer(reqData, (const void **)&(ifRemove), &dataSize) || dataSize != sizeof(WifiIfRemove)) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } + ret = RemoveIf(netdev, ifRemove); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: fail to remove interface,%d",__func__, ret); + } + return ret; +} + +static int32_t SetApWpsP2pIe(struct NetDevice *netdev, WifiAppIe *appIe) +{ + struct HdfChipDriver *chipDriver = GetChipDriver(netdev); + if (chipDriver == NULL) { + HDF_LOGE("%s:bad net device found!", __func__); + return HDF_FAILURE; + } + + RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->ops, SetApWpsP2pIe); + return chipDriver->ops->SetApWpsP2pIe(netdev, appIe); +} + +static int32_t WifiCmdSetApWpsP2pIe(const RequestContext *context, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +{ + int32_t ret; + struct NetDevice *netdev = NULL; + const char *ifName = NULL; + WifiAppIe appIe = {0}; + + (void)context; + if (reqData == NULL || rspData == NULL) { + return HDF_ERR_INVALID_PARAM; + } + ifName = HdfSbufReadString(reqData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } + netdev = NetDeviceGetInstByName(ifName); + if (netdev == NULL) { + HDF_LOGE("%s: netdev not found!ifName=%s", __func__, ifName); + return HDF_FAILURE; + } + + if (!HdfSbufReadUint32(reqData, &(appIe.ieLen))) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ieLen"); + return HDF_FAILURE; + } + if (!HdfSbufReadUint8(reqData, &(appIe.appIeType))) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "appIeType"); + return HDF_FAILURE; + } + if (!HdfSbufReadBuffer(reqData, (const void**)&(appIe.ie), &(appIe.ieLen))) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "appIeType"); + return HDF_FAILURE; + } + ret = SetApWpsP2pIe(netdev, &appIe); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: fail to setapwpsp2pie,%d",__func__, ret); + } + return ret; +} + +int32_t GetDriverFlag (struct NetDevice *netdev, WifiGetDrvFlags **params) +{ + struct HdfChipDriver *chipDriver = GetChipDriver(netdev); + if (chipDriver == NULL) { + HDF_LOGE("%s:bad net device found!", __func__); + return HDF_FAILURE; + } + + RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->ops, GetDriverFlag); + return chipDriver->ops->GetDriverFlag(netdev, params); +} + +static int32_t WifiCmdGetDriverFlag(const RequestContext *context, struct HdfSBuf *reqData, struct HdfSBuf *rspData) +{ + int32_t ret; + struct NetDevice *netdev = NULL; + const char *ifName = NULL; + WifiGetDrvFlags *params = NULL; + + (void)context; + if (reqData == NULL || rspData == NULL) { + return HDF_ERR_INVALID_PARAM; + } + ifName = HdfSbufReadString(reqData); + if (ifName == NULL) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "ifName"); + return HDF_FAILURE; + } + netdev = NetDeviceGetInstByName(ifName); + if (netdev == NULL) { + HDF_LOGE("%s: netdev not found!ifName=%s", __func__, ifName); + return HDF_FAILURE; + } + + ret = GetDriverFlag(netdev, ¶ms); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: fail to getdriverflag,%d",__func__, ret); + } + + if (!HdfSbufWriteUint64(rspData, params->drvFlags)) { + HDF_LOGE("%s:%s!", __func__, ERROR_DESC_WRITE_RSP_FAILED); + ret = HDF_ERR_IO; + } + + HDF_LOGE("WifiCmdGetDriverFlag:%lx", params->drvFlags); + return ret; +} + static struct MessageDef g_wifiBaseFeatureCmds[] = { DUEMessage(CMD_BASE_NEW_KEY, WifiCmdNewKey, 0), DUEMessage(CMD_BASE_DEL_KEY, WifiCmdDelKey, 0), @@ -1240,6 +1624,13 @@ static struct MessageDef g_wifiBaseFeatureCmds[] = { DUEMessage(CMD_BASE_GET_IFNAMES, WifiCmdGetIfNamesByChipId, 0), DUEMessage(CMD_BASE_RESET_DRIVER, WifiCmdResetDriver, 0), DUEMessage(CMD_BASE_DO_RESET_PRIVATE, WifiCmdDoResetChip, 0), + DUEMessage(CMD_P2P_PROBE_REQ_REPORT, WifiCmdProbeReqReport, 0), + DUEMessage(CMD_P2P_REMAIN_ON_CHANNEL, WifiCmdRemainOnChannel, 0), + DUEMessage(CMD_P2P_CANCEL_REMAIN_ON_CHANNEL, WifiCmdCancelRemainOnChannel, 0), + DUEMessage(CMD_P2P_ADD_IF, WifiCmdAddIf, 0), + DUEMessage(CMD_P2P_REMOVE_IF, WifiCmdRemoveIf, 0), + DUEMessage(CMD_P2P_SET_AP_WPS_P2P_IE, WifiCmdSetApWpsP2pIe, 0), + DUEMessage(CMD_P2P_GET_DRIVER_FLAGS, WifiCmdGetDriverFlag, 0), }; ServiceDefine(BaseService, BASE_SERVICE_ID, g_wifiBaseFeatureCmds); diff --git a/model/network/wifi/include/hdf_wifi_cmd.h b/model/network/wifi/include/hdf_wifi_cmd.h index 9f0f17c00..b753efece 100644 --- a/model/network/wifi/include/hdf_wifi_cmd.h +++ b/model/network/wifi/include/hdf_wifi_cmd.h @@ -206,6 +206,16 @@ typedef struct { } WifiActionData; typedef struct { +typedef struct { + uint8_t type; +} WifiIfAdd; + +typedef struct { + uint32_t ieLen; + uint8_t appIeType; + uint8_t rsv[3]; + uint8_t *ie; +} WifiAppIe; int32_t mode; int32_t freq; int32_t channel; diff --git a/model/network/wifi/platform/include/hdf_wlan_services.h b/model/network/wifi/platform/include/hdf_wlan_services.h index cbc7e5fbc..ad4e1148d 100644 --- a/model/network/wifi/platform/include/hdf_wlan_services.h +++ b/model/network/wifi/platform/include/hdf_wlan_services.h @@ -43,6 +43,13 @@ enum BaseCommands { CMD_BASE_GET_IFNAMES, CMD_BASE_RESET_DRIVER, CMD_BASE_DO_RESET_PRIVATE = 25, + CMD_P2P_PROBE_REQ_REPORT = 26, + CMD_P2P_REMAIN_ON_CHANNEL, + CMD_P2P_CANCEL_REMAIN_ON_CHANNEL, + CMD_P2P_ADD_IF, + CMD_P2P_REMOVE_IF, + CMD_P2P_SET_AP_WPS_P2P_IE, + CMD_P2P_GET_DRIVER_FLAGS, }; enum APCommands { diff --git a/model/network/wifi/platform/src/hdf_wifi_event.c b/model/network/wifi/platform/src/hdf_wifi_event.c index 109577831..e519a13fc 100644 --- a/model/network/wifi/platform/src/hdf_wifi_event.c +++ b/model/network/wifi/platform/src/hdf_wifi_event.c @@ -430,6 +430,51 @@ int32_t HdfWifiEventResetResult(const uint8_t chipId, int32_t resetStatus, const return ret; } +int32_t HdfWifiEventRemainOnChannel(const struct NetDevice *netDev, uint32_t freq, uint32_t duration) +{ + struct HdfSBuf *data = NULL; + int32_t ret; + + data = HdfSBufObtainDefaultSize(); + if (data == NULL) { + HDF_LOGE("%s InitDataBlock failed", __func__); + return HDF_FAILURE; + } + if (!HdfSbufWriteString(data, netDev->name) || !HdfSbufWriteUint32(data, freq)) { + HDF_LOGE("%s sbuf write failed", __func__); + HdfSBufRecycle(data); + return HDF_FAILURE; + } + if (!HdfSbufWriteUint32(data, duration)) { + HDF_LOGE("%s sbuf write failed", __func__); + HdfSBufRecycle(data); + return HDF_FAILURE; + } + ret = HdfWlanSendBroadcastEvent(WIFI_WPA_EVENT_REMAIN_ON_CHANNEL, data); + HdfSBufRecycle(data); + return ret; +} + +int32_t HdfWifiEventCancelRemainOnChannel(const struct NetDevice *netDev, uint32_t freq) +{ + struct HdfSBuf *data = NULL; + int32_t ret; + + data = HdfSBufObtainDefaultSize(); + if (data == NULL) { + HDF_LOGE("%s InitDataBlock failed", __func__); + return HDF_FAILURE; + } + if (!HdfSbufWriteString(data, netDev->name) || !HdfSbufWriteUint32(data, freq)) { + HDF_LOGE("%s sbuf write failed", __func__); + HdfSBufRecycle(data); + return HDF_FAILURE; + } + ret = HdfWlanSendBroadcastEvent(WIFI_WPA_EVENT_CANCEL_REMAIN_ON_CHANNEL, data); + HdfSBufRecycle(data); + return ret; +} + #ifdef __cplusplus #if __cplusplus } -- Gitee From 5d3e9a9e6caa0487f2d477a40057a7f7c6b110fd Mon Sep 17 00:00:00 2001 From: YOUR_NAME Date: Wed, 28 Jul 2021 06:51:45 +0000 Subject: [PATCH 2/3] Description:p2p adapter Feature or Bugfix:Feature Binary Source: No Signed-off-by: YOUR_NAME --- model/network/wifi/include/hdf_wifi_cmd.h | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/model/network/wifi/include/hdf_wifi_cmd.h b/model/network/wifi/include/hdf_wifi_cmd.h index b753efece..43a392ead 100644 --- a/model/network/wifi/include/hdf_wifi_cmd.h +++ b/model/network/wifi/include/hdf_wifi_cmd.h @@ -206,16 +206,30 @@ typedef struct { } WifiActionData; typedef struct { + uint32_t freq; + uint32_t duration; +} WifiOnChannel; + typedef struct { uint8_t type; } WifiIfAdd; +typedef struct { + uint8_t ifname[IFNAMSIZ]; +} WifiIfRemove; + typedef struct { uint32_t ieLen; uint8_t appIeType; uint8_t rsv[3]; uint8_t *ie; } WifiAppIe; + +typedef struct { + uint64_t drvFlags; +} WifiGetDrvFlags; + +typedef struct { int32_t mode; int32_t freq; int32_t channel; @@ -324,16 +338,6 @@ typedef struct { int32_t extraIesLen; } WifiScan; -typedef struct { - uint32_t freq; - uint32_t duration; -} WifiOnChannel; - - -typedef struct { - uint8_t ifname[IFNAMSIZ]; -} WifiIfRemove; - typedef struct { uint8_t type; uint8_t macAddr[ETH_ADDR_LEN]; @@ -345,10 +349,6 @@ typedef struct { uint8_t *macAddr; } WifiIftypeMacAddr; -typedef struct { - uint64_t drvFlags; -} WifiGetDrvFlags; - typedef struct { int32_t freq; } WifiChannelSwitch; -- Gitee From 913ab28441058104167fa0d3d198f152cfc7e350 Mon Sep 17 00:00:00 2001 From: YOUR_NAME Date: Wed, 28 Jul 2021 07:40:51 +0000 Subject: [PATCH 3/3] Description:p2p adapter Feature or Bugfix:Feature Binary Source: No Signed-off-by: YOUR_NAME --- model/network/wifi/core/module/wifi_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/network/wifi/core/module/wifi_base.c b/model/network/wifi/core/module/wifi_base.c index 40406bfa4..d0c3d19b0 100644 --- a/model/network/wifi/core/module/wifi_base.c +++ b/model/network/wifi/core/module/wifi_base.c @@ -1594,7 +1594,7 @@ static int32_t WifiCmdGetDriverFlag(const RequestContext *context, struct HdfSBu ret = HDF_ERR_IO; } - HDF_LOGE("WifiCmdGetDriverFlag:%lx", params->drvFlags); + HDF_LOGE("WifiCmdGetDriverFlag:%llx", params->drvFlags); return ret; } -- Gitee