MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / port_read_sync_data_error_code

Function port_read_sync_data_error_code

src/iofunc.c:431–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429extern int is_uh_radio_fd(int fd);
430
431static int port_read_sync_data_error_code(hamlib_port_t *p)
432{
433 ssize_t total_bytes_read = 0;
434 signed char data;
435 int result;
436
437 do
438 {
439 // Wait for data using a zero-length read
440 result = async_pipe_read(p->sync_data_error_pipe, &data, 0, p->timeout);
441
442 if (result < 0)
443 {
444 if (result == -RIG_ETIMEOUT)
445 {
446 if (total_bytes_read > 0)
447 {
448 return data;
449 }
450 }
451
452 return result;
453 }
454
455 result = async_pipe_read(p->sync_data_error_pipe, &data, 1, p->timeout);
456
457 if (result < 0)
458 {
459 if (result == -RIG_ETIMEOUT)
460 {
461 if (total_bytes_read > 0)
462 {
463 return data;
464 }
465 }
466
467 return result;
468 }
469
470 total_bytes_read += result;
471 }
472 while (result > 0);
473
474 return data;
475}
476
477static int port_read_sync_data(hamlib_port_t *p, void *buf, size_t count)
478{

Callers 2

port_read_sync_dataFunction · 0.85
port_wait_for_dataFunction · 0.85

Calls 3

async_pipe_readFunction · 0.85
port_selectFunction · 0.85
rig_debugFunction · 0.85

Tested by

no test coverage detected