399 |
|
|
400 |
tcsetattr(serial_fd, TCSANOW, ptermios); |
tcsetattr(serial_fd, TCSANOW, ptermios); |
401 |
*/ |
*/ |
402 |
|
|
403 |
*handle = serial_fd; |
*handle = serial_fd; |
404 |
|
|
405 |
|
/* all read and writes should be non blocking */ |
406 |
|
if (fcntl(*handle, F_SETFL, O_NONBLOCK) == -1) |
407 |
|
perror("fcntl"); |
408 |
|
|
409 |
return STATUS_SUCCESS; |
return STATUS_SUCCESS; |
410 |
} |
} |
411 |
|
|
424 |
SERIAL_DEVICE *pser_inf; |
SERIAL_DEVICE *pser_inf; |
425 |
struct termios *ptermios; |
struct termios *ptermios; |
426 |
|
|
427 |
// timeout = 90; |
timeout = 90; |
428 |
pser_inf = get_serial_info(handle); |
pser_inf = get_serial_info(handle); |
429 |
ptermios = pser_inf->ptermios; |
ptermios = pser_inf->ptermios; |
430 |
|
|
|
#if 0 |
|
431 |
// Set timeouts kind of like the windows serial timeout parameters. Multiply timeout |
// Set timeouts kind of like the windows serial timeout parameters. Multiply timeout |
432 |
// with requested read size |
// with requested read size |
433 |
if (pser_inf->read_total_timeout_multiplier | pser_inf->read_total_timeout_constant) |
if (pser_inf->read_total_timeout_multiplier | pser_inf->read_total_timeout_constant) |
455 |
ptermios->c_cc[VMIN] = 1; |
ptermios->c_cc[VMIN] = 1; |
456 |
} |
} |
457 |
tcsetattr(handle, TCSANOW, ptermios); |
tcsetattr(handle, TCSANOW, ptermios); |
458 |
#endif |
|
459 |
|
|
460 |
*result = read(handle, data, length); |
*result = read(handle, data, length); |
461 |
|
|
462 |
return STATUS_SUCCESS; |
return STATUS_SUCCESS; |
463 |
} |
} |
464 |
|
|