Skip to content
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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Driver: fix opening serial on Mac OS X #16

wants to merge 21 commits into from

Conversation

D-Alex
Copy link
Member

@D-Alex D-Alex commented Dec 16, 2016

tcsetattr returns an error if the speed is not set.
CLOCAL must be set otherwise usb - serial adapters will never get ready

tcsetattr returns an error if the speed is not.
CLOCAL must be set otherwise usb - serial adapter will never get ready
@doudou
Copy link
Member

doudou commented Dec 19, 2016

CLOCAL must be set otherwise usb - serial adapters will never get ready

Do you believe this is also apple-specific ? Was this tested on non-apple machines ?

@D-Alex
Copy link
Member Author

D-Alex commented Dec 20, 2016

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?

@doudou
Copy link
Member

doudou commented Jan 5, 2017

What happened ?

@D-Alex
Copy link
Member Author

D-Alex commented Jan 5, 2017

Good questions. I think github automatically closed it because I force pushed the master ;-) instead of the branch with the fix.

@D-Alex D-Alex reopened this Jan 5, 2017
@doudou
Copy link
Member

doudou commented Jan 5, 2017

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 :(

@D-Alex
Copy link
Member Author

D-Alex commented Jan 5, 2017

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.

@doudou
Copy link
Member

doudou commented Jan 5, 2017

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.

g-arjones and others added 18 commits March 13, 2017 14:00
…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.
@g-arjones
Copy link
Contributor

This is very confusing right now.. I think it needs some rebasing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants