mirror of
https://github.com/apache/nuttx.git
synced 2026-08-08 14:07:17 +00:00
A fetch() only lower half reads the device on demand, so its data is always available and there is never anything to wait for. The upper half did not reflect that: poll() only reported POLLIN when the descriptor was opened O_NONBLOCK, and a blocking read() waited on buffersem, which is only posted when the lower half drives notify_event from an interrupt of its own. A fetch() only sensor with no interrupt therefore never satisfied poll()/read() at all. This is not hypothetical: in the in tree nucleo-h563zi:dts configuration CONFIG_STM32_DTS_TRIGGER defaults to 0, which selects stm32_dts_fetch(), and no CONFIG_STM32_DTS_ITEN_* option is enabled, so the DTS interrupt never fires. A blocking read() on that sensor waits forever, even though stm32_dts_fetch() performs a complete software triggered measurement on its own and needs no interrupt at all. Applications had to work around this by forcing O_NONBLOCK on the descriptor themselves, see apache/nuttx-apps#3686. Drop the O_NONBLOCK special case in both paths: sensor_poll() now always reports POLLIN for a fetch only sensor and sensor_read() calls fetch() directly instead of waiting. Update the sensor_ops_s::fetch documentation, which described the old contract. With the wait gone, buffersem has no waiters left. Its only two readers were the ones removed here, both in the fetch path: the wait in sensor_read() and the nxsem_get_value() in sensor_poll(). The remaining nxsem_post() calls in sensor_push_event() and sensor_notify_event() had nothing left to wake, so drop the semaphore and those posts as well. Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Felipe Moura <moura.fmo@gmail.com> |
||
|---|---|---|
| .. | ||
| android | ||
| arpa | ||
| crypto | ||
| cxx | ||
| net | ||
| netinet | ||
| netpacket | ||
| nuttx | ||
| ssp | ||
| sys | ||
| .gitignore | ||
| aio.h | ||
| alloca.h | ||
| assert.h | ||
| byteswap.h | ||
| ctype.h | ||
| debug.h | ||
| dirent.h | ||
| dlfcn.h | ||
| dsp.h | ||
| dspb16.h | ||
| elf.h | ||
| elf32.h | ||
| elf64.h | ||
| endian.h | ||
| err.h | ||
| errno.h | ||
| execinfo.h | ||
| fcntl.h | ||
| fixedmath.h | ||
| fnmatch.h | ||
| ftw.h | ||
| gcov.h | ||
| getopt.h | ||
| glob.h | ||
| grp.h | ||
| hex2bin.h | ||
| iconv.h | ||
| ifaddrs.h | ||
| imx_container.h | ||
| inttypes.h | ||
| iso646.h | ||
| langinfo.h | ||
| libgen.h | ||
| libintl.h | ||
| limits.h | ||
| locale.h | ||
| lzf.h | ||
| malloc.h | ||
| mqueue.h | ||
| netdb.h | ||
| nl_types.h | ||
| nxflat.h | ||
| obstack.h | ||
| poll.h | ||
| pthread.h | ||
| pty.h | ||
| pwd.h | ||
| regex.h | ||
| resolv.h | ||
| sched.h | ||
| search.h | ||
| semaphore.h | ||
| shadow.h | ||
| signal.h | ||
| spawn.h | ||
| stdbool.h | ||
| stddef.h | ||
| stdint.h | ||
| stdio.h | ||
| stdlib.h | ||
| stdnoreturn.h | ||
| string.h | ||
| strings.h | ||
| syscall.h | ||
| syslog.h | ||
| termios.h | ||
| threads.h | ||
| time.h | ||
| ulimit.h | ||
| unistd.h | ||
| utime.h | ||
| uuid.h | ||
| wait.h | ||
| wchar.h | ||
| wctype.h | ||