wpa_cli ping-pong and power management
Alon Bar-Lev
alon.barlev
Sat Jan 3 07:49:14 PST 2009
On Saturday 27 December 2008, Alon Bar-Lev wrote:
>
> Hello,
>
> Have you considered raising the alarm() interval of wpa_cli so that
> laptops will consume less power?
>
> The alarm() watchdog is only required when wpa_supplicant abnormally
> terminates, as when it normally terminates it sends correct message.
>
> The 1 second wakeup takes a lot of power if you look at powertop results.
>
> Converting the dgram protocol into stream is rather difficult at this point, so
> setting the alarm() timeout to 20 secs or even 60 secs will provide some
> remedy.
>
> Regards,
> Alon Bar-Lev.
>
> On Saturday 01 November 2008, Alon Bar-Lev wrote:
> > On 11/1/08, Jouni Malinen <j at w1.fi> wrote:
> > > On Sat, Nov 01, 2008 at 09:31:16AM +0200, Alon Bar-Lev wrote:
> > >
> > > > I now can locate the select you mentioned.
> > > > I tried to modify the code to recognize the disconnect and found that
> > > > the control socket is dgram... So thee is no way to know that the
> > > > peer is down except trying to ping-pong.
> > > > Will you accept an option to make the control socket stream?
> > >
> > >
> > > Changing this is a bit difficult now due to deployed systems and client
> > > applications depending on the current mechanism. Anyway, I would
> > > probably be fine with a build time option to select a stream socket
> >
> > OK.
> > So will you at least for the time being modify the 2 sec interval to
> > something higher, something like 20 sec or so?
> >
> > It will take some time to convert this to stream, as each packet
> > should also contain the length of the command, and the current
> > blocking processing of the control socket is not very suitable for
> > completing the command.
> >
> > Alon.
> >
>
>
>
---
diff -urNp wpa_supplicant-0.6.4.org/wpa_supplicant/wpa_cli.c wpa_supplicant-0.6.4/wpa_supplicant/wpa_cli.c
--- wpa_supplicant-0.6.4.org/wpa_supplicant/wpa_cli.c 2008-08-10 20:33:12.000000000 +0300
+++ wpa_supplicant-0.6.4/wpa_supplicant/wpa_cli.c 2009-01-03 14:11:19.000000000 +0200
@@ -1363,7 +1363,7 @@ static void wpa_cli_interactive(void)
do {
wpa_cli_recv_pending(ctrl_conn, 0, 0);
#ifndef CONFIG_NATIVE_WINDOWS
- alarm(1);
+ alarm(60);
#endif /* CONFIG_NATIVE_WINDOWS */
#ifdef CONFIG_READLINE
cmd = readline("> ");
@@ -1471,7 +1471,7 @@ static void wpa_cli_action(struct wpa_ct
while (!wpa_cli_quit) {
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
- tv.tv_sec = 2;
+ tv.tv_sec = 60;
tv.tv_usec = 0;
res = select(fd + 1, &rfds, NULL, NULL, &tv);
if (res < 0 && errno != EINTR) {
@@ -1525,7 +1525,7 @@ static void wpa_cli_alarm(int sig)
wpa_cli_reconnect();
if (ctrl_conn)
wpa_cli_recv_pending(ctrl_conn, 1, 0);
- alarm(1);
+ alarm(60);
}
#endif /* CONFIG_NATIVE_WINDOWS */
More information about the Hostap
mailing list