Re: select()/pselect() function

2020-11-20 Thread Gregory Nutt
From POSIX: "If the timeout interval expires without the specified condition being true for any of the specified file descriptors, the objects pointed to by the readfds, writefds, and errorfds arguments shall have all bits set to 0." If your select() timeouts on first loop iteration for any

Re: select()/pselect() function

2020-11-20 Thread Daniel Pereira Carvalho
Hi Juha, Calling FD_SET(fd, &rset) after timeout solves the problem. Thanks for your help. Daniel Pereira de Carvalho Em sex., 20 de nov. de 2020 às 14:41, Juha Niskanen (Haltian) < juha.niska...@haltian.com> escreveu: > From POSIX: "If the timeout interval expires without the specified > cond

Re: select()/pselect() function

2020-11-20 Thread Juha Niskanen (Haltian)
>From POSIX: "If the timeout interval expires without the specified condition >being true for any of the specified file descriptors, the objects pointed to >by the readfds, writefds, and errorfds arguments shall have all bits set to 0." If your select() timeouts on first loop iteration for any r

Re: select()/pselect() function

2020-11-20 Thread Daniel Pereira Carvalho
I will try pool() and see if the problem persists. Thanks Daniel Pereira de Carvalho Em sex., 20 de nov. de 2020 às 14:18, Gregory Nutt escreveu: > Okay, I got that wrong. I seldom used select(), it is just an > additional layer on top of poll() which is much more efficient. > > On 11/20/202

Re: select()/pselect() function

2020-11-20 Thread Gregory Nutt
Okay, I got that wrong.  I seldom used select(), it is just an additional layer on top of poll() which is much more efficient. On 11/20/2020 11:13 AM, Daniel Pereira Carvalho wrote: Hi Greg, Thanks for the answer. I don't understand why I should use 1 instead of fs + 1. The documentation says

Re: select()/pselect() function

2020-11-20 Thread Daniel Pereira Carvalho
Hi Greg, Thanks for the answer. I don't understand why I should use 1 instead of fs + 1. The documentation says "nfds This argument should be set to the highest-numbered file descriptor in any of the three sets, plus 1. " In the portserial.c nfds was set to fd + 1 Daniel Pereira de Carvalho E

Re: select()/pselect() function

2020-11-20 Thread Gregory Nutt
fd = open("/dev/ttyS1", O_RDWR | O_NOCTTY); ... s_rc = select(fd + 1, &rset, NULL, NULL, &tv); The first argument should be 1, not fd + 1

select()/pselect() function

2020-11-20 Thread Daniel Pereira Carvalho
Hi, I'm trying to read some bytes through the serial port. I am using the following code int fd; int s_rc; fd_set rset; uint32_t count; uint8_t rd_data[16]; struct timeval tv; fd = open("/dev/ttyS1", O_RDWR | O_NOCTTY); if (fd == -1) { fprintf(stderr, "ERROR: Cannot o

Re: Remove Device Nodes

2020-11-20 Thread Ecaterina FEDORENCO
Hello Alan, Gregory, Thank you for your replies. Yes. /dev/mtd1 was instantiated via bchdev_register() call. If I use bchdev_unregister,I noticed that the device is removed from the list. Before bchdev_unregister("/dev/mtd1") I call unlink method, but the inode is not removed because it still ha