elixir-circuits / circuits_uart

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

Cannot set parity to :mark #81

Closed robinhilliard closed 4 years ago

robinhilliard commented 4 years ago

Setup

Expected Behavior

The code works with parity set to :ignore but according to the documentation and code comments I should be able to set parity to :mark.

{:ok, pid} = Circuits.UART.start_link()
:ok = Circuits.UART.open(pid, "/dev/tty.SLAB_USBtoUART", speed: 9600, parity: :mark, data_bits: 8, stop_bits: 1, active: true)

Actual Behavior

open returns {:error, :einval}.

Steps to Reproduce the Problem

Above two lines of code.

fhunleth commented 4 years ago

I don't think :mark parity is supported on OSX. The way that it's implemented for Linux is by using the CMSPAR option to tcsetattr. I'm pretty sure that CMSPAR doesn't exist on Darwin.

I haven't looked in the past year or so, so maybe Apple added it? If you know of an OSX way of enabling it or have any other hints, please let me know.

robinhilliard commented 4 years ago

Right, thanks for explaining and no sadly I have no additional information for you. It looks like it can be dodgy using mark and space even on Linux.