Android OS for embedded system with I2C, GPIO, UART communication

259 Views Asked by At

Currently, I'm working on iMX7D board (from Toradex) with Android Nougat 7.1.2.

I'm writing a connection to peripherals via I2C, GPIO, UART protocol (I'm using a JNI binding that interacts with lower layers like the kernel)

Before do that, I have to make config for this board like export GPIOs, grant permission for GPIOs and I2C and UART:

# export GPIO
    echo 112 > /sys/class/gpio/export
    echo 113 > /sys/class/gpio/export
    echo 58 > /sys/class/gpio/export

# grant permission
    chmod 777 gpio112/value
    chmod 777 gpio113/value
    chmod 777 gpio58/value
       
    chmod 777 /dev/i2c-3

    chmod 777 /dev/ttymxc2

The problem happened when I rebooting board, all configs that I make before was erased.

I searched on internet how the way export and grant permission automatically at startup, I've already tried but it either require root permission or re-config in Android OS image. I was stuck in here and don't have any solution now!!!

I don't have more experiment about Android OS in embedded system. How can I rooting Android OS in embedded system or Is there another way to solve this problem?

Any suggestions will be appreciated.

0

There are 0 best solutions below