-
Notifications
You must be signed in to change notification settings - Fork 58
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
Serialport ignores bytes = 0x11 #34
Comments
0x11 is XON (see http://en.wikipedia.org/wiki/Software_flow_control). Is |
Yes it is! sp.flow_control #=> 2 (SOFT) I have added `sp.flow_control = SerialPort::NONE' in my code and I have success. Thank you! |
Here is the fix for this issue...one character was missing: diff --git a/ext/native/posix_serialport_impl.c b/ext/native/posix_serialport_impl.c
index 11294fa..7747969 100644
--- a/ext/native/posix_serialport_impl.c
+++ b/ext/native/posix_serialport_impl.c
@@ -157,7 +157,7 @@ VALUE sp_create_impl(class, _port)
params.c_oflag = 0;
params.c_lflag = 0;
- params.c_iflag &= (IXON | IXOFF | IXANY);
+ params.c_iflag &= ~(IXON | IXOFF | IXANY);
params.c_cflag |= CLOCAL | CREAD;
params.c_cflag &= ~HUPCL;
|
@hparra : what do you think about this fix here? |
The original line of code that does not turn off XON/XOFF flow control (params.c_iflag &= (IXON | IXOFF | IXANY);), is clearing all the other bits in the params.c_iflag variable that perhaps should not be cleared. The original line of code will ensure that all the bits are cleared except the IXON, IXOFF and IXANY bits...unless of course this was the original intention. I have used this change successfully and the default is XON/XOFF flow control is disabled. |
BTW...thanks for the great gem @hparra...I use it a lot in my hardware development work. |
This looks pretty much like a bug in the original code. What will it take to fix this? |
Very strange behavior! Teh serial port doesn't receive bytes which equal 0x11. I have tried to receive same package with other tool (CuteCom) and I have had success. I don't have idea what it may be...
Ruby - 1.9.3
OS. Ubuntu 12.04-amd64
The text was updated successfully, but these errors were encountered: