I'm writing software to communicate with badly designed hardware. This hardware can communicate with linux pc (kernel 4.15) by RS485 line (9600 8N1) and it has very short timings: pc should reply in 2ms after receiving request from device.
I was able to solve this task using LOW_LATENCY flag and /sys/class/tty/ttySx/rx_trig_bytes file.
After opening port "rx_trig_bytes" file contents changes to "14", so I need write "1" to it after opening port to get good reply latency.
Is there any way to make this by API call or fix it after system boot / driver load ? Current realization looks ugly :(