Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Change location automatically based on network' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change location automatically based on network
Authored by: richwiss on Jan 18, '05 10:08:53PM

I hate to reply to my own hint with bugs, but since I submitted it, I realized there is a small problem which has two obvious solutions, only one of which I actually know.

First, the bug: This bug occurs when you're using a wired connection and you want to use a Location that isn't "Automatic". If the update-location.sh script doesn't find a matching SSID (which will happen if there isn't one near you OR if you've got the wireless turned off), the script will set your location to Automatic. If you change the location to, say, "Work", the Kicker bundle gets called, checks your list of SSID's, doesn't find a matching one, and sets your location back to "Automatic".

And the solutions:
1. Don't have a fallback case in the update-location.sh script. In other words, remove the else statement from the end of the long if statement. This will mean if you go to a new location that you haven't seen before, you'll have to choose Automatic. For me, that's fine since I rarely use public locations.
2. Detect when you're wired - or detect that there is no wireless SSID availabe - and disable the script. Probably you could just run "ifconfig en0 " and check to see if you've got an IP address. If you have one, you can simply bail out of the script early. I can play with it a little bit - but not until later in the week. If anyone else wants to clean it up first, that's great.



[ Reply to This | # ]
Change location automatically based on network
Authored by: AJB on Jan 18, '05 10:31:24PM
I guess you missed my reply because it was nested. I check wireline IP address, and do an exponential back off with sleep after not finding a known location.

[ Reply to This | # ]