-
Notifications
You must be signed in to change notification settings - Fork 17
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
Driver: fix opening serial on Mac OS X #16
base: master
Are you sure you want to change the base?
Conversation
tcsetattr returns an error if the speed is not. CLOCAL must be set otherwise usb - serial adapter will never get ready
Do you believe this is also apple-specific ? Was this tested on non-apple machines ? |
I do agree. This is very Mac specific. However, usually someone would use tcgetattr in combination with cfmakeraw to initialize the termios struct. We just set it to zero. Therefore, I would assume that some systems will have problems because of missing attributes like Mac OS. I am not sure how to fix it because using cfmakeraw changes a lot of things and could break running systems. The proposed fix is a minimal change to get it running on Mac OS. If you feel better I can surround it by ifdef APPLE. However I would assume none of our systems use modem status lines. Do you know if it is off by default on Linux? |
What happened ? |
Good questions. I think github automatically closed it because I force pushed the master ;-) instead of the branch with the fix. |
OK, so to answer your question: I don't see a problem with it in principle. Unfortunately, I don't have a Linux system with serial devices to test it on, so I'm reluctant :( |
I can test the exact same code to communicate via serial with an Arduino on Ubuntu 16.04 and Mac OS. The question is, is it a valid test or are there other use cases which might break. If the test is ok. I can happily perform the test. |
The problem is : I don't know. I would guess that it should be fine ... The only contentious change is the CLOCAL change. Nobody's using modem status lines in RS232 AFAIK, but my knowledge is very limited ... Do the test. We'll merge if it passes. |
…cated Fix base/logging deprecated warning
use the cmake-provided way to resolve -pthread
This uses a stream object (TestStream) that gives direct access to writing and reading data to/from the driver. A driver can be initialized with a TestStream as main stream by using the test:// URI, thus allowing to pass through the driver's own open methods.
create a harness to test drivers as blackboxes
…ire a reply while testing Drivers The MOCK functionality must be set with IODRIVERS_BASE_MOCK, what puts the driver in mock mode. The expectation tries to mimic the GTEST style and are set with EXPECT_REPLY(expectation,reply). Multiple expecatitons can be set and must be satisfied in the order of creation. If any expecation is not met at the end of the test, the test fails.
Instead of implement one MockContext class that changes it functionality depending if GTest or BOOST is being used, it was decided to split it in two specific classes to make the code better to understand.
MOCK funcionality to be able to send messages that require a reply while testing Drivers
The problem here was that openURI was the one creating the test stream, so the fixture class could not pass data to it. The change is to allow creation of the Note that it also allows to test "lingering data" handling, which may happen when the device sent data either before the device was opened (on HW buffered lines like serial), or between the open and the first read. It also handles situations where some data was not read after the last close.
Bugfixes and improvements to the mock context
This is very confusing right now.. I think it needs some rebasing |
tcsetattr returns an error if the speed is not set.
CLOCAL must be set otherwise usb - serial adapters will never get ready