How do i open a com port(rs422) on linux os? [clos

2019-09-20 12:04发布

Is there any C++ example which i can read up on?

标签: c++ linux
2条回答
相关推荐>>
2楼-- · 2019-09-20 12:37

Very few computers have RS-422 ports, is that a typo of RS-232 ("plain old serial port")?

Anyway, Linux uses device drivers to make various hardware devices available as files that you can open. These files are usually located in the /dev/ directory. You can probably inspect the kernel's boot up messages (run the dmesg command) to see which device name is associated with the serial port in question, and then open() it.

查看更多
男人必须洒脱
3楼-- · 2019-09-20 13:00

You probably need to use the open(2), close(2), read(2), write(2), ioctl(2), fcntl(2) system calls.

Serial ports are quite complex things. read about their ioctl commands and termios

Read a good book about linux programming (or about advanced unix programming). Serial ports, and tty (including pseudo-ttys) are complex!

查看更多
登录 后发表回答