Linux modules to Android App (JNI, permission,tutorial)

208 views
Skip to first unread message

new-Be

unread,
Nov 20, 2013, 5:05:29 PM11/20/13
to android...@googlegroups.com
Hi,

I am a newbie in Android embedded!

I used to develop Linux devices drivers, and now I try to do the same under Android.

I used beaglebone black board with kernel 3.8 and jelly bean

I compiled my kernel and a basic module call drv.ko


Q1: In my module Android.mk I put LOCAL_PREBUILT_EXECUTABLES

It seems to be correct, but is there a LOCAL_OPTIONS specific to kernel modules ?


Q2: Actually I can load this driver with adb shell . I would like to load this driver at start up?
 Should I modify file init.rc or init_am335evm.rc like that?

on device-added /system/lib/modules/drv.ko
    chmod 777 /dev/drv

or with /etc/modules ?

or both?

I also developed a  shared library found in /system/lib/libdriver.so
And in order to use my driver since graphic interface, I developed a jni interface call lib_jni_drv.so (/system/lib/lib_jni_drv.so)

My big problem is the fact that my app do not have read/write permission acces to /dev/driver through libdriver.so

logcat :
E/Trace(1257): error opening trace file: Permission denied (13)

I load my app since eclipse for Android.

I add these line in my manifest.xml
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"></uses-permission> 

Q3: What should I put in manifest.xml in order to have read/write access to devices /dev/your_devices?



Q4: Do you have any tutorial, website, books which explain, how to use Android in low-level?
I prefer to work in side and after ask question if needed.

Except Embedded Android by karim yaghmour I didn't find anything related to this subject.


 Thanks by advance

petter

unread,
Nov 25, 2013, 2:00:30 AM11/25/13
to android...@googlegroups.com
Hi, in android when you wanna write driver or something which needs to operate in root mode, you should write service and this service run like root user. Than write client app which will use this service, there are lot of examples in AOSP (surfaceflinger, mediaserver, ..). Other possibility is to add "android:sharedUserId="android.uid.system" into manifest of your app and you will get system permissions or you can chmod your driver from init.rc script for your user id, but this is not right solution.

Dne středa, 20. listopadu 2013 23:05:29 UTC+1 new-Be napsal(a):
Reply all
Reply to author
Forward
0 new messages