Commit Graph

40 Commits

Author SHA1 Message Date
Tomáš Polomský
ff38fe2a78 add support for drain
Tested on Mac OS, Linux and Windows with UART emulated on USB.

I wrote general BSD code, because it should work, but I am not able to test
it.

On Mac OS I am quite sure that drain behaves as expected because it fixed
an issue with buffer overflow (which OS does not report but fails).

For Windows it seems that drain is actually part of `Write`, because
`Write` was long and `Drain` was fast. But I have not found any mention in
Win32 docs about buffering and asynchronous write, so I put there flushing
code to be sure, and this code did not break anything.

For Linux `Drain` is also taking more time than writing so it looks working
too.
2023-06-16 09:14:39 +02:00
Jaime
75542ba31a Added support for sending breaks 2023-01-02 13:02:01 +01:00
Stepan
9fed730fb2 Added detection of UART ports (/dev/ttymxc*) 2021-09-06 18:40:01 +09:00
Cristian Maglie
adc54fb194 Updated license years 2021-07-20 12:56:48 +02:00
Cristian Maglie
0213833089 Fixed build for linux/ppc64le 2021-07-13 13:27:10 +02:00
Cristian Maglie
cff9b2347b Allow setting custom baudrates on serial ports (mac and linux version)
Co-authored-by: Jan-Philipp Benecke <github@bnck.me>
2021-07-01 00:40:51 +02:00
Cristian Maglie
df95023074 Introducing go.mod for dep management 2019-12-02 19:51:36 +01:00
Cristian Maglie
24a6610f05 Updated license years
Updated to 2020 even if we are less than one month ahead.
2019-12-02 19:27:10 +01:00
Cristian Maglie
4366d1c449 Tentative support for OpenBSD
See #27
2017-03-12 22:41:52 +01:00
Cristian Maglie
4cc831e192 Some serial constants replaced by sys/unix package 2017-03-12 21:23:58 +01:00
Veniamin Albaev
8b7629bfe1 Added buffer flush methods
+ serial.Port.ResetInputBuffer()
+ serial.Port.ResetOutputBuffer()
2017-03-09 11:47:38 +03:00
Veniamin Albaev
4d886c1028 Unix: move from syscall to golang.org/x/sys/unix
Prepare to using `unix.TCFLSH`/`unix.TIOCFLUSH`
which is missing in `syscall` package
2017-03-09 11:04:37 +03:00
Cristian Maglie
970475ed06 Updated licenses 2017-03-04 16:29:55 +01:00
Veniamin Albaev
b55fdf163b All //sys instructions moved to separate syscall_* files
Generated `syscall_*` files ranamed to `zsyscall_*` ones
like it done in `golang.org/x/sys` package.
2017-02-23 21:40:47 +03:00
Cristian Maglie
a3909960d3 Removed termiosMask(..) and use the correct bitmask type
This requires a bit of copying in darwin 386/amd64 but simplifies
the overall design.
2016-10-22 18:32:51 +02:00
Cristian Maglie
9398f35b69 Use unsigned values for termios setting
This allows the last (most significant) bit to be set without
overflow errors. The error becomes visible after adding the
CRTSCTS constant on linux/386:

   const tcCRTSCTS uint = 0x80000000
2016-10-20 23:55:06 +02:00
Cristian Maglie
7178181a28 Disable RTS/CTS handshake by default
Fix #3
2016-10-20 23:17:26 +02:00
Cristian Maglie
b89deafa1c Change import path to "go.bug.st/serial.v1"
This is needed when there are breaking changes in the API.
2016-09-05 01:05:22 +02:00
Cristian Maglie
485b2f86a8 Fixed a bunch of golint warnings (this needs an API change) 2016-04-24 17:20:49 +02:00
Cristian Maglie
e90aca32c8 Updates to documentation 2016-01-01 21:14:05 +01:00
Cristian Maglie
da42d3809e Added implementation for darwin x86_64 2014-12-31 19:43:47 +01:00
Cristian Maglie
e8f767688f Moved generated code into a separate file 2014-12-31 01:09:25 +01:00
Cristian Maglie
2629684436 Cosmetic change: rewritten error conditions in a more compact way 2014-12-31 00:37:02 +01:00
Cristian Maglie
14313e47fb Added canonical (vanity) imports 2014-12-30 20:41:33 +01:00
Cristian Maglie
b5ece1ae86 Default mode to 9600 N 8 1 2014-12-25 00:05:02 +01:00
Cristian Maglie
d8910d4004 Simplified API for setting port mode 2014-12-24 23:59:59 +01:00
Cristian Maglie
c5bf5a0514 reorganized linux implementation. No code change just moving functions around 2014-12-15 20:07:56 +01:00
Cristian Maglie
fffcc61237 Added Set(...) method to set all comm-params altogether 2014-12-15 18:43:09 +01:00
Cristian Maglie
ff10f48795 linux: refactored native calls as class private 2014-12-15 18:30:45 +01:00
Cristian Maglie
47c54231d2 linux: more idiomatic array operations on GetPortLists 2014-12-15 18:19:13 +01:00
Cristian Maglie
667f593174 linux: implemented last native calls through syscall package
no more "C" package dependencies for linux! yay!
2014-12-15 18:13:37 +01:00
Cristian Maglie
5a547e5348 linux: implemented cfset{i|o}speed without C function call 2014-12-15 18:09:15 +01:00
Cristian Maglie
259139a5db linux: ported all ioctl calls to syscalls 2014-12-15 18:08:23 +01:00
Cristian Maglie
25f974f062 linux: use Syscall for ioctl calls 2014-12-15 18:06:48 +01:00
Cristian Maglie
f84dc80d3e Added SetStopBits (linux only) 2014-12-14 18:50:29 +01:00
Cristian Maglie
3351cd50e0 Added SetDataBits function (linux only for now) 2014-12-14 18:39:51 +01:00
Cristian Maglie
62b1977d7c Small fix in native variable scope 2014-12-14 17:59:21 +01:00
Cristian Maglie
1d5eedba28 Added SetParity (still missing windows implementation) 2014-12-14 17:54:16 +01:00
Cristian Maglie
340397b32a Added LICENSE 2014-12-14 16:44:34 +01:00
Cristian Maglie
8c49fe6332 Reorganized repository 2014-12-14 16:07:10 +01:00