Giter VIP home page Giter VIP logo

Comments (5)

xtacocorex avatar xtacocorex commented on June 2, 2024

Are you properly cleaning up the GPIO before exiting out of the interpreter?
What happens if you do: ls /sys/class/gpio

from chip_io.

miaooss avatar miaooss commented on June 2, 2024

I have the same error using python 2.7.9

root@chip:/home/chip# ls /sys/class/gpio
export gpiochip0 gpiochip1013 gpiochip1021 unexport

from chip_io.

gerardogm avatar gerardogm commented on June 2, 2024

I see the same error being displayed when debug mode is active. In my case, GPIO works even when these messages are being displayed.

I think this is caused by a small bug on function gpio_export on event_gpio.c:

    ssize_t s = write(fd, str_gpio, len);  e_no = errno;
    if (DEBUG)
        if (e_no)
            printf("gpio_export: something went wrong: %s\n", strerror(e_no));

I'm not an expert on C, but according to what I researched you should only check errno when you get an erroneous result. In this case, we should check the value returned by write first, and if it's different to the value of len, then we should check the error code the function set into errno (this check is done further in the gpio_export function and it passes in my tests). You should expect the stdlib functions to set errno only in case of error. In this case, a previous function call set the errno variable to "2" (no such file or directory), so when the code above checked errno, the error line was printed. I made a test change to print errno before and after the write call and confirmed the errno code of "2" was there before the call to write, so I think we can ignore these errors. I'll try to submit a patch for this, it's pretty simple.

from chip_io.

jshcmpbll avatar jshcmpbll commented on June 2, 2024

Nice work! I haven't used the GPIO pins on my CHIP for anything and with it being so long I can't remember if this issue is the reason I never fully utilized it. Either way nice contribution!

from chip_io.

gerardogm avatar gerardogm commented on June 2, 2024

Nice work! I haven't used the GPIO pins on my CHIP for anything and with it being so long I can't remember if this issue is the reason I never fully utilized it. Either way nice contribution!

Thanks for your kind words! And also thank you for opening this issue in the first place: it inspired me to search for an answer to this problem :)

Regards,
-G.

from chip_io.

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.