How to access GPIO on Android

Yes, all right.
You can have a try. :smile:

I am very sorry for such a late reply.
I will release the docs about how to request the gpio as interrupted function in next week.
Thanks.

Could you provide a low level api? I mean native calls.

You maybe need to have a try and google for it.
It is an example about how to control the serial by JNI
Thanks.

Sorry for the silly questions. I have a little experience in the Android development.
Thanks for the advice. I’ll try in the coming days.

A post was split to a new topic: How to request GPIOH_5 as INT mode

The pinout which you list is not include the two leds,can you show me how to control the two leds by echo cmd please?

The PWR_LED is controled by below chip and not CPU.


You can control the SYS_LED following below method

//IP_ADDR is the IP Adreess of your VIMs
# adb connect IP_ADDR
# adb shell 
//turn off led 
# echo off > /sys/class/leds/led-sys/trigger
//turn on led
# echo default-on > /sys/class/leds/led-sys/trigger

您好,关于gpio的number号,是如何计算的?为什么GPIOH5: 176

Question:

I understand how to get to root with su for the GPIO.

For the other options, how do you do it ?

2 Let the 3rd application as system process

Is this one just putting the app in priv-app in the rom ?

3 Open the permission for 3rd application on system

This one i don’t know how. Can you point me in the right direction ?

Thanks

You also need a system signature for the app.

You need to modify source code of the direction system/sepolicy

1 Like

Thank you, I will try the 2nd way.

Hello Terry ,
My understanding is that the gpio path in linux systems is “/sys/class/gpio/”.

I would like to know is it the same for even android systems?

Yes, it’s the same. :grinning:

Thank you very much Terry.

On the vim1 board, can I only control GPIO GPIOH5 and GPIOAO6?
I can not control GPIOH_6, there is always 1.5 volt power supply

Yes, you are right.

By default, the GPIOH_6 is for I2S. And you can’t control the GPIO.
You need to modify the source code if you want to control the GPIOH_6.

Hi @Terry in VIM 1 :
i change the
led_gpio = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
to
led_gpio = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;

sysled {
compatible = “amlogic, sysled”;
dev_name = “sysled”;
status = “okay”;
led_gpio = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
led_active_low = <1>;
};

and do the command under su :
echo 1 > /sys/class/leds/sys_led/brightness

but the sys_led can’t controll

I check, cat /sys/kernel/debug/pinctrl/pinctrl@4b0/pinmux-pins

pin 73 (GPIODV_24): c1108500.i2c (GPIO UNCLAIMED) function i2c_a group i2c_sda_a

GPIODV_24 used in i2c_sda_a

what’s the version of your system? Android Pie or Android Nougat?