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

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: histogram, VLOG 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
« no previous file with comments | « device/serial/serial_io_handler_posix.h ('k') | device/serial/serial_io_handler_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
OLDNEW
« no previous file with comments | « device/serial/serial_io_handler_posix.h ('k') | device/serial/serial_io_handler_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698