NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: TTL/USB converter usage question



rvp%SDF.ORG@localhost (RVP) writes:

>On Wed, 16 Oct 2024, Ramiro Aceves wrote:

>> netbsd-raspa4$ { sleep 1; stty -f /dev/ttyU0 9600 raw clocal cread
>> -crtscts; } & cat -u -v /dev/ttyU0
>> stty: /dev/ttyU0: Resource temporarily unavailable
>>

>Wrong device--use /dev/dtyU0.


You don't need to open the device twice and you don't need non-blocking mode.

( stty 9600 raw clocal cread -crtscts ; cat ) < /dev/dtyU0

will configure the interface and read from it. The dial-out device will
avoid waiting for a carrier-detect signal, so the open is not blocked.
Then stty disables flow control, so that cat then won't stall on the
3-wire connection (clocal and cread aren't necessary then, or you could
just use clocal).

The next problem is then the binary protocol. The shell won't be
able to parse it and 'cat' will try to read big chunks. You can
try to work around this with dd, e.g. this would read single byte
chunks.

( stty 9600 raw clocal cread -crtscts ; dd msgfmt=quiet ibs=1 obs=1 | hexdump -vC ) < /dev/dtyU0




Home | Main Index | Thread Index | Old Index