Skip to content

Commit e71109a

Browse files
kapbhrlubos
authored andcommitted
[nrf fromlist] net: wifi: Add API support for P2P power save
Add API support for P2P power save. Upstream PR #: 97183 Signed-off-by: Kapil Bhatt <[email protected]>
1 parent 0e3fa07 commit e71109a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

include/zephyr/net/wifi_mgmt.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,8 @@ enum wifi_p2p_op {
14731473
WIFI_P2P_GROUP_REMOVE,
14741474
/** P2P invite */
14751475
WIFI_P2P_INVITE,
1476+
/** P2P power save */
1477+
WIFI_P2P_POWER_SAVE,
14761478
};
14771479

14781480
/** Wi-Fi P2P discovery type */
@@ -1514,6 +1516,8 @@ struct wifi_p2p_params {
15141516
struct wifi_p2p_device_info *peers;
15151517
/** Actual number of peers returned */
15161518
uint16_t peer_count;
1519+
/** Power save enabled (for power save operation) */
1520+
bool power_save;
15171521
/** Connect specific parameters */
15181522
struct {
15191523
/** Connection method */

modules/hostap/src/supp_api.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3043,6 +3043,20 @@ int supplicant_p2p_oper(const struct device *dev, struct wifi_p2p_params *params
30433043
break;
30443044
}
30453045

3046+
case WIFI_P2P_POWER_SAVE:
3047+
snprintk(cmd_buf, sizeof(cmd_buf), "p2p_set ps %d", params->power_save ? 1 : 0);
3048+
ret = zephyr_wpa_cli_cmd_resp_noprint(wpa_s->ctrl_conn, cmd_buf, resp_buf);
3049+
if (ret < 0) {
3050+
wpa_printf(MSG_ERROR, "p2p_set ps command failed: %d", ret);
3051+
return -EIO;
3052+
}
3053+
if (os_strncmp(resp_buf, "FAIL", 4) == 0) {
3054+
wpa_printf(MSG_ERROR, "p2p_set ps command returned FAIL");
3055+
return -EIO;
3056+
}
3057+
ret = 0;
3058+
break;
3059+
30463060
default:
30473061
wpa_printf(MSG_ERROR, "Unknown P2P operation: %d", params->oper);
30483062
ret = -EINVAL;

0 commit comments

Comments
 (0)