Very strange question, program card dead in the serial port set function inside, not come out of __ function

Source: Internet
Author: User

Function: tcsetattr (fd,tcsanow,&newtio)

Open serial port is also successful, one into this serial port Setup function, the program is stuck to death, out of;

If FD is occupied, it must be open is failed, you can use PID to see what resources the process occupies: ls-l/proc/304/fd;

Solve:

I tried a lot of the open parameters, I used the attribute o_noctty to open, accidentally found, no card dead;

Open ("/dev/ttyama3", o_rdwr| o_nonblock| O_noctty); O_noctty: Notify the Linux system that this program will not be the control terminal for this port.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.