On 15:22 Wed 09 Feb , Mancausoft wrote: > I read gpio.txt in Documentation of kernel and try to use it. > pfd.fd = open("/root/tasto1/value", O_RDONLY); > pfd.events = POLLPRI | POLLERR; > > //ready = poll(&pfd, 1, -1); > ready = poll(&pfd, 1, 100000); > > lseek (pfd.fd, 0, SEEK_SET); > > val = read(pfd.fd, buf, 254); > //the output are: 1, 10, 10 > printf ("%d, %d, %d\n", ready, pfd.revents, pfd.events); > > printf ("%d, %s\n", val, buf ); > > close(pfd.fd); > > But it don't wait for an edge but they exit immediatly. > Why? where is the problem? My Bad! now work: pfd.fd = open("/root/ledverde/value", O_RDWR ); while (1) { pfd.events = POLLPRI | POLLERR; // | POLLWRBAND; lseek (pfd.fd, 0, SEEK_SET); val = read(pfd.fd, buf, 254); buf[val] = 0; //printf ("%d, %s\n", val, buf ); ready = poll(&pfd, 1, -1); printf("%d\n", ++i); } -- Mancausoft - http://www.mancausoft.org/ GPG key: B53F90F2
Attachment:
signature.asc
Description: Digital signature