net: wifi: Add API support for P2P power save
Add API support for P2P power save. Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
This commit is contained in:
committed by
Henrik Brix Andersen
parent
8a5b39fd27
commit
094d30cc05
@@ -1473,6 +1473,8 @@ enum wifi_p2p_op {
|
||||
WIFI_P2P_GROUP_REMOVE,
|
||||
/** P2P invite */
|
||||
WIFI_P2P_INVITE,
|
||||
/** P2P power save */
|
||||
WIFI_P2P_POWER_SAVE,
|
||||
};
|
||||
|
||||
/** Wi-Fi P2P discovery type */
|
||||
@@ -1514,6 +1516,8 @@ struct wifi_p2p_params {
|
||||
struct wifi_p2p_device_info *peers;
|
||||
/** Actual number of peers returned */
|
||||
uint16_t peer_count;
|
||||
/** Power save enabled (for power save operation) */
|
||||
bool power_save;
|
||||
/** Connect specific parameters */
|
||||
struct {
|
||||
/** Connection method */
|
||||
|
||||
@@ -3082,6 +3082,20 @@ int supplicant_p2p_oper(const struct device *dev, struct wifi_p2p_params *params
|
||||
break;
|
||||
}
|
||||
|
||||
case WIFI_P2P_POWER_SAVE:
|
||||
snprintk(cmd_buf, sizeof(cmd_buf), "p2p_set ps %d", params->power_save ? 1 : 0);
|
||||
ret = zephyr_wpa_cli_cmd_resp_noprint(wpa_s->ctrl_conn, cmd_buf, resp_buf);
|
||||
if (ret < 0) {
|
||||
wpa_printf(MSG_ERROR, "p2p_set ps command failed: %d", ret);
|
||||
return -EIO;
|
||||
}
|
||||
if (strncmp(resp_buf, "FAIL", 4) == 0) {
|
||||
wpa_printf(MSG_ERROR, "p2p_set ps command returned FAIL");
|
||||
return -EIO;
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
wpa_printf(MSG_ERROR, "Unknown P2P operation: %d", params->oper);
|
||||
ret = -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user