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

Unified Diff: chrome/browser/extensions/api/serial/serial_connection_posix.cc

Issue 12294009: Serial bitrate fix for linux (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/serial/serial_connection_posix.cc
===================================================================
--- chrome/browser/extensions/api/serial/serial_connection_posix.cc (revision 183500)
+++ chrome/browser/extensions/api/serial/serial_connection_posix.cc (working copy)
@@ -17,8 +17,88 @@
// Bitrate (sometimes erroneously referred to as baud rate).
if (bitrate_ >= 0) {
- cfsetispeed(&options, bitrate_);
- cfsetospeed(&options, bitrate_);
+ int bitrate_opt_;
+ switch (bitrate_) {
+ case 0:
+ bitrate_opt_ = B0;
+ break;
+ case 50:
+ bitrate_opt_ = B50;
+ break;
+ case 75:
+ bitrate_opt_ = B75;
+ break;
+ case 110:
+ bitrate_opt_ = B110;
+ break;
+ case 134:
+ bitrate_opt_ = B134;
+ break;
+ case 150:
+ bitrate_opt_ = B150;
+ break;
+ case 200:
+ bitrate_opt_ = B200;
+ break;
+ case 300:
+ bitrate_opt_ = B300;
+ break;
+ case 600:
+ bitrate_opt_ = B600;
+ break;
+ case 1200:
+ bitrate_opt_ = B1200;
+ break;
+ case 1800:
+ bitrate_opt_ = B1800;
+ break;
+ case 2400:
+ bitrate_opt_ = B2400;
+ break;
+ case 4800:
+ bitrate_opt_ = B4800;
+ break;
+ case 9600:
+ bitrate_opt_ = B9600;
+ break;
+ case 19200:
+ bitrate_opt_ = B19200;
+ break;
+ case 38400:
+ bitrate_opt_ = B38400;
+ break;
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ case 57600:
+ bitrate_opt_ = B57600;
+ break;
+ case 115200:
+ bitrate_opt_ = B115200;
+ break;
+ case 230400:
+ bitrate_opt_ = B230400;
+ break;
+ case 460800:
+ bitrate_opt_ = B460800;
+ break;
+ case 576000:
+ bitrate_opt_ = B576000;
+ break;
+ case 921600:
+ bitrate_opt_ = B921600;
+ break;
+ default:
+ bitrate_opt_ = B9600;
+#else
+// MACOSX doesn't define constants bigger than 38400.
+// So if it is MACOSX and the value doesn't fit any of the defined constants
+// It will setup the bitrate with 'bitrate_' (just forwarding the value)
+ default:
+ bitrate_opt_ = bitrate_;
+#endif
+ }
+
+ cfsetispeed(&options, bitrate_opt_);
+ cfsetospeed(&options, bitrate_opt_);
}
// 8N1
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698