Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: device/serial/serial_io_handler_posix.cc

Issue 1128943005: Implement break signal for serial api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 return ioctl(file().GetPlatformFile(), TIOCSBRK, 0) == 0;
Reilly Grant (use Gerrit) 2015/06/10 19:42:13 Please catch errors here and use a VPLOG to record
limasdf 2015/06/11 22:14:24 Done.
477 }
478
479 bool SerialIoHandlerPosix::ClearBreak() {
480 return ioctl(file().GetPlatformFile(), TIOCCBRK, 0) == 0;
Reilly Grant (use Gerrit) 2015/06/10 19:42:13 Same here.
limasdf 2015/06/11 22:14:23 Done.
481 }
482
475 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { 483 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) {
476 return port_name; 484 return port_name;
477 } 485 }
478 486
479 } // namespace device 487 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698