| 381 | } |
| 382 | |
| 383 | int 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 | } |
nothing calls this directly
no test coverage detected