Echoing to /sys/class/gpio/export doesn't work

Discussion in 'UDOO QUAD' started by Flavio Pompermaier, Feb 11, 2018.

Tags:
  1. Flavio Pompermaier

    Flavio Pompermaier New Member

    Joined:
    Apr 13, 2016
    Messages:
    20
    Likes Received:
    2
    Hi to all,
    I'm trying to integrate my Udoo with Openhab2. The GPIO binding seems to need export/import echoing working but in my case it doesn't..is it normal?
    Looking around the documentation and forums it seems I should be able to do something like:

    echo "18" > /sys/class/gpio/export
    echo "out" > /sys/class/gpio/gpio18/direction
    echo "1" > /sys/class/gpio/gpio18/value
    echo "18" > /sys/class/gpio/unexport

    But I get the following errors:

    echo "18" > /sys/class/gpio/export => -bash: echo: write error: Device or resource busy
    echo "18" > /sys/class/gpio/unexport => -bash: echo: write error: Invalid argument

    What can I do to fix this behaviour?

    Best,
    Flavio
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    What if you use sudo?
     
  3. Flavio Pompermaier

    Flavio Pompermaier New Member

    Joined:
    Apr 13, 2016
    Messages:
    20
    Likes Received:
    2
  4. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  5. Flavio Pompermaier

    Flavio Pompermaier New Member

    Joined:
    Apr 13, 2016
    Messages:
    20
    Likes Received:
    2
    After a very deep debugging I found out that both OpenHab2 and Node-red are compatible with my Udoo quad... :(
    OpenHab2 interface with GPIO with an old binding implementation that doesn't work well with the current GPIO interface provided (it fails while trying to call gpio import/export) while I cannot find any working GPIO abstraction to integrate into node-red. I've tried to install node-red-contrib-gpio but no way to make it work.

    Is there anyone that was able to integrate udoo-quad with Node-red? That would be wesome
     
  6. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  7. Flavio Pompermaier

    Flavio Pompermaier New Member

    Joined:
    Apr 13, 2016
    Messages:
    20
    Likes Received:
    2
    I've already tried it but it didn't work...no way to make call to export and import work without errors
     
  8. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Did you do this with openhab running? Because then openhab gpio service could block the gpio handling.

    Edit: what do you see with "ls /gpio" or "ls /sys/class/gpio"? Are there already exported gpio?
     
  9. Flavio Pompermaier

    Flavio Pompermaier New Member

    Joined:
    Apr 13, 2016
    Messages:
    20
    Likes Received:
    2
    I've tried with both openhab2 running and (after rebooting) without it running. i found that all gpios are already present so expor/import always gave me that error. is there a way to not initialize them at boot ( making it somehow compatible ith the current implementation)? However I fear that the openhab2 GPIO binding is not very maintained
     
  10. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    You will have to disable the Udoo-gpio-export script. So somewhere in the boot scripts (init.d?) this script is run. Or make the script empty so it will not do anything. Perhaps uninstalling is also possible. I am not that good Linux expert.
    https://github.com/ektor5/udoo-gpio-export

    @ektor5 can you describe shortly how to disable your script?
     

Share This Page