File descriptor not opening

Description

Hi,

I connected Arduino uno to raspbeery pi 3. In terminal, i am able to open arduino and read serial data via cat command but in agl source code(fd = open("/dev/ttyACM0", O_RDWR | O_NOCTTY | O_NDELAY), fd is not opening. 

Thanks 

Environment

None

Activity

Anirudh 
March 16, 2021 at 8:19 AM

I got the solution. I marked the file descriptor as nonblocking with fcntl(). That caused the Issue. Now it's reading data without any issues. Thank you

Anirudh 
March 15, 2021 at 1:39 PM
(edited)

errno: Resource temporarily Unavailable.

label:
nbytes = read(s, &msg, sizeof(msg));
if (nbytes < 0)
{
AFB_ERROR("Error at nbytes %s ",strerror(errno)); //
if (errno != EAGAIN)
{
AFB_ERROR("read");
}

usleep(10000);
goto label;
}
It stuck in that loop.

Scott Murray 
March 11, 2021 at 2:02 PM

What error does the read return (i.e. what is errno)?

Anirudh 
March 11, 2021 at 11:44 AM

candump is working. In Source code, Socket read line "read(socket, &msg, sizeof(msg))" isn't working.

Scott Murray 
March 10, 2021 at 6:06 PM
(edited)

I'll need an expansion of what you mean by "read isn't working", does you mean with e.g. candump as root?

Fixed

Details

Assignee

Reporter

Contract ID

Hardware Platform(s) Affected

Raspberry Pi 3

Components

Affects versions

Priority

Created March 2, 2021 at 5:39 AM
Updated March 30, 2021 at 6:49 PM
Resolved March 24, 2021 at 8:55 AM