Data is not written to device file (serial port) unless it is contained inside brackets '[' and ']'

I am experimenting with writing data to a serial port device file and reading it inside my application.
The application checks if some bytes of data are present in the device file by calling ioctl.
I noticed that only when I write data inside square brackets does ioctl() return bytes are stored.

Next I tried to also read the file contents from the terminal and see if anything was stored, and I find that again I am only able to read data from the device file when it is included in brackets.
See my experiment below

Is this expected behavior? If so, where is it coming from? Can I turn this off?

terminal 1 over ssh:

root@fx30:~# echo “[12345]” > /dev/ttyHSL1 #1
root@fx30:~# echo “12345” > /dev/ttyHSL1 #2
root@fx30:~# echo “[12345]” > /dev/ttyHSL1 #3
root@fx30:~# echo “[12345]” > /dev/ttyHSL1 #4
root@fx30:~# echo “abcd[12345]” > /dev/ttyHSL1 #5
root@fx30:~# echo “[12345]abcd” > /dev/ttyHSL1 #6
root@fx30:~# echo “[12345abcd” > /dev/ttyHSL1 #7
root@fx30:~# echo “[12345abcd]” > /dev/ttyHSL1 #8

terminal 2 over ssh, monitoring same device file

root@fx30:~# tail -f /dev/ttyHSL1
[12345] # from 1
[12345] # from 3
[12345] # from 4
[12345] # from 5
[12345] # from 6
[12345abcd] # from 8

this is not the correct way to use /dev/ttyHSL1, you need to connect physical UART2

The serial port is connected to an expansion card from which my application is receiving data.
I want to emulate the expansion card by writing data to the serial port (i.e. to /dev/ttyHSL1).
How did you connect to the serial port in your example?

I notice inside my application as well that whenever I write data outside of the brackets that I do not receive it and am not able to read it out from /dev/ttyHSL1, so I assumed the problem is with writing data into the device file.

I connect uart cable to the uart2 in mangoh green board

I just found that you don’t even need to do “cat /dev/ttyHSL1” in the UART side.