-
Notifications
You must be signed in to change notification settings - Fork 7
My termios.h differs from yours #2
Comments
This is a bit vague, could you provide more details?
If the differences are OS-specific, perhaps conditional compilation (example) could solve the issue. |
I was trying on OSX and I think it's a Linux vs BSD thing. Your OS-specific example looks like it will work. I was hoping there would be a better way, like Rust could look at system headers at compile time, but it seems like that's not possible. It's too bad Rust can't break free of the history of slightly incompatible C libraries which has given rise to crazy autotools, configure, cmake and headers full of OSX termios.h looks similar to this one: http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/termios.h |
There's an issue in the rust-lang repo about using bindgen to do that, but I think no one is working on it at the moment. I'll go with the |
If you make it I'll try it. |
It would be nice if bindgen could use the termios.h for the target system but it doesn't look feasible at the present state of the art.
Pyserial seems to solve this problem in a pure-python way by detecting your system and catering to it. This may not be so hard to port since they've already done the hard work.
Some other approaches
rust-term implements a termios_wrapper.c. https://github.com/doy/rust-term/blob/2affde6edab9a75db2b0e0eb748b0a139b1d8842/src/termios_wrapper.c
rustuv (libuv) doesn't quite have everything you need but it almost seems like it should. There's some TTY stuff but it doesn't paper over the control stuff like XON, XOFF
The lack of serial port in libuv has been addressed by a node-serialport project which has a nice wrapper, unfortunately in C++. https://github.com/voodootikigod/node-serialport/blob/644bfab14844c08e7f74aa8125702c611eb1f4dd/src/serialport_unix.cpp
The text was updated successfully, but these errors were encountered: