Coder Social home page Coder Social logo

Comments (5)

mlsvrts avatar mlsvrts commented on May 26, 2024

Possibly related to #25

I guess that the current solution for 'wait forever' on read would be:

port.set_timeout(Duration::MAX).ok();

from serialport-rs.

eranknafo2001 avatar eranknafo2001 commented on May 26, 2024

At least in posix systems, it is because of this:

    #[cfg(target_os = "linux")]
    let wait_res = {
        let timespec = TimeSpec::milliseconds(milliseconds);
        nix::poll::ppoll(slice::from_mut(&mut fd), Some(timespec), SigSet::empty())
    };
    #[cfg(not(target_os = "linux"))]
    let wait_res = nix::poll::poll(slice::from_mut(&mut fd), milliseconds as nix::libc::c_int);

from the file: src/posix/poll.rs.

In the case of linux systems, the ppoll timeout parameter needs to be None to block without timeout.
In the case of non-linux systems, the poll's timeout parameter needs to be negative to block without timeout.
In both cases the default timeout of the library (0) will cause to always return without blocking.

from serialport-rs.

mlsvrts avatar mlsvrts commented on May 26, 2024

@eranknafo2001 Agreed, but I don't think there is any way to express 'no timeout' in serialport-rs (see my comment here) -- so we're left with 'wait for a really long time' as a work-around.

from serialport-rs.

eranknafo2001 avatar eranknafo2001 commented on May 26, 2024

I created a PR to fix it #50

from serialport-rs.

DanielJoyce avatar DanielJoyce commented on May 26, 2024

Termios is a layer on top of a raw serial port. I think serial port library should just stick to simple support for serial port, and we can write extensions on top. But we shouldn't complicate serial-port-rs.

from serialport-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.