Hi,

I believe that this is incorrect.  While the driver may not support the power
setting, iwconfig doesn't get that far.  Note the error message:

    invalid argument "3".

This is not coming from iw_set_ext(); it is coming from iwconfig.  Note
the ltrace:

[pid 6521] strcasecmp("3", "min")                                              
= -58
[pid 6521] strcasecmp("3", "max")                                              
= -58
[pid 6521] strcasecmp("3", "period")                                           
= -61
[pid 6521] strcasecmp("3", "timeout")                                          
= -65
[pid 6521] strcasecmp("3", "saving")                                           
= -64
[pid 6521] strtod(0xbff1291f, 0xbff10d8c, 0, 0xb7f32dd1, 0)                    
= 115
[pid 6521] strcasecmp("3", "all")                                              
= -46
[pid 6521] strncasecmp(0xbff12926, 0x804bee2, 4, 0xb7f32dd1, 0)                
= -66
[pid 6521] strncasecmp(0xbff12926, 0x804bef8, 5, 0xb7f32dd1, 0)                
= -58
[pid 6521] strncasecmp(0xbff12926, 0x804bf02, 5, 0xb7f32dd1, 0)                
= -51
[pid 6521] strcasecmp("3", "repeat")                                           
= -63
[pid 6521] fprintf(0xb7eda560, "Error for wireless request "%s" "..., "Set 
Power Management"Error for wireless request "Set Power Management" (8B2C) :

The problem appears to be with the strtod() call being called on the
wrong arg.  The patch below fixes the issue (at least, it parses the
args correctly).  With it, we instead end up with:

[pid 6519] strcasecmp("3", "min")                                              
= -58
[pid 6519] strcasecmp("3", "max")                                              
= -58
[pid 6519] strcasecmp("3", "period")                                           
= -61
[pid 6519] strcasecmp("3", "timeout")                                          
= -65
[pid 6519] strcasecmp("3", "saving")                                           
= -64
[pid 6519] strtod(0xbff739dd, 0xbff7281c, 0, 0xb8024dd1, 0)                    
= 0x40080000
[pid 6519] iw_get_range_info(3, 0xbff739ca, 0xbff725b0, 0xb8024dd1, 0)         
= 0
[pid 6519] strncpy(0xbff727fc, "wlan0", 16)                                    
= 0xbff727fc
[pid 6519] ioctl(3, 35628, 0xbff727fc)                                         
= -1
[pid 6519] fprintf(0xb7fcc560, "Error for wireless request "%s" "..., "Set 
Power Management"Error for wireless request "Set Power Management" (8B2C) :
) = 59



From 19d25b8838a2da6416601e879ca01b073e4584b8 Mon Sep 17 00:00:00 2001
From: Andres Salomon <dilin...@collabora.co.uk>
Date: Thu, 20 Aug 2009 01:14:41 -0400
Subject: [PATCH] iwconfig: fix up 'power saving X' parsing

When passed 'power saving 3', iwconfig was previously running strtod()
on the arg 'saving'.  This clearly didn't work, and resulted in errors
about invalid arguments.  This patch fixes it to instead run on the arg
that follows 'saving' (so strtod() ends up returning 3.000 in this case).

Signed-off-by: Andres Salomon <dilin...@collabora.co.uk>
---
 iwconfig.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/iwconfig.c b/iwconfig.c
index a035d96..efe4f81 100644
--- a/iwconfig.c
+++ b/iwconfig.c
@@ -1034,8 +1034,8 @@ set_power_info(int                skfd,
        wrq.u.power.disabled = 0;
 
        /* Is there any value to grab ? */
-       value = strtod(args[0], &unit);
-       if(unit != args[0])
+       value = strtod(args[i], &unit);
+       if(unit != args[i])
          {
            struct iw_range     range;
            int                 flags;
-- 
1.6.3.3







--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to