Fix syncing wiimotes on OS X.

IOdarwin.mm was assuming that scanning was complete when the run loop
was stopped (which the scan callback does), but somebody else was
stopping the run loop first, causing the scan to be aborted.  Wait until
the scan is actually complete.
This commit is contained in:
comex 2013-09-04 01:03:44 -04:00
parent 1ea8b93667
commit e0214b1a38

View file

@ -7,6 +7,7 @@
@interface SearchBT: NSObject {
@public
unsigned int maxDevices;
bool done;
}
@end
@ -15,6 +16,7 @@
error: (IOReturn) error
aborted: (BOOL) aborted
{
done = true;
CFRunLoopStop(CFRunLoopGetCurrent());
}
@ -144,9 +146,12 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
else
ERROR_LOG(WIIMOTE, "Unable to do bluetooth discovery");
CFRunLoopRun();
do
{
CFRunLoopRun();
}
while(!sbt->done);
[bti stop];
int found_devices = [[bti foundDevices] count];
if (found_devices)