elixir-circuits / circuits_uart

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

`:enotty` when attempting to open a port with RS485 options on Linux #152

Closed jjcarstens closed 1 year ago

jjcarstens commented 1 year ago

It seems Linux is more picky about attempting RS485 options on a port that may not actually support it. In CI or most host Linux boxes, attempting to run Circuits.UART.open(uart, "/dev/some_device", rs485_rx_during_tx: false) will result in a :enotty error.

It seems we may need to be a little more picky about when we actually attempt the RS485 options or not.

(This was discovered attempting to use :jeff with :tty0tty in CI)

jjcarstens commented 1 year ago

So after looking at this again it seems this is expected behavior. We're already accounting for this and only erroring if the user has supplied RS485 settings (which is what I was doing) - i.e. we want it to fail if the user things they are setting RS485 things

So this is a problem that either :tty0tty should handle to emulate an RS485 port (prob not worth it) or the external lib just needs to be smart about when sending RS485 settings or not (host vs device, etc)