Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use JNI to open the fb0 ? #22

Open
GoogleCodeExporter opened this issue Apr 14, 2016 · 5 comments
Open

How to use JNI to open the fb0 ? #22

GoogleCodeExporter opened this issue Apr 14, 2016 · 5 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 19 Jan 2011 at 1:35

@GoogleCodeExporter
Copy link
Author

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

Original comment by [email protected] on 9 Feb 2011 at 10:25

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 12 Feb 2011 at 2:47

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 15 Feb 2011 at 12:00

Attachments:

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 16 Feb 2011 at 6:09

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 18 Feb 2011 at 7:13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant