idaviden / n1mda-dev

Automatically exported from code.google.com/p/n1mda-dev
0 stars 0 forks source link

Long-term use breaks wifi #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  Run pirni on en0 as a daemon on 3.1.2 or 3.1.3
2.  Let phone go to sleep
3.  Try to reconnect to wifi; it doesn't work.

What is the expected output? What do you see instead?
The phone should automatically reconnect to wifi, but it doesn't and manual 
reconnecting doesn't work.  Sometimes it will say "Unable to connect to 
'SSID'", other times it can't even scan for SSIDs.

What version of the product are you using? On what operating system?
iPhone 3GS 3.1.3 SpiritJB and iPhone 3GS 3.1.2 blackra1n JB

Please provide any additional information below.

pirni is launched from a script defined in /System/Library/LaunchDaemons, which 
is automatically started at boot time.

Resetting network settings appears to temporarily correct the problem (the 
phone can go to sleep, wakeup, and reassociate.)  I haven't been able to tell 
whether it breaks with the addition of more wifi networks, or just over time.

Running tcpdump as a daemon also has this affect.

Here is an output of powerlog during the issue:

Thu 07/08 23:26:20 (kernel:0): IO80211ScanManager::startScan: Timing out scan 
requested: 194, and now: 211!
Thu 07/08 23:26:20 (Preferences:1219): Not migrating manifest
Thu 07/08 23:26:20 (Preferences:1219): ...completed profile migration.
Thu 07/08 23:26:20 (Preferences:1219): wifi handler: (null)
Thu 07/08 23:26:22 (kernel:0): AirPort: Enabled AppleBCMWLAN (link 1, sys 0, 
user 1)
Thu 07/08 23:26:22 (configd:15): WiFi:[300342382.659251]: Failed to associate 
with xxxSSID1xxx: 82
Thu 07/08 23:26:22 (kernel:0): AirPort: Disabled AppleBCMWLAN (link 1, sys 1, 
user 1)
Thu 07/08 23:26:22 (kernel:0): AppleBCMWLAN::setPOWER() [configd]: Setting 
power state to 0
Thu 07/08 23:26:22 (kernel:0): AppleBCMWLAN::powerOff Ready to power off
Thu 07/08 23:26:22 (configd:15): WiFi:[300342382.663703]: Error initiating 
association request: 82
Thu 07/08 23:26:22 (configd:15): WiFi:[300342382.665934]: Failed to associate 
with xxxSSID2xxx: 82
Thu 07/08 23:26:22 (kernel:0): AppleBCMWLAN::setPOWER() [configd]: Setting 
power state to 1
Thu 07/08 23:26:22 (configd:15): WiFi:[300342382.677335]: Error initiating scan 
request: 82
Thu 07/08 23:26:22 (kernel:0): AirPort: Enabled AppleBCMWLAN (link 1, sys 0, 
user 1)
Thu 07/08 23:26:22 (kernel:0): AirPort: Disabled AppleBCMWLAN (link 1, sys 1, 
user 1)
Thu 07/08 23:26:22 (kernel:0): AppleBCMWLAN::setPOWER() [configd]: Setting 
power state to 0
Thu 07/08 23:26:22 (kernel:0): AppleBCMWLAN::powerOff Ready to power off
Thu 07/08 23:26:22 (kernel:0): AppleBCMWLAN::setPOWER() [configd]: Setting 
power state to 1

Original issue reported on code.google.com by cws...@gmail.com on 9 Jul 2010 at 6:31

GoogleCodeExporter commented 8 years ago
When the phone goes to sleep the wireless chip gets turned off. This is 
obviously bad if pirni is running, since libnet_init puts the chip in monitor 
mode (not working on the iphone, but it returns ok)

To avoid this, either turn off pirni when the phone is going to sleep, or use 
Insomnia to prevent it from shutting down wifi. There is some code in the 
trunk, for my gps daemon that wakes up a device from sleep. Also check out 
http://code.google.com/p/iphone-insomnia/

Original comment by axelmoll...@gmail.com on 10 Jul 2010 at 8:02

GoogleCodeExporter commented 8 years ago
Thank you for the quick response.  

I used http://blogs.oreilly.com/iphone/2008/08/iphone-notifications.html and 
started catching network changes (re-compiled to launch a script on network 
change) in order to turn pirni off when WiFi turned off, and back on when WiFi 
turned back on.

Unfortunately this didn't fix the issue, since the WiFi is already off by the 
time we turn off pirni.  I couldn't figure out how to catch a notification that 
WiFi was about to turn off (reliably at least), only that it was already off.

Also, preventing the phone from going to sleep/shutting off wifi is infeasible, 
as the goal is long term data collection, and that would ruin battery life.

Is there a way to reset the WiFi (ie reverse libnet_init) once it is broken?  
Thus I could just reset WiFi whenever it turns back on in order to resolve the 
issue.

Thanks!

Original comment by cws...@gmail.com on 26 Jul 2010 at 3:28