hybridgroup / rubyserial

FFI Ruby library for RS-232 serial port communication
https://rubygems.org/gems/rubyserial
Other
154 stars 27 forks source link

Use native IO objects & support blocking IO #50

Open byteit101 opened 5 years ago

byteit101 commented 5 years ago

(Note this PR is still WIP, and should NOT be merged until this check list is finished)

This PR ditches the FFI calls to open & close in favor of using IO::for_fd so that we can use normal IO blocking & nonblocking methods. It still requires a bit of funkyness on windows, but it is working with MRI, and JRuby 9.2.8.0.dev + patches. This will fix #25 for the blocking, and will fix #36 as IO#flush works correctly out of the box now.

As part of this, I did some clean up of the API, and unfortunately this has some breaking changes for exceptions and return types. I went the safe way to minimize harm, but I still bumped the version to be cautious. Not sure if that's a good idea or not? Feedback greatly appreciated on that.

Third, I added lots of yard doc to all methods.

Fourth, I added a SerialPort class that enables compatibility on par with what the readme suggested already existed, but didn't quite.

Fifth, I added support for the HUPCL flag (Windows via DtrControl) to fix #15. Serial#reconfigure(hupcl: true|false) or SerialPort#hupcl= true|false

Sixth, I added a bunch more tests for HUPCL & general API stuff. Unfortunately I couldn't figure out a way to do this without a second program, so 1/3 of the tests now depend on an arduino project, though they are skipped if not detected.

That's all for now. The patches for JRuby are jnr/jnr-enxio:master and https://github.com/jruby/jruby/pull/5774 branch https://github.com/byteit101/jruby/tree/winio)

sh7d commented 5 years ago

Bump, JRuby 9.2.8.0 is released :)

byteit101 commented 5 years ago

Yea, sorry, 1/3 of the JRuby PRs didn't make it into .8. Will work on the other items now though

ahorek commented 4 years ago

JRuby 9.2.9.0 is released :)

ignisf commented 3 years ago

Sorry for bumping, but can we check if this can be merged now?

hunterboerner commented 3 years ago

@deadprogram

byteit101 commented 3 years ago

Right, I think the only thing left was the windows jenkins run having issues. Unfortunately, I haven't had easy access to windows machines recently.