I use a USB GPIO device. When it was connected to PC, it created a file that was named "/dev/ttyACM0". I want to send data using termios.
I run
int fd = open("/dev/ttyACM0", O_RDWR | O_NOCTTY | O_NDELAY);
in C code, but it didn't work.
What should it be?
UPDATE
After USB device was connected to PC, I run dmesg
command on terminal. It showed device information such as product, manufacturer, idVendor, idProduct etc.
UPDATE 2
My error was "no file or directory". So I tried this method for solution. I run sudo stty crtscts -F /dev/ttyACM0
.I rewrite open port via int fd = open("/dev/tty1", O_RDONLY | O_NOCTTY | O_NDELAY);
I recompiled and run my code. New runtime error is "/dev/tty1 : Permission denied"