P2P: Implement power save configuration

wpa_cli p2p_set ps <0/1/2>
wpa_cli p2p_set oppps <0/1>
wpa_cli p2p_set ctwindow <0..> msec
This commit is contained in:
Jouni Malinen 2010-06-23 23:04:21 -07:00 committed by Jouni Malinen
parent 40c03fd40b
commit c381508d88
4 changed files with 32 additions and 1 deletions

View file

@ -1860,6 +1860,17 @@ struct wpa_driver_ops {
* 0.
*/
int (*set_noa)(void *priv, u8 count, int start, int duration);
/**
* set_p2p_powersave - Set P2P power save options
* @priv: Private driver interface data
* @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
* @opp_ps: 0 = disable, 1 = enable, -1 = no change
* @ctwindow: 0.. = change (msec), -1 = no change
* Returns: 0 on success or -1 on failure
*/
int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
int ctwindow);
};

View file

@ -3306,5 +3306,6 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
NULL /* send_frame */,
NULL /* shared_freq */,
NULL /* get_noa */,
NULL /* set_noa */
NULL /* set_noa */,
NULL /* set_p2p_powersave */
};

View file

@ -2434,6 +2434,15 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd)
return wpa_drv_set_noa(wpa_s, count, start, duration);
}
if (os_strcmp(cmd, "ps") == 0)
return wpa_drv_set_p2p_powersave(wpa_s, atoi(param), -1, -1);
if (os_strcmp(cmd, "oppps") == 0)
return wpa_drv_set_p2p_powersave(wpa_s, -1, atoi(param), -1);
if (os_strcmp(cmd, "ctwindow") == 0)
return wpa_drv_set_p2p_powersave(wpa_s, -1, -1, atoi(param));
if (os_strcmp(cmd, "disabled") == 0) {
wpa_s->global->p2p_disabled = atoi(param);
wpa_printf(MSG_DEBUG, "P2P functionality %s",

View file

@ -522,4 +522,14 @@ static inline int wpa_drv_set_noa(struct wpa_supplicant *wpa_s, u8 count,
return wpa_s->driver->set_noa(wpa_s->drv_priv, count, start, duration);
}
static inline int wpa_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s,
int legacy_ps, int opp_ps,
int ctwindow)
{
if (!wpa_s->driver->set_p2p_powersave)
return -1;
return wpa_s->driver->set_p2p_powersave(wpa_s->drv_priv, legacy_ps,
opp_ps, ctwindow);
}
#endif /* DRIVER_I_H */