Hello,

I would use the SimpleJNI sample application [1] as a base reference.
This does the right coupling from Android application to your lower
level hardware interface.

If the LED is already exposed in sysfs you are lucky and it should be
quite easy. Otherwise create a Kernel device driver that does the
exposure of the LED to sysfs.

Then in the /jni/native.cpp function do the proper write to the sysfs
entry like this (note: this depends on how the led is exposed trough
sysfs):

ret = system("echo 1 > /sys/class/leds/red/brightness");

Make sure that you have given the right write permissions to the LED
sysfs entry. This can be done in your init.rc file.

Best regards,
 Mikkel Christensen

[1] 
http://android.git.kernel.org/?p=platform/development.git;a=tree;f=samples/SimpleJNI

On Nov 17, 12:10 am, "jon.schell" <jon.sch...@kyocera.com> wrote:
> I am trying to create a simple app for testing that will toggle an LED
> on the phone as needed.  I have the NDK set up and my c code compiles,
> but I don't know how to link it to the actual hardware function that
> would set the LED.  I'm using the actual source code for the hardware,
> it's not in an exposed library.  Do I need to create a static library
> for it to use?  Would it maybe be easier to add an android API for
> this somehow rather than using the NDK?
>
> For reference, this is Android 2.1 on a Qualcomm MSM7627.
>
> Jonathan

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

Reply via email to