Yes, I have the right coupling from the app to the native code.  Yes,
I found out about using the sysfs entry.  The problem is that
interface is too slow.  I believe that I need to send an RPC call
directly to the hardware layer, and that interface is already defined,
but I can't figure out how to link to the function that does the RPC
call.  Essentially, I believe that I need to create something in the
actual Android code (as that's where the RPC function exists) that I
can call from either a Java app or native code.  This something would
make the RPC call and would essentially become an additional API for
any app that would be an alternative to sysfs, for the LED.

On Nov 23, 2:33 am, Mikkel Christensen <mikkel.christen...@ixonos.com>
wrote:
> 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=sa...
>
> 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- Hide quoted text -
>
> - Show quoted text -

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

Reply via email to