Please don't reply to this thread. There is another thread for this : http://groups.google.com/group/android-framework/browse_thread/thread/cb479e73702b99a
-- Puneet Jindal On Jul 13, 1:19 pm, Puneet <puneetjindal.1...@gmail.com> wrote: > Hi everybody, > > I have a compass attached to my prototype phone via the > USB interface. I also have a shared library (provided by the > vendor of the compass), that communicates with the compass. > > There is a function "connect()" in the shared library that, > as I traced via the "strace" command, makes the system call : > open(“/dev/ttyUSB0”, O_RDWR | O_NONBLOCK | O_NOCTTY | O_LARGEFILE). > > The Linux permissions for the device file "/dev/ttyUSB0" are 777, > so that anybody can read and write to this file. > > I have a native test application "qsnsrtest", that calls > this function "connect()". > - When run as uid=0(root) gid=0(root), the function SUCCEEDES. > I used adb shell to launched qsnsrtest. > - When run as uid=10018(app_18) gid=10018(app_18), > the function SUCCEEDES. > I used adb shell, then su app_18, and then launched qsnsrtest. > > I have another java test application HelloCompass. It gets an > instance of SensorManager, and the constructor calls some > native methods (via JNI), and that native methods finally call > the same function "connect()". > - It runs as uid=10018(app_18) gid=10018(app_18), > and the function FAILS. > > There is a process "system_server" that starts at bootup. > It is part of Android, and is written in Java. It also does > the same functon calls as HelloCompass. > - It runs as uid=1000(system) gid=1000(system), > and the function SUCCEEDES. > > What I conclude from this is : > ==================== > The device file is having permissions to be read/written by anyone, > and "qsnsrtest" when run as uid=10018, is able to access the device. > So, the Linux kernel is, for sure, not creating the problem. > > The Android application, HelloCompass isn’t being permitted to > access that file. May be it needs some permissions to be granted > to it, to access device files. > Also, FYI, it is able to read/write to the file "/data/compass.log". > > Anyone having any idea about how to solve the problem ? > If "Android permissions" is the issue, then what permissions > need to be given to the application ? > > I have tried granting the following permissions, but not successful. > > android.permission.HARDWARE_TEST > android.permission.READ_LOGS > android.permission.READ_OWNER_DATA > android.permission.WRITE_OWNER_DATA > android.permission.WRITE_SECURE_SETTINGS > android.permission.WRITE_SECURE_SETTINGS > android.permission.ACCESS_COARSE_LOCATION > android.permission.ACCESS_FINE_LOCATION > android.permission.ACCESS_LOCATION_EXTRA_COMMANDS > android.permission.ACCESS_MOCK_LOCATION > android.permission.CONTROL_LOCATION_UPDATES > > Thanks, > Puneet Jindal --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "android-framework" group. To post to this group, send email to android-framework@googlegroups.com To unsubscribe from this group, send email to android-framework+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-framework?hl=en -~----------~----~----~----~------~----~------~--~---