GithubHelp home page GithubHelp logo

No EOF on ARM about serial HOT 3 OPEN

tarm avatar tarm commented on August 21, 2024
No EOF on ARM

from serial.

Comments (3)

xiegeo avatar xiegeo commented on August 21, 2024 2

Thank you @amery, I can reproduce that on rpi with a USB serial device too. I feel that the problem is from the underlining USB driver, since read and close just forward the calls to the file handler, but have not got around to isolating the problem yet.

from serial.

amery avatar amery commented on August 21, 2024 1

I'm not getting EOF on intel either

https://gist.github.com/amery/eb19d400faf684fc92f677fed3eb7b86

package main

import (
        "io"
        "log"
        "time"

        "github.com/tarm/serial"
)

func read(buf []byte, f io.Reader, done chan error) {
        log.Println("Read")
        l, err := f.Read(buf)
        log.Println("Read", l, err, buf[:l])
        done <-err
}

func main() {
        tc := serial.Config{
                Name:     "/dev/ttyUSB0",
                Baud:     9600,
                Size:     8,
                Parity:   serial.ParityNone,
                StopBits: serial.Stop1,
        }

        port, err := serial.OpenPort(&tc)
        log.Println("OpenPort", &tc, port, err)

        if err == nil {
                var buf [256]byte

                done := make(chan error, 1)

                go read(buf[:], port, done)

                time.Sleep(time.Second * 2)

                err = port.Close()
                log.Println("Close", err)

                err = <-done
                log.Println("Done", err)
        }
}

but f.Read() never ends

2018/05/03 01:47:13 OpenPort &{/dev/ttyUSB0 9600 0s 8 78 1} &{0xc420096018} <nil>
2018/05/03 01:47:13 Read
2018/05/03 01:47:15 Close <nil>

from serial.

xiegeo avatar xiegeo commented on August 21, 2024

Can you show some minimum code that demo this? Include what you do to trigger EOF, and what hardware you use for serial connection.

I don't test for EOF in my own usage so I'm not sure how it's supposed to work, or how you are using it, but I can try reproducing it on my rpi-3 and I develop in Windows, since I'm interested in knowing and possibly eliminating any inconsistencies.

from serial.

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.