Hi I am using a raspberry pi and trying to write to a usb serial port in a bash script. I found echo would be the right way to do it. Also I want to test if the port is busy or not when writing. So I am using this script:
#! /bin/bash if echo -e "USB Command" >> /dev/ttyACM0 ; then echo "Success" else echo "Fail" fi
But the problem is it is always success even when there is no permission to access the port. Am I using the best way to write to port? How can I check if the write was succeeded? Thanks
Edit: Here is the output of:
ls -l /dev/ttyACM0 crw-rw---- 1 root dialout 166, 0 Dec 13 16:38 /dev/ttyACM0
ls -l /dev/ttyACM0
andid
.dialout
group and the user you are using is most probably a member of that group which the commandid
should show. Can you confirm to us that your user is part of thedialout
group?