falcon Posted February 28, 2023 Share Posted February 28, 2023 Добрый день! Установили драйвер для работы с Nport 5110 на ubuntu 20.04. Порт доступен. dmesg | grep tty [ 0.381806] printk: console [tty0] enabled [ 1.853594] 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A [ 1.889290] 00:04: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A [ 27.717997] MOXA Async/NPort server family Real TTY driver ttymajor 33 calloutmajor 38 verbose 0 (Ver5.2) Команда setserial выдаёт ошибку: sudo setserial -g /dev/ttyr00 Cannot get serial info: Inappropriate ioctl for device Команда sudo stty -F /dev/ttyr00. speed 9600 baud; line = 0; min = 100; time = 2; -icrnl -imaxbel -opost -onlcr -isig -icanon -echo Есть ли туториалы или библиотеки как работать с таким ком портом в коде на С. Попытка использования кода такого типа приводит к ошибке no such file or directory. #include <fcntl.h> #include <termios.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <sys/ioctl.h> #include <unistd.h> ... int F_ID = -1; F_ID = open("/dev/ttyr00", O_RDWR | O_NOCTTY); if(F_ID == -1) { char *errmsg = strerror(errno); printf("%s\n",errmsg); return false; } ... Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now