Linux, Raspbian 8. USB USB-CAN converter is plugged into USB. Appears on the system as / dev / ttyUSB0
The converter itself and the device behind it are exactly working.
It is required to send 4 bytes to the port, wait 200ms and get a response of 4 bytes.
I tried it like this:
#!/bin/bash PORT="/dev/ttyUSB0" stty -F $PORT 9600 printf '\x0b\x00\x06\x80' > $PORT sleep 0.2 read -rn 4 data < $PORT echo $data
On the read line, everything hangs. Apparently not receiving any data in response. Tried to change to 1 incoming character. But it seems in response to complete silence.
Am I working correctly with the port at all? Which way to dig?
UPDATE 10.03
something nahimichil
Now all that I send to the port comes back. Exactly what I sent but not what I expect from the equipment
another strange thing
$ stty -F /dev/ttyUSB0 stty: /dev/ttyUSB0: Неприменимый к данному устройству ioctl $ setserial /dev/ttyUSB0 Cannot get serial info: Inappropriate ioctl for device
sudo cat /dev/ttyUSB0
in the adjacent terminal. - aleksandr barakincat /dev/ttyUSB0
in one console andecho "something" > /dev/ttyUSB0
in the next console. Accordingly, is the string considered? - approximatenumber