-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <linux/serial.h>
#endif
-#if defined(OS_MACOSX)
-#include <IOKit/serial/ioss.h>
-#endif
-
namespace extensions {
namespace {
return ioctl(file, TIOCSSERIAL, &serial) >= 0;
#elif defined(OS_MACOSX)
speed_t speed = static_cast<speed_t>(bitrate);
- return ioctl(file, IOSSIOSPEED, &speed) != -1;
+ cfsetispeed(config, speed);
+ cfsetospeed(config, speed);
+ return true;
#else
return false;
#endif
int bitrate = 0;
if (SpeedConstantToBitrate(ispeed, &bitrate)) {
info->bitrate.reset(new int(bitrate));
+ } else if (ispeed > 0) {
+ info->bitrate.reset(new int(static_cast<int>(ispeed)));
}
}
if ((config.c_cflag & CSIZE) == CS7) {