Re: Fw: [3.18.3] poll() on gpio pins broken

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael,

> > For timekeeping I wrote a program which waits for interrupts on
> > gpio-pins and then tells the local ntp daemon the clock offset.
> > I'm aware of the pps support in recent kernel but that does not work
> > (yet) on all platforms (eg cubieboard 1).
> > 
> > This has worked for quite some time but no longer.
> > 
> > Until at least kernel 3.12 I could do:
> > 
> > // export gpio pin
> > // set direction to in
> > // set direction to rising
> > int fd = open("/sys.../value", O_RDONLY);
> > fdset[0].fd = fd;
> > fdset[0].events = POLLPRI;
> > fdset[0].revents = 0;
> > poll(fdset, 1, -1);
> > // at this point pin went high
> 
> Try using lseek before reading the data after the poll.
> 
> EX.
> 	if (fdset[0].revents & POLLPRI) {
> 		lseek(fdset[0].fd, 0, SEEK_SET);
> 		len = read(fdset[0].fd, buf, MAX_BUF);
> 		.
> 		.
> 	}
> 
> See if this helps.

Yes, that fixed it!
Great! Thanks!


Folkert van Heusden

-- 
MultiTail na wan makriki wrokosani fu tan luku den logfile nanga san
den commando spiti puru. Piki puru spesrutu sani, wroko nanga difrenti
kroru, tya kon makandra, nanga wan lo moro.
http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux