elixir-circuits / circuits_uart

Discover and use UARTs and serial ports in Elixir
Apache License 2.0
188 stars 48 forks source link

Updated set_custom_speed() to use newer termios2 API on linux #83

Closed tomboland closed 4 years ago

tomboland commented 4 years ago

Updated set_custom_speed() to use newer termios2 API on linux, with TCGETS2/TCSETS2 ioctls, and added a simple test.

This is related to the issue: https://github.com/elixir-circuits/circuits_uart/issues/82

fhunleth commented 4 years ago

Thanks! From a brief skim, it looks pretty good. I'll set aside some time over the next couple days to test, merge, and make a release. My feeling is that if anything needs to be updated, it will be small and I'll handle it.

Thank you very much for debugging and sending a fix over!

fhunleth commented 4 years ago

I went down a bit of a rabbit hole with the workaround for the termios struct redefinition. I have the feeling like that workaround may fail somewhere, but I couldn't come up with something that was obviously better.

I ended up going back and merging your PR almost as is. The only thing I did was run "mix format" to remove a trivial whitespace issue that was breaking CI. (Due to another issue, that CI break didn't show up for you.)

See f17ca766c11ad3f1a4859b38067df6e9929c84c1 for commit that was merged.

Thanks again for identifying the issue and providing a fix!