You are making this device world readable and writeable to all applications... this is probably not what you want. Generally we define a group id for access to a device, and allow apps to get access to it with a permission that is associated with the group id. (Or actually more often have a system service that opens and manages the device, and can return an fd to the client if appropriate.)
On Mon, Jul 13, 2009 at 10:57 AM, Puneet <puneetjindal.1...@gmail.com>wrote: > > Hi everybody, > > I have solved the above problem as follows : > > I edited the file : <android-workspace>/system/core/init/devices.c > and, added the line : { "/dev/ttyUSB0", 0666, AID_ROOT, AID_ROOT, > 0 }, > to the data structure : static struct perms_ devperms[]. > > Now, whenever /dev/ttyUSB0 is created, it has the permissions : > crw-rw-rw- root root > > > Any comments, whether this is a good solution ? > > And, does anyone know whether it is possible to do it with "udev > scripts" ? > > > Thanks, > Puneet Jindal > > > On Jul 4, 2:49 pm, Puneet <puneetjindal.1...@gmail.com> wrote: > > Hi everybody, > > > > I am trying to run Android on my prototype phone. The phone has a > > sensor (a device that reports its orientation to the phone) attached > > to it through the USB interface. > > > > I have developed a hardware module for that sensor, the name of the > > shared library for the module being "sensors.default.so". The module > > communicates with the sensor through the device file /dev/ttyUSB0. > > > > The problem I am facing is that the device file /dev/ttyUSB0 has > > permissions as: > > crw------- root root 188, 0 > > 1980-01-10 18:47 ttyUSB0 > > > > So, when I test the module's functionality by running a test android > > application, the application doesn't have enough privileges to read/ > > write from/to the device file. So, the results are negative. > > > > And, if I test the same functionality by running a native test > > application (via the adb shell, so it runs as root), the results are > > positive. > > > > I tried to solve this issue by modifying the startup scripts (these > > run as root) to change the device file permissions at startup, but it > > seems that the device file is created after the scripts have completed > > their execution. > > > > Any suggestions on what should be done, to make the android > > application able to read/write from/to the device file ? > > How to change the device file permissions at the time of creation ? > > > > Thanks, > > Puneet Jindal > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---