Skip to content
Advertisement

Send Command to serial port via Cu and exit in same line

I want to execute “sw i01” into cu command and exit cu (with “~.”)

in just one line or in file bash because il will execute them from a distant server

cu command

In this image i put:

cu -s 19200 -l /dev/ttyUSB0 

then it return “Connected.”

i put “sw i01” (command switch HDMI to input 1)

it return “Command Ok”

then i exit with “~.”

(the same for screen command)

Advertisement

Answer

Try this: echo "sw i01" | cu -s 19200 -l /dev/ttyUSB0

If that won’t work, then put cu -s 19200 -l /dev/ttyUSB0 into a bash script (make it executable chmod +x script.sh) and execute it in following way:

echo "sw i01" | script.sh

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement