Skip to content

Commit aa0dff0

Browse files
committed
Don't carry out custom baud rate bit-shifting
1 parent b4b5954 commit aa0dff0

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/main/c/Posix/PosixHelperFunctions.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* PosixHelperFunctions.c
33
*
44
* Created on: Mar 10, 2015
5-
* Last Updated on: Jul 06, 2023
5+
* Last Updated on: Dec 14, 2023
66
* Author: Will Hedgecock
77
*
88
* Copyright (C) 2012-2023 Fazecast, Inc.
@@ -837,9 +837,7 @@ int setConfigOptions(int portFD, baud_rate baudRate, struct termios *options)
837837
// Copy termios info into newer termios2 data structure
838838
struct termios2 options2 = { 0 };
839839
options2.c_cflag = (options->c_cflag & ~(CBAUD | CBAUDEX)) | BOTHER;
840-
options2.c_cflag &= ~((CBAUD | CBAUDEX) << IBSHIFT);
841-
options2.c_cflag |= (BOTHER << IBSHIFT);
842-
options2.c_iflag = options->c_iflag & ~IBAUD0;
840+
options2.c_iflag = options->c_iflag;
843841
options2.c_oflag = options->c_oflag;
844842
options2.c_lflag = options->c_lflag;
845843
options2.c_line = options->c_line;

src/main/c/Posix/termios2.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* termios2.h
33
*
44
* Created on: Jul 06, 2023
5-
* Last Updated on: Jul 27, 2023
5+
* Last Updated on: Dec 14, 2023
66
* Author: Will Hedgecock
77
*
88
* Copyright (C) 2012-2023 Fazecast, Inc.
@@ -28,13 +28,10 @@
2828

2929
#include <termios.h>
3030

31-
#define IBAUD0 020000000000
32-
3331
#if defined (__powerpc__) || defined (__powerpc64__)
3432

3533
#define T2CSANOW _IOW('t', 20, struct termios2)
3634
#define BOTHER 00037
37-
#define IBSHIFT 16
3835
#define K_NCCS 19
3936
struct termios2 {
4037
tcflag_t c_iflag;
@@ -52,7 +49,6 @@ struct termios2 {
5249

5350
#define T2CSANOW TCSETS2
5451
#define BOTHER CBAUDEX
55-
#define IBSHIFT 16
5652
#define K_NCCS 23
5753
struct termios2 {
5854
tcflag_t c_iflag;
@@ -77,9 +73,6 @@ struct termios2 {
7773
#ifndef BOTHER
7874
#define BOTHER CBAUDEX
7975
#endif
80-
#ifndef IBSHIFT
81-
#define IBSHIFT 16
82-
#endif
8376

8477
#if !defined(__ANDROID__)
8578

0 commit comments

Comments
 (0)