@@ -4064,6 +4064,40 @@ static int cmd_wifi_p2p_invite(const struct shell *sh, size_t argc, char *argv[]
40644064 PR ("P2P invite initiated\n" );
40654065 return 0 ;
40664066}
4067+
4068+ static int cmd_wifi_p2p_power_save (const struct shell * sh , size_t argc , char * argv [])
4069+ {
4070+ struct net_if * iface = get_iface (IFACE_TYPE_STA , argc , argv );
4071+ struct wifi_p2p_params params = {0 };
4072+ bool power_save_enable = false;
4073+
4074+ context .sh = sh ;
4075+
4076+ if (argc < 2 ) {
4077+ PR_ERROR ("Usage: wifi p2p power_save <on|off>\n" );
4078+ return - EINVAL ;
4079+ }
4080+
4081+ if (strcmp (argv [1 ], "on" ) == 0 ) {
4082+ power_save_enable = true;
4083+ } else if (strcmp (argv [1 ], "off" ) == 0 ) {
4084+ power_save_enable = false;
4085+ } else {
4086+ PR_ERROR ("Invalid argument. Use 'on' or 'off'\n" );
4087+ return - EINVAL ;
4088+ }
4089+
4090+ params .oper = WIFI_P2P_POWER_SAVE ;
4091+ params .power_save = power_save_enable ;
4092+
4093+ if (net_mgmt (NET_REQUEST_WIFI_P2P_OPER , iface , & params , sizeof (params ))) {
4094+ PR_WARNING ("P2P power save request failed\n" );
4095+ return - ENOEXEC ;
4096+ }
4097+
4098+ PR ("P2P power save %s\n" , power_save_enable ? "enabled" : "disabled" );
4099+ return 0 ;
4100+ }
40674101#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_P2P */
40684102
40694103static int cmd_wifi_pmksa_flush (const struct shell * sh , size_t argc , char * argv [])
@@ -4837,6 +4871,13 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
48374871 "[-d, --go-dev-addr=<MAC>]: GO device address (for group type)\n"
48384872 "[-i, --iface=<interface index>]: Interface index\n" ,
48394873 cmd_wifi_p2p_invite , 2 , 8 ),
4874+ SHELL_CMD_ARG (power_save , NULL ,
4875+ "Set P2P power save mode\n"
4876+ "Usage: power_save <on|off>\n"
4877+ "<on>: Enable P2P power save\n"
4878+ "<off>: Disable P2P power save\n"
4879+ "[-i, --iface=<interface index>]: Interface index\n" ,
4880+ cmd_wifi_p2p_power_save , 2 , 3 ),
48404881 SHELL_SUBCMD_SET_END
48414882);
48424883
0 commit comments