rust-embedded / rust-embedded/linux-embedded-hal

embedded_hal::serial::Read is not implemented as nonblocking

Open
#52 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
319
Forks
60
Avg merge
12h 31m
Merged PRs (30d)
1

Description

The embedded_hal::serial::Read trait defines its read method with a nb::Result. This suggests Read::read being nonblocking. But, linux_embedded_hal::Serial implements this trait by calling serial_unix::TTYPort::read which internally uses ppoll.

By default, the timeout passed to ppoll is 100ms, which results in read blocking for that amount of time. (Instead of immediately returning nb::Error::WouldBlock.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the linux_embedded_hal::Serial implementation of embedded_hal::serial::Read and inspect how it calls serial_unix::TTYPort::read. Verify the ppoll timeout behavior described in serial-rs and determine how the trait can return immediately with nb::Error::WouldBlock. Done means serial reads no longer block for the default 100ms when no data is available, with coverage for that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.