This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Permanently setting up GPIO on beaglbone running JB Android

I'm a little confused on how this is supposed to work.

Ultimately l'd like an android app that sets up and interfaces with the gpio on the beaglebone. I've tried to look into ways that the android application could create a process with root access to setup the gpio, but no luck.  It woud be great if the android app could export the gpio it was interested in using, but i understand the security issues of giving an app root.

I guess the way this is done, is by creating some sort of boot script that configures/exports all the gpio the android app will require. Is that right?
Where can i create a script under the android fs that will get executed each time the beaglebone boots?
Am i on the right track here?
  • Hi,

    Please refer to below link for GPIO user space control.

    http://processors.wiki.ti.com/index.php/GPIO_Driver_Guide

    I think you can access these sysfs file entries from application and control gpio.

    Regards,

    Pankaj Bharadiya

  • Hi,

    Thank you for the reply, yes i gpio support enabled in my kernel, i beleive that's in there by default if you use 

    make ARCH=arm CROSS_COMPILE-arm-eabi- am335x_evm_android_defconfig

    The real problem im running into is that in order to export the gpio pins i have to have root access to run ( for example) the following command:

    $ echo 30 > /sys/class/gpio/export

    I can do this from the adb terminal, but the next time to board is rebooted, the file handles disappear. I also can't do this from an android app because it lacks root access.

    It seems like i need to be able to do one of the following:

    Establish root access with the android app and run the above command or some sort of boot script that runs that will chmod 666 /sys/class/export.

    I would think this is a common problem for anyone running android on the beaglebone. How is everyone getting around this? I'm sure there's a simple way.

  • Here are a few others ideas on the topic

    https://groups.google.com/forum/?fromgroups=#!topic/beagleboard/BD0IPrzeLKc

    Is this the best method for access the gpio as a regular user? Is there not a way i can export the io pins permanently?

  • Andre Chouinard said:

    The real problem im running into is that in order to export the gpio pins i have to have root access to run ( for example) the following command:

    $ echo 30 > /sys/class/gpio/export

    I can do this from the adb terminal, but the next time to board is rebooted, the file handles disappear.

    You can modify the init.rc file in the filesystem to make this change permanent.

    Something like the following could work for you.

    chmod 0666 /sys/class/gpio/export

    write /sys/class/gpio/export 30