I got this working! Basically I did not realize that SYSFS was more sophisticated than / proc and actually supported file permissions.
This is basically what I did to access a GPIO from Java land. echo "128" >/sys/class/gpio/export echo "out" > /sys/devices/virtual/gpio/gpio128/direction chmod 0666 /sys/devices/virtual/gpio/gpio128/value Now you have GPIO #128 exported in sysfs, configured as an output and accessible to your Java application. Anything else that is accessible via sysfs can be handled in a similar way. Enjoy! On Dec 29, 4:36 pm, A Curtis <ajcurti...@gmail.com> wrote: > Chris, > > Have you tried to access sysfs directly frdom Java? I have not been > able to get this to work. > > Could you provide a code fragment? > > TIA > > On Nov 23, 10:12 am, Chris Stratton <cs07...@gmail.com> wrote: > > > > > > > > > On Nov 23, 5:33 am, Mikkel Christensen <mikkel.christen...@ixonos.com> > > wrote: > > > > 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. > > > If it's already exposed in sysfs, you don't need to use native code. > > You should be able to access the special file directly from java if > > you have the permissions set right. If they are wrong, you can't > > access it from the ndk either. > > > > 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"); > > > Chaining the echo command seems wasteful. Why not just write to the > > special file yourself? -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting