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

Function fxReadSerial

tools/serial2xsbug/serial2xsbug_mac.c:246–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246void 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
264void fxRegisterSerial(void *refcon, io_iterator_t iterator)
265{

Callers

nothing calls this directly

Calls 3

fxReadSerialBufferFunction · 0.85
fxCloseSerialFunction · 0.70
readFunction · 0.50

Tested by

no test coverage detected