374 |
// Init data structures for device |
// Init data structures for device |
375 |
pser_inf = (SERIAL_DEVICE *) xmalloc(sizeof(SERIAL_DEVICE)); |
pser_inf = (SERIAL_DEVICE *) xmalloc(sizeof(SERIAL_DEVICE)); |
376 |
pser_inf->ptermios = (struct termios *) xmalloc(sizeof(struct termios)); |
pser_inf->ptermios = (struct termios *) xmalloc(sizeof(struct termios)); |
377 |
|
memset(pser_inf->ptermios, 0, sizeof(struct termios)); |
378 |
pser_inf->pold_termios = (struct termios *) xmalloc(sizeof(struct termios)); |
pser_inf->pold_termios = (struct termios *) xmalloc(sizeof(struct termios)); |
379 |
|
memset(pser_inf->pold_termios, 0, sizeof(struct termios)); |
380 |
|
|
381 |
pos2 = next_arg(optarg, '='); |
pos2 = next_arg(optarg, '='); |
382 |
strcpy(g_rdpdr_device[*id].name, optarg); |
strcpy(g_rdpdr_device[*id].name, optarg); |
408 |
|
|
409 |
pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[device_id].pdevice_data; |
pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[device_id].pdevice_data; |
410 |
ptermios = pser_inf->ptermios; |
ptermios = pser_inf->ptermios; |
411 |
serial_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR | O_NOCTTY); |
serial_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR | O_NOCTTY | O_NONBLOCK); |
412 |
|
|
413 |
if (serial_fd == -1) |
if (serial_fd == -1) |
414 |
{ |
{ |
439 |
tcsetattr(serial_fd, TCSANOW, ptermios); |
tcsetattr(serial_fd, TCSANOW, ptermios); |
440 |
*/ |
*/ |
441 |
|
|
442 |
|
cfmakeraw(pser_inf->ptermios); |
443 |
*handle = serial_fd; |
*handle = serial_fd; |
444 |
|
|
445 |
/* all read and writes should be non blocking */ |
/* all read and writes should be non blocking */ |