tarm / serial

BSD 3-Clause "New" or "Revised" License
1.6k stars 453 forks source link

baud rate 2M #39

Open lubko opened 8 years ago

lubko commented 8 years ago

please consider adding more supported baud rates, there are few more that should work: http://play.golang.org/p/OvvdWmL56N i have tried using 2M, and it works, later i can provide a pull request.

tarm commented 8 years ago

As I mentioned in https://github.com/tarm/serial/pull/37#discussion_r47597461 higher baud rates are likely not portable. Testing on one OS is not enough.

I am open to adding higher baud rates on platforms that support it iff it can be done in a portable manner. That might be build constraints or #defines in cgo code.

Timmmm commented 8 years ago

It is possible (on Windows at least) to query the baud rates supported by a port. However, some ports return a list of "standard" rates but actually support arbitrary rates (e.g. I've used 111111 baud).

I don't think you can do anything other than allowing the user to set any baud rate, and failing if it doesn't succeed.