MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / main

Function main

tools/serial2xsbug/serial2xsbug_mac.c:383–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383int main(int argc, char* argv[])
384{
385 txSerialToolRecord tool;
386 txSerialTool self = &tool;
387 int result = fxArguments(self, argc, argv);
388 if (result)
389 return result;
390 CFMutableDictionaryRef matchingDict = IOServiceMatching(kIOSerialBSDServiceValue);
391 self->notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
392 CFRunLoopSourceRef runLoopSource = IONotificationPortGetRunLoopSource(self->notificationPort);
393 CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode);
394 IOServiceAddMatchingNotification(self->notificationPort, kIOPublishNotification, matchingDict, fxRegisterSerial, self, &self->ioIterator);
395 fxRegisterSerial(self, self->ioIterator);
396
397 if (self->showPath) {
398 CFRunLoopTimerRef cfTimer;
399 CFRunLoopTimerContext context = {0};
400
401 cfTimer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + (self->timeout / 1000.0), 0, 0, 0, timeoutHandler, &context);
402 CFRunLoopAddTimer(CFRunLoopGetCurrent(), cfTimer, kCFRunLoopCommonModes);
403 }
404
405 signal(SIGINT, fxSignalHandler);
406
407 CFRunLoopRun();
408
409}

Callers

nothing calls this directly

Calls 2

fxArgumentsFunction · 0.85
fxRegisterSerialFunction · 0.85

Tested by

no test coverage detected