Hi all,

I checked the source code, and found the permissin of  /dev/graphics/
fb0 is set by /system/core/init/devides.c, obviously, we can not
modify this file. So the only possible way to read framebuffe data
directly is to start the program as root (or user from graphics
group), or change effiective user id (euid) at run time.

Here is my experiment:

I build the c souce as executable first,  and it is working fine on
emualtor and rooted devices. I also tried to complipe it as SO and
load it through JNI, what I found is the java process and the SO have
the same userid (100XX), and I failed to setuid() and seteuid().
Then, we can see root previlidge is a must to access frame buffer
directly, and load through JNI also failed to do so.

Then, on a non-rooted device, it is even impossileb to start a process
as root. As Romain mentioned, to use the framebuffer directly is not a
recommemed way, then is there any better way to get framebuffer data ?

On 9月18日, 上午3时46分, Romain Guy <romain...@google.com> wrote:
> Also, you're not expected to use the framebuffer directly :)
>
>
>
> On Thu, Sep 17, 2009 at 12:43 PM, fadden <fad...@android.com> wrote:
>
> > On Sep 16, 6:30 pm, ZaichengQi <vml...@gmail.com> wrote:
> >> I wrote a JNI funtion from my test module using "fbfd = open("/dev/
> >> graphics/fb0", O_RDWR)", but the errno from <errno.h> returns me
> >> EACCES.
>
> > # ls -l /dev/graphics/fb0
> > crw-rw---- root     graphics  29,   0 2009-09-17 11:00 fb0
>
> > If you're not user "root" or group "graphics", the failure is
> > expected.
>
> > One of the other mailing lists might be more appropriate (android-ndk
> > for NDK questions, android-platform for permission stuff, etc).
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  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 Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to