Skip to content

Fixed XON/XOFF config bug on Linux #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.3.3 => 07/15/2020: [FIXED] 0x0D got translated to 0x0A under Linux

1.3.2 => 01/06/2019: [FIXED] 0x11/0x13 stripped out under Linux

1.3.1 => 07/26/2014: [FIXED] Ruby 2.2 support
[NEW] UNIX MARK/SPACE parity (CMSPAR) support

Expand Down
7 changes: 5 additions & 2 deletions ext/native/posix_serialport_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,14 @@ VALUE sp_create_impl(class, _port)
rb_sys_fail(sTcgetattr);
}

// clean oflag and iflag, you may get unexpected behaviour if any bit of iflag/oflag is set.
params.c_oflag = 0;
params.c_iflag = 0;

params.c_lflag = 0;
params.c_iflag &= (IXON | IXOFF | IXANY);

params.c_cflag |= CLOCAL | CREAD;
params.c_cflag &= ~HUPCL;
params.c_cflag &= ~(HUPCL | CRTSCTS); // default not use RTS/CTS hw flow control

if (tcsetattr(fd, TCSANOW, &params) == -1)
{
Expand Down
4 changes: 3 additions & 1 deletion lib/serialport/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class SerialPort
VERSION = "1.3.2"
VERSION = '1.3.3'
end