howto disable wifi 30 minute timeout - anyone figured this out yet?

Discussion in 'iOS Development' started by morgman, May 15, 2009.

  1. morgman

    morgman New Member

    Joined:
    Feb 23, 2009
    Messages:
    4
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    Hey all, I've been beating my head against this particular problem for awhile now, my toolchain based daemon needs persistent wifi, I can accept the battery penalty.

    of course once the device goes to sleep and is off a power supply, the wifi shuts off after 30 minutes...
    I've prevented this in other cases with a foreground application running, backlight turned off and not allowing the device to go to sleep.

    But when going to sleep, everything I've tried so far fails to prevent the 30 minute wifi timeout/shutdown.

    I've tried (in basically the order I tried it):

    UIRequiresPersistentWifi YES or boolean set to true - no joy

    [[ UIApplication sharedApplication ] setIdleTimerDisabled: YES ]; - no joy

    Code:
    IONotificationPortRef notificationPort;
    root_port = IORegisterForSystemPower(self, &notificationPort, powerCallback, &notifier);
    	
    // add the notification port to the application runloop
    CFRunLoopAddSource(CFRunLoopGetCurrent(),
    					   IONotificationPortGetRunLoopSource(notificationPort),
    					   kCFRunLoopCommonModes );
    
    the above intercepts the kIOMessageCanSystemSleep msgs and cancels them, but the wifi still shuts off after 30 minutes... (I've seen maybe one post that suggests that these are two different problems.)

    more recently I replace the above with:
    Code:
    IOPMAssertionID assertionID;
    IOReturn success = IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, 
    										   kIOPMAssertionLevelOn, 
    &assertionID); 
    
    again this is power management and seems to be separate from the wifi problem.

    Recently I noticed the following in console messages on my device:
    "Thu May 14 17:40:43 unknown configd[15] <Notice>: WiFi: Disassociation timer disabled because we are connected to a power source
    "

    this lead me down the path of investigating configd.

    I've written code to dump all the key/value pairs in configd and see nothing that correlates (at least to me) to the 30 minute or 1800 second timeout.

    I found lots of references to a 1800 and disconnecting on sleep in the /System/Library/Frameworks/SystemConfiguration.framework/NetworkConfiguration.plist like:

    Code:
    <key>PPP-IEEE80211</key>
    		<dict>
    			<key>ACSPEnabled</key>
    			<integer>0</integer>
    			<key>CommUseTerminalScript</key>
    			<integer>0</integer>
    			<key>DialOnDemand</key>
    			<integer>0</integer>
    			<key>DisconnectOnFastUserSwitch</key>
    			<integer>1</integer>
    			<key>DisconnectOnIdle</key>
    			<integer>1</integer>
    			<key>DisconnectOnIdleTimer</key>
    			<integer>1800</integer>
    			<key>DisconnectOnLogout</key>
    			<integer>0</integer>
    			<key>DisconnectOnSleep</key>
    			<integer>1</integer>
    			<key>IdleReminder</key>
    			<integer>0</integer>
    			<key>IdleReminderTimer</key>
    			<integer>1800</integer>
    			<key>LCPEchoEnabled</key>
    			<integer>1</integer>
    			<key>LCPEchoFailure</key>
    			<integer>4</integer>
    			<key>LCPEchoInterval</key>
    			<integer>10</integer>
    			<key>Logfile</key>
    			<string>/var/log/ppp.log</string>
    			<key>VerboseLogging</key>
    			<integer>0</integer>
    		</dict>
    but changes made to this file don't seem to affect anything... (after power cycle) same 30 minute timeout...

    sooo I'm beginning to run out of ideas...
    I was going to start searching for the string "Disassociation" in binaries to see if I can trace the configd message to something else...
    There is also a POWERSAVE key in one of the dictionaries in configd that has to do with the network:

    Code:
    key is State:/Network/Interface/en0/AirPort
     is a Dictionary
        STATE : 3
        SSID_STR : XXXX-XXXX
        POWER : (
        1
    )
        BSSID : <XXXX XXXXX>
        TXPOWER : 1496
        [COLOR="Red"]POWERSAVE : 1[/COLOR]
        RSSI : {
        "RSSI_CTL_AGR" = 10;
        "RSSI_UNIT" = 89;
    }
        AUTH_TYPE : {
        "AUTH_LOWER" = 1;
    }
        SSID : <XXX XXX>
        CHANNEL : {
        CHANNEL = 1;
        "CHANNEL_FLAGS" = 10;
    }
        RATE : 54
    
    But I haven't modified my configd code to change that yet...

    I've been scouring the forums to no avail...
    Perhaps someone out there in the know will see this and shed some light on the issue...

    Thanks for any thoughts on this...
  2. jek

    jek New Member

    Joined:
    Mar 9, 2009
    Messages:
    85
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    I'm not an expert (or even close), but is there a way you could emulate a touch (on the screen).

Share This Page