elixir-circuits / circuits_uart

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

ENOTTY error setting custom speed on linux #82

Closed tomboland closed 4 years ago

tomboland commented 4 years ago

Setup

circuits_uart 1.4.1 OS is Manjaro Linux, Kernel 5.6.6 I7 Laptop Communicating with a USB serial cable to a DSP amplifier (Mac Audio Reference 2.1 DSP) The software I'm writing is here: https://github.com/tomboland/mac_audio_reference_2.1_dsp

This function is the first thing I'm trying to get working: https://github.com/tomboland/mac_audio_reference_2.1_dsp/blob/a10b572811bb51540c745f51f78bba553963fd00/lib/dsp_uart.ex#L56

I'm invoking it in this test here: https://github.com/tomboland/mac_audio_reference_2.1_dsp/blob/a10b572811bb51540c745f51f78bba553963fd00/test/dsp_uart_test.exs#L68

This is my first time using Elixir, and I've found it a pleasure to use, but you may find some stuff unidiomatic! I'm up for trying to submit a PR, I'm not bad with C, but I'll probably find it difficult to dive in and get this sorted. I'm hoping someone may have an instinct on it from the behaviour I'm describing! Thanks for any help, and please let me know if I can give you any more information, or be of any help at all (with guidance)! :)

Expected Behavior

I think I should be able to set a custom BAUD rate of 192000 or 200000. These speeds both work in an example python script I'm pasting below, which uses pyserial. I've tried with various other more conventional speeds, like 115200, 230400 and others, and I fail to communicate with my DSP using those speeds in python, but 192000 and 200000 work OK. The original software uses 192000. I think the problem is with the ioctl being used, but I must admit, it's not something I'm confident to make assertions about. The expected behaviour can be seen in the strace output from the python script that I'll put below. I'm also pasting strace output from my elixir program.

Actual Behavior

I get an ENOTTY error and cannot use the serial port at all when I configure a speed of 192000 or 200000.

Steps to Reproduce the Problem

I don't think you'd need my hardware to reproduce this, and actually, if I use tty0tty and try and connect to /dev/tnt0, I also get the ENOTTY error. Please see the strace output below, which is talking to the real hardware. You can see that the python script (where I've basically copypasta'd bits of the original code I'm rewriting) is getting the response I expect from the serialised message. Basically, if I send this binary: <<85, 2, 3, 7, 10>>, I should get back <<0xff>>

Python script

from serial import Serial, SerialException
import ctypes
import array

def send_message(ser, message):
    if len(message) == 0:
        return
    ln = len(message) // 2 + 1
    buf = array.array('B', [85, ln, 3])
    sum = 3
    for i in range(len(message) // 2):
        m = int(message[i * 2:i * 2 + 2], 16)
        sum = sum + m
        buf.append(m)

    buf.append(ctypes.c_ubyte(sum).value)
    print("DEBUG:", buf, buf.tostring())
    ser.write(buf.tostring())

if __name__ == "__main__":
    ser = Serial()
    ser.baudrate = 192000
    ser.timeout = 2
    ser.port = '/dev/ttyUSB0'
    try: ser.open()
    except SerialException: pass
    send_message(ser, b'07')
    response = ser.read()
    print(response)
    send_message(ser, b'08')
    response = ser.read()

strace output from above srcipt (stdout/DEBUG messages show the expected response being recieved. I've limited the strace to -e trace=ioctl

ioctl(3, TCGETS, 0x7fffedf6bff0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6bff0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6b0a0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6a7e0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6a7e0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6c010)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6c010)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6c020)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6c020)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6c020)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6b0d0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(0, TCGETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0xbf, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
ioctl(0, TCGETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0xbf, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
ioctl(1, TCGETS, 0x7fffedf6cf00)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(1, TCGETS, 0x7fffedf6d1c0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(2, TCGETS, 0x7fffedf6cf00)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(2, TCGETS, 0x7fffedf6d1c0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6c100)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6b1b0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6a260)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6a260)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6a260)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf69310)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6bca0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6bbe0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(4, TCGETS, 0x7fffedf6a810)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6cea0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6d8d0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6c450)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6b500)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6b500)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6a5b0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6a5b0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6b500)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6b500)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6a5b0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6c450)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6c450)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6b500)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fffedf6b500)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0xcbd, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
ioctl(3, TCGETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0xcbd, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {c_iflags=0, c_oflags=0, c_cflags=0xcbf, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
ioctl(3, TCGETS2, {c_iflags=0, c_oflags=0, c_cflags=0xcbf, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
ioctl(3, TCSETS2, {c_iflags=0, c_oflags=0, c_cflags=0x1cb0, c_lflags=0, c_line=0, c_cc[VMIN]=0, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x00\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
ioctl(3, TIOCMBIS, [TIOCM_DTR])         = 0
ioctl(3, TIOCMBIS, [TIOCM_RTS])         = 0
ioctl(3, TCFLSH, TCIFLUSH)              = 0
ioctl(8, TCGETS, 0x7fffedf6b880)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf6a930)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf699e0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf699e0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf68a90)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf68a90)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf68a90)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf68a90)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf6a930)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf699e0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf68a90)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf68a90)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf67b40)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf66bf0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf68a90)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf699e0)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(8, TCGETS, 0x7fffedf6bc70)        = -1 ENOTTY (Inappropriate ioctl for device)
pyserialtest.py:29: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  send_message(ser, b'07')
pyserialtest.py:32: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  send_message(ser, b'08')
DEBUG: array('B', [85, 2, 3, 7, 10]) b'U\x02\x03\x07\n'
b'\xff'
DEBUG: array('B', [85, 2, 3, 8, 11]) b'U\x02\x03\x08\x0b'
b'\x11'
+++ exited with 0 +++

strace output from elixir running mix test

ioctl(-1, TIOCGPGRP, 0x7ffd2e7a4d04)    = -1 EBADF (Bad file descriptor)
ioctl(2, TIOCGPGRP, 0x7ffd2e7a4bc4)     = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(2, TIOCGPGRP, 0x7ffd2e7a4ba4)     = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7ffd2e7a4c90)        = -1 ENOTTY (Inappropriate ioctl for device)
strace: Process 833241 attached
strace: Process 833242 attached
[pid 833242] +++ exited with 0 +++
[pid 833241] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833242, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 833243 attached
[pid 833243] +++ exited with 0 +++
[pid 833241] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833243, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 833244 attached
[pid 833244] +++ exited with 0 +++
[pid 833241] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833244, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 833245 attached
[pid 833245] +++ exited with 0 +++
[pid 833241] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833245, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 833246 attached
[pid 833246] +++ exited with 0 +++
[pid 833241] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833246, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 833247 attached
[pid 833247] +++ exited with 0 +++
[pid 833241] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833247, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 833241] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833241, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 833248 attached
[pid 833248] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833248, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
ioctl(1, TCGETS, 0x7ffd2e7a4710)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(2, TCGETS, 0x7ffd2e7a4700)        = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(-1, TIOCGPGRP, 0x7fff3ffeeb44)    = -1 EBADF (Bad file descriptor)
ioctl(2, TIOCGPGRP, 0x7fff3ffeea04)     = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(2, TIOCGPGRP, 0x7fff3ffee9e4)     = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, TCGETS, 0x7fff3ffeead0)        = -1 ENOTTY (Inappropriate ioctl for device)
strace: Process 833249 attached
strace: Process 833250 attached
strace: Process 833251 attached
[pid 833250] ioctl(2, TIOCGPGRP, 0x7fff3ffee034) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 833250] +++ exited with 0 +++
[pid 833251] +++ exited with 0 +++
[pid 833249] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833250, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 833249] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833249, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 833252 attached
[pid 833240] ioctl(0, TCGETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0xbf, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
[pid 833240] ioctl(0, TCGETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0xbf, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
strace: Process 833253 attached
strace: Process 833254 attached
strace: Process 833255 attached
strace: Process 833256 attached
strace: Process 833257 attached
strace: Process 833258 attached
strace: Process 833259 attached
strace: Process 833260 attached
strace: Process 833261 attached
strace: Process 833262 attached
strace: Process 833263 attached
strace: Process 833264 attached
strace: Process 833265 attached
strace: Process 833266 attached
strace: Process 833267 attached
strace: Process 833268 attached
strace: Process 833269 attached
strace: Process 833270 attached
strace: Process 833271 attached
strace: Process 833272 attached
strace: Process 833273 attached
strace: Process 833274 attached
strace: Process 833275 attached
strace: Process 833276 attached
strace: Process 833277 attached
strace: Process 833278 attached
strace: Process 833279 attached
strace: Process 833280 attached
strace: Process 833281 attached
strace: Process 833282 attached
strace: Process 833283 attached
strace: Process 833284 attached
[pid 833284] ioctl(0, TCGETS, 0x7ffee4b25320) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 833284] ioctl(-1, TIOCGPGRP, 0x7ffee4b25524) = -1 EBADF (Bad file descriptor)
[pid 833284] ioctl(2, TIOCGPGRP, 0x7ffee4b253e4) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 833284] ioctl(2, TIOCGPGRP, 0x7ffee4b253c4) = -1 ENOTTY (Inappropriate ioctl for device)
strace: Process 833285 attached
[pid 833285] --- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=833284, si_uid=1000} ---
[pid 833285] +++ killed by SIGUSR1 +++
[pid 833284] +++ exited with 0 +++
[pid 833255] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833284, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 833263] ioctl(1, TCGETS, 0x7f07fb6b5ad0) = -1 ENOTTY (Inappropriate ioctl for device)
Compiling 1 file (.ex)
[pid 833256] ioctl(1, TIOCGWINSZ, 0x7f080027eb60) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 833256] ioctl(0, TIOCGWINSZ, {ws_row=27, ws_col=106, ws_xpixel=0, ws_ypixel=0}) = 0

DspEqTest
  * test eq coeffs runs (14.3ms)
  * doctest DspEq.sample_rate/0 (1) (0.00ms)

DspUartTest
  * test Serial connection can be madestrace: Process 833286 attached
[pid 833286] ioctl(3, TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0xcbf, c_lflags=0, c_line=0, c_cc[VMIN]=1, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
[pid 833286] ioctl(3, SNDCTL_TMR_START or TCSETS, {c_iflags=0, c_oflags=0, c_cflags=0xcbf, c_lflags=0, c_line=0, c_cc[VMIN]=1, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
[pid 833286] ioctl(3, TCGETS, {c_iflags=0, c_oflags=0, c_cflags=0xcbf, c_lflags=0, c_line=0, c_cc[VMIN]=1, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
[pid 833286] ioctl(3, SNDCTL_TMR_START or TCSETS, {c_iflags=0, c_oflags=0, c_cflags=0xcbf, c_lflags=0, c_line=0, c_cc[VMIN]=1, c_cc[VTIME]=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
[pid 833286] ioctl(3, TIOCGSERIAL, 0x7ffeda0bbaa0) = -1 ENOTTY (Inappropriate ioctl for device)
  * test Serial connection can be made (15.3ms)
[pid 833286] +++ exited with 0 +++
[pid 833255] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=833286, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---

  1) test Serial connection can be made (DspUartTest)
     test/dsp_uart_test.exs:68
     ** (MatchError) no match of right hand side value: {:error, :enotty}
     code: pid = DspUart.get_serial_connection("/dev/ttyUSB0")
     stacktrace:
       (mac_audio_dsp 0.1.0) lib/dsp_uart.ex:52: DspUart.get_serial_connection/1
       test/dsp_uart_test.exs:69: (test)

  * test Test serialised messages with byte length 8 (1.5ms)
  * test Test message checksum examples (0.00ms)
  * test Test serialised messages with byte length 2 (1.0ms)
  * test Test serialised messages with byte length 1 (0.9ms)
  * test Test serialised messages with byte length 4 (0.6ms)

Finished in 0.2 seconds
1 doctest, 7 tests, 1 failure

Randomized with seed 940922
[pid 833254] +++ exited with 0 +++
[pid 833283] +++ exited with 1 +++
[pid 833281] +++ exited with 1 +++
[pid 833282] +++ exited with 1 +++
[pid 833280] +++ exited with 1 +++
[pid 833278] +++ exited with 1 +++
[pid 833277] +++ exited with 1 +++
[pid 833276] +++ exited with 1 +++
[pid 833275] +++ exited with 1 +++
[pid 833274] +++ exited with 1 +++
[pid 833273] +++ exited with 1 +++
[pid 833272] +++ exited with 1 +++
[pid 833271] +++ exited with 1 +++
[pid 833270] +++ exited with 1 +++
[pid 833269] +++ exited with 1 +++
[pid 833268] +++ exited with 1 +++
[pid 833267] +++ exited with 1 +++
[pid 833266] +++ exited with 1 +++
[pid 833265] +++ exited with 1 +++
[pid 833257] +++ exited with 1 +++
[pid 833264] +++ exited with 1 +++
[pid 833263] +++ exited with 1 +++
[pid 833262] +++ exited with 1 +++
[pid 833261] +++ exited with 1 +++
[pid 833260] +++ exited with 1 +++
[pid 833259] +++ exited with 1 +++
[pid 833258] +++ exited with 1 +++
[pid 833256] +++ exited with 1 +++
[pid 833253] +++ exited with 1 +++
[pid 833252] +++ exited with 1 +++
[pid 833279] +++ exited with 1 +++
[pid 833240] +++ exited with 1 +++
+++ exited with 0 +++
fhunleth commented 4 years ago

Oh, I didn't know about TCGETS2!

This code looks interesting: https://github.com/pyserial/pyserial/blob/master/serial/serialposix.py#L148-L162

It looks like there's a better way to do this: https://github.com/elixir-circuits/circuits_uart/blob/master/src/uart_comm_unix.c#L183-L194

Apologies, no one ever sends me straces and they're so helpful that I skimmed over almost everything else you posted when I saw TCGETS2. When I get more time, I'll read this more carefully. Thanks for the report!!!

tomboland commented 4 years ago

Hi, thanks for the amazingly quick response! You may see I've just submitted a PR which uses those newer ioctls. I added a simple test, and all of the other tests are still passing (on my machine, fingers crossed on Travis!). Please let me know what you think!

tomboland commented 4 years ago

And actually, I can talk to my DSP now! It works! :)

fhunleth commented 4 years ago

Fixed in f17ca766c11ad3f1a4859b38067df6e9929c84c1.