| 244 | } |
| 245 | |
| 246 | void fxReadSerial(CFSocketRef socketRef, CFSocketCallBackType cbType, CFDataRef addr, const void* data, void* context) |
| 247 | { |
| 248 | txSerialTool self = context; |
| 249 | CFSocketNativeHandle handle = CFSocketGetNative(socketRef); |
| 250 | char buffer[1024]; |
| 251 | int size = read(handle, buffer, 1024); |
| 252 | if (size > 0) |
| 253 | fxReadSerialBuffer(self, buffer, size); |
| 254 | else if (size < 0) { |
| 255 | if (errno == ENXIO) |
| 256 | fxCloseSerial(self); |
| 257 | else if (errno != EINPROGRESS) { |
| 258 | fprintf(stderr, "Error reading serial - %s(%d).\n", strerror(errno), errno); |
| 259 | exit(1); |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | void fxRegisterSerial(void *refcon, io_iterator_t iterator) |
| 265 | { |
nothing calls this directly
no test coverage detected