P2P: Implement power save configuration
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 24 Jun 2010 06:04:21 +0000 (23:04 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 14:17:19 +0000 (07:17 -0700)
wpa_cli p2p_set ps <0/1/2>
wpa_cli p2p_set oppps <0/1>
wpa_cli p2p_set ctwindow <0..> msec

src/drivers/driver.h
src/drivers/driver_ndis.c
wpa_supplicant/ctrl_iface.c
wpa_supplicant/driver_i.h

index 0294652..27e8831 100644 (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);
 };
 
 
index 73f50df..b4b5cf3 100644 (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 */
 };
index 74daf96..7c096b3 100644 (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",
index 80bff26..0868fa8 100644 (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 */