zhonghai / android-vnc-server

Automatically exported from code.google.com/p/android-vnc-server
0 stars 0 forks source link

How to use JNI to open the fb0 ? #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
Edit int main(int argc,char **argv) to void start()
2.
Add a JNI function to call start().

JNIEXPORT jint JNICALL Java_com_vnc_start(JNIEnv *env, jobject this)
{
   start();
}

compile vnc server to libandroidvncserver.so.
3.
In java file,add code System.loadLibrary(androidvncserver);
And call start().

What do you see instead?
can't open fb0.Maybe don't hava the permission.

Is there a method to use JNI to call vnc-server? I want to use it as a dynamic 
library.

Original issue reported on code.google.com by zfr...@gmail.com on 19 Jan 2011 at 1:35

GoogleCodeExporter commented 9 years ago
Could you please let me know on the step by step process to compile the 
libandroidvncserver.so from the source code?

Original comment by kow...@gmail.com on 9 Feb 2011 at 10:25

GoogleCodeExporter commented 9 years ago
I edit this file :Android.mk for androidvncserver .At last code, edit it to be 
:included $(BUILD_SHARED_LIBRARY)
also edit the name after compiled:LOCAL_MODLE:libandroidvncserver.

And also edit the file:Android.mk for jpeg in external.edit it to be :included 
$(BUILD_STATIC_LIBRARY)

Then change the function "int main(int argc, char **argv)" to be "void start()" 
in fbvncserver.c.

Compiled, There will be a file libandroidvncserver.so.

I want to use a android app to call this SO using NDK. But failed.I seems only 
root can open it.

Do you have any suggestion?

Original comment by zfr...@gmail.com on 12 Feb 2011 at 2:47

GoogleCodeExporter commented 9 years ago
Thank you for the input. There are two external libraries that are needed (zlib 
and jpeg). I got the source code and build the corresponding library for jpeg. 
I copied the same to <project_home>/external/jpeg and compiled using ndk-build. 
However, I get a lot of error messages as shown below. Did you come across 
these errors and do you know how to fix them? I have attached the header file 
for reference. I would appreciate any help.
.
.
.
external/jpeg/jpeglib.h:848: error: expected ')' before '(' token
external/jpeg/jpeglib.h: In function 'EXTERN':
external/jpeg/jpeglib.h:928: error: expected declaration specifiers before 
'jpeg_std_error'
external/jpeg/jpeglib.h:944: error: expected declaration specifiers before 
'EXTERN'
external/jpeg/jpeglib.h:946: error: expected declaration specifiers before 
'EXTERN'
.
.
.

Original comment by kow...@gmail.com on 15 Feb 2011 at 12:00

Attachments:

GoogleCodeExporter commented 9 years ago
Please ignore my previous comment(#3). I had overlooked including some header 
files. Now that issue is fixed. However, I now have another problem. I compiled 
the libz.so and when I use ndk-build to create the libandroidvncserver.so, I 
get the following error.
libz.so: file not recognized: File format not recognized

How did you compile/obtain the libz.so library?

Original comment by kow...@gmail.com on 16 Feb 2011 at 6:09

GoogleCodeExporter commented 9 years ago
I was able to compile the libandroidvncserver.so but facing the same issue of 
"cannot open fb device /dev/graphics/fb0".
Looks like the android apps do not have access to kernel drivers and hence the 
permissions issue.
Were you able to solve the problem?

Original comment by kow...@gmail.com on 18 Feb 2011 at 7:13