Skip to content

Commit

Permalink
Don't carry out custom baud rate bit-shifting
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgecrw committed Dec 14, 2023
1 parent b4b5954 commit aa0dff0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/main/c/Posix/PosixHelperFunctions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* PosixHelperFunctions.c
*
* Created on: Mar 10, 2015
* Last Updated on: Jul 06, 2023
* Last Updated on: Dec 14, 2023
* Author: Will Hedgecock
*
* Copyright (C) 2012-2023 Fazecast, Inc.
Expand Down Expand Up @@ -837,9 +837,7 @@ int setConfigOptions(int portFD, baud_rate baudRate, struct termios *options)
// Copy termios info into newer termios2 data structure
struct termios2 options2 = { 0 };
options2.c_cflag = (options->c_cflag & ~(CBAUD | CBAUDEX)) | BOTHER;
options2.c_cflag &= ~((CBAUD | CBAUDEX) << IBSHIFT);
options2.c_cflag |= (BOTHER << IBSHIFT);
options2.c_iflag = options->c_iflag & ~IBAUD0;
options2.c_iflag = options->c_iflag;
options2.c_oflag = options->c_oflag;
options2.c_lflag = options->c_lflag;
options2.c_line = options->c_line;
Expand Down
9 changes: 1 addition & 8 deletions src/main/c/Posix/termios2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* termios2.h
*
* Created on: Jul 06, 2023
* Last Updated on: Jul 27, 2023
* Last Updated on: Dec 14, 2023
* Author: Will Hedgecock
*
* Copyright (C) 2012-2023 Fazecast, Inc.
Expand All @@ -28,13 +28,10 @@

#include <termios.h>

#define IBAUD0 020000000000

#if defined (__powerpc__) || defined (__powerpc64__)

#define T2CSANOW _IOW('t', 20, struct termios2)
#define BOTHER 00037
#define IBSHIFT 16
#define K_NCCS 19
struct termios2 {
tcflag_t c_iflag;
Expand All @@ -52,7 +49,6 @@ struct termios2 {

#define T2CSANOW TCSETS2
#define BOTHER CBAUDEX
#define IBSHIFT 16
#define K_NCCS 23
struct termios2 {
tcflag_t c_iflag;
Expand All @@ -77,9 +73,6 @@ struct termios2 {
#ifndef BOTHER
#define BOTHER CBAUDEX
#endif
#ifndef IBSHIFT
#define IBSHIFT 16
#endif

#if !defined(__ANDROID__)

Expand Down

0 comments on commit aa0dff0

Please sign in to comment.