| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/serial/serial_io_handler_posix.h" | 5 #include "device/serial/serial_io_handler_posix.h" |
| 6 | 6 |
| 7 #include <sys/ioctl.h> | 7 #include <sys/ioctl.h> |
| 8 #include <termios.h> | 8 #include <termios.h> |
| 9 | 9 |
| 10 #include "base/posix/eintr_wrapper.h" | 10 #include "base/posix/eintr_wrapper.h" |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 : serial::PARITY_BIT_EVEN; | 465 : serial::PARITY_BIT_EVEN; |
| 466 } else { | 466 } else { |
| 467 info->parity_bit = serial::PARITY_BIT_NO; | 467 info->parity_bit = serial::PARITY_BIT_NO; |
| 468 } | 468 } |
| 469 info->stop_bits = | 469 info->stop_bits = |
| 470 (config.c_cflag & CSTOPB) ? serial::STOP_BITS_TWO : serial::STOP_BITS_ONE; | 470 (config.c_cflag & CSTOPB) ? serial::STOP_BITS_TWO : serial::STOP_BITS_ONE; |
| 471 info->cts_flow_control = (config.c_cflag & CRTSCTS) != 0; | 471 info->cts_flow_control = (config.c_cflag & CRTSCTS) != 0; |
| 472 return info.Pass(); | 472 return info.Pass(); |
| 473 } | 473 } |
| 474 | 474 |
| 475 bool SerialIoHandlerPosix::SetBreak() { |
| 476 if (ioctl(file().GetPlatformFile(), TIOCSBRK, 0) != 0) { |
| 477 VPLOG(1) << "Failed to set break"; |
| 478 return false; |
| 479 } |
| 480 |
| 481 return true; |
| 482 } |
| 483 |
| 484 bool SerialIoHandlerPosix::ClearBreak() { |
| 485 if (ioctl(file().GetPlatformFile(), TIOCCBRK, 0) != 0) { |
| 486 VPLOG(1) << "Failed to clear break"; |
| 487 return false; |
| 488 } |
| 489 return true; |
| 490 } |
| 491 |
| 475 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { | 492 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { |
| 476 return port_name; | 493 return port_name; |
| 477 } | 494 } |
| 478 | 495 |
| 479 } // namespace device | 496 } // namespace device |
| OLD | NEW |