dustinrue / ControlPlane

ControlPlane - context-sensitive computing for OS X
http://www.controlplaneapp.com
BSD 3-Clause "New" or "Revised" License
1.76k stars 180 forks source link

Unable to set Location #361

Closed Ashex closed 10 years ago

Ashex commented 10 years ago

I have three contexts:

When the any context is active I set the network location, for Home/Default it works just fine however it fails for work. These are the actions which take place for these contexts:

Default:

Home:

Work:

Home context is triggered by Wifi SSID/CoreLocation. Work context is triggered by Power adapter.

When the Work context is triggered all actions except Network Location succeed.

OSX 10.9.4 ControlPlane 1.5.3

Ashex commented 10 years ago

I think this is the relevant portion from the log under Advanced:

10:45:50.595 -[EvidenceSource wakeFromSleep:]
    Starting AudioOutputEvidenceSource after sleep.
10:45:50.601 -[CoreLocationSource wakeFromSleep:]
    Starting CoreLocationSource after sleep.
10:45:50.601 -[EvidenceSource wakeFromSleep:]
    Starting WiFiEvidenceSourceCoreWLAN after sleep.
10:45:50.611 -[EvidenceSource wakeFromSleep:]
    Starting PowerEvidenceSource after sleep.
10:45:50.612 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi is busy, not updating
10:45:50.613 -[EvidenceSource wakeFromSleep:]
    Starting RunningApplicationEvidenceSource after sleep.
10:45:50.662 -[EvidenceSource wakeFromSleep:]
    Starting TimeOfDayEvidenceSource after sleep.
10:45:51.178 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi is busy, not updating
10:45:51.228 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi is busy, not updating
10:45:52.662 __46-[CPController resumeRegularUpdatesWithDelay:]_block_invoke
    Resuming regular updates.
10:45:52.663 -[CPController doUpdateForReal]
    Context guesses: {
}
10:45:52.663 -[CPController changeActiveContextsBasedOnGuesses:]
    Deactivating context: 'Default'
10:45:52.663 -[CPController changeActiveContextsBasedOnGuesses:]
    Activating context: 'Default'
10:45:54.189 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi is busy, not updating
10:45:54.471 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi link is active, grabbing connection info
10:45:54.483 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi is busy, not updating
10:45:54.493 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi link is active, grabbing connection info
10:46:01.467 -[CPController doUpdateForReal]
    Context guesses: {
}
10:46:01.467 -[CPController changeActiveContextsBasedOnGuesses:]
    Deactivating context: 'Default'
10:46:01.467 -[CPController changeActiveContextsBasedOnGuesses:]
    Activating context: 'Default'
10:46:01.586 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi link is active, grabbing connection info
10:46:02.515 -[CPController doUpdateForReal]
    Context guesses: {
    "547DA4B9-4067-483B-8E03-7DA92F545FC0" = 1;
}
10:46:02.516 -[CPController changeActiveContextsBasedOnGuesses:]
    Activating context: 'Work'
10:46:02.516 -[CPController changeActiveContextsBasedOnGuesses:]
    Deactivating context: 'Default'
10:46:02.573 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:46:02.623 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:46:12.573 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:46:20.862 -[CPController setScreenLockInActive:]
    Screen lock becoming inactive
10:46:23.762 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:46:25.410 -[CPController doUpdateForReal]
    Context guesses: {
    "547DA4B9-4067-483B-8E03-7DA92F545FC0" = 1;
}
10:46:34.915 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:46:44.705 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:46:53.663 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:47:04.914 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:47:12.798 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:47:22.942 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:47:32.572 -[WiFiEvidenceSourceCoreWLAN doUpdate]
    WiFi disabled, no scan done
10:47:38.161 -[CoreLocationSource locationManager:didFailWithError:]
    Location manager failed with error: The operation couldn’t be completed. (kCLErrorDomain error 0.)
dustinrue commented 10 years ago

Maybe remove the action and add it again. Something leads me to believe the naming got changed somewhere along the line.

Ashex commented 10 years ago

Tried removing the action and adding it again, failed again :(

dustinrue commented 10 years ago

I've looked into this a bit more and it looks like it's an interaction between how OS X wants to manage network locations and what you're attempting to control using ControlPlane. It seems like when you are disabling WiFi before changing the network location the new network location becomes somehow "invalid" because you've already disabled WiFi.

You have two options. Either switch to the network location first and then disable WiFi or delete the WiFi rule from ControlPlane and delete the WiFi adapter from the Work network location. To test this locally I created a Work network location, clicked the WiFi adapter in the list and clicked minus. This tells OS X that the adapter shouldn't exist when using that network location and you'll get the same effect as having ControlPlane disable WiFi.