Modifying kernel to expose GPIOs to user apps

133 views
Skip to first unread message

Agustin Feuerhake

unread,
Oct 28, 2014, 7:02:33 PM10/28/14
to android-porting
Hello,
I run a software company, we build Android apps, but have only had
experience on building apps for regular commercial smartphones.

Lately, a client that wants to build a specific hardware running
Android as the OS (they have a reference board that replicates a
Samsung phone and are working with some hardware designers in Miami)
have been asking us if we can access GPIO from Java...they want to
control some RGB leds to start with..

We've told them they need to modify and compile Android OS itself,
because there's no such thing as "GPIO permission" in Android's app
manifest. I'm pretty certain that is so... but what I don't know is what modifications exactly would we require to expose GPIOs in a good way?

Thank you!

--

Platanus

Agustin Feuerhake / co-fundador
agu...@platan.us

Platanus: (+562) 28818025 
Pedro Canisio 1441, Vitacura, Santiago, Chile

Shree Kumar

unread,
Oct 29, 2014, 11:00:05 AM10/29/14
to agu...@platan.us, android-porting

You will need to export the GPIOs to userspace.  The changes for this can be included in the initrd, and thus into the kernel boot image.  Look at the relevant file in kernel/Documentation.

Next, you need to allow apps to access the exported GPIO. A chmod 777 works to test things. Once this is done, the GPIO is just a file that can be accessed from anywhere, including a java app.

If you need to manage permissions to the GPIO, then more work is needed.

-- Shree

--
--
unsubscribe: android-porti...@googlegroups.com
website: http://groups.google.com/group/android-porting

---
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-porti...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Allen Curtis

unread,
Oct 29, 2014, 3:03:02 PM10/29/14
to android...@googlegroups.com
If you follow standard Android/kernel development standards, the GPIOs should be exported via "sysfs". The only customization you may need in the init script is to enable write permissions for your application.

Reply all
Reply to author
Forward
0 new messages