[NDK App and Java App] Working on a new VNC Server V1.86

Search This thread

knoxbrder

Senior Member
Jan 10, 2009
338
79
Can one of you JB guys try to start the server from adb or a shell so you can see the output and post the output here?
 

knoxbrder

Senior Member
Jan 10, 2009
338
79
I will try to shrink the font on the next update. Don't have JB so it will be hit and miss.

Screenshots on Jelly Bean attached. As you can see the notification doesn't fit anymore because Android uses a bigger light font now to replace bolds. In debug it says the server has started but i can't access it at all.
 

knoxbrder

Senior Member
Jan 10, 2009
338
79

keyra74

Senior Member
Aug 6, 2009
1,449
203
ok i'll explain better so
when i use some roms on my htc evo 3D like the one i'm using now i can wake up screen with right button click, but some with modded powermenu seem to block that
every others functions buttons work
i'll try the page up down thing

works on "ok right click rom", gonna backup and install a non working one
 

frenccw

Senior Member
Jun 15, 2011
703
226
I will try to shrink the font on the next update. Don't have JB so it will be hit and miss.

Yup I can keep posting screenshots of your updates. Let me know how to get the output from starting server from adb/shell.

Edit: Just saw the instructions on OP. I don't understand half of it but i'll give it a shot

wHC7m.jpg


Am i doing this right? Forgive my noobness
 
Last edited:

knoxbrder

Senior Member
Jan 10, 2009
338
79
Thanks for trying to capture the output!

If you can start adb from Linux or Windows you are most of the way there!

From the adb prompt paste "/data/data/com.mrk2012.android.preferences/vncs" (without the "") and see what is spit out. You can see all the options by adding -h to the end. If you want, you can add all the exact options that appear in the gui start screen if you have debug turned on in the gui. (like in your previous screenshot)

Thanks again!


Thanks bro but i'm just trying to troubleshoot on JB as per OP's instructions above ;)
 

frenccw

Senior Member
Jun 15, 2011
703
226
Thanks for trying to capture the output!

If you can start adb from Linux or Windows you are most of the way there!

From the adb prompt paste "/data/data/com.mrk2012.android.preferences/vncs" (without the "") and see what is spit out. You can see all the options by adding -h to the end. If you want, you can add all the exact options that appear in the gui start screen if you have debug turned on in the gui. (like in your previous screenshot)

Thanks again!

o3oRU.jpg


Still doesn't work! Unless i'm doing something wrong...
 

frenccw

Senior Member
Jun 15, 2011
703
226
What is the output? Did it start but you can't connect?

Heh i knew i must be doing something wrong. I have no idea what output you are referring to. Okay basically what I did:

1. Connect phone to USB
2. Open command prompt at android tools
3. "adb shell"
4. "/data/data/com.mrk2012.android.preferences/vncs"
5. Results = screenshot attached earlier

Am i doing this steps right?
 

rowntreerob

Member
Dec 6, 2010
34
3
lib issue or link issue on 4.1.1

No longer able to run vncs from the CLI interface after upgrade to 4.1.1...

405 could not load needed library 'libsurfaceflinger_client.so' for './vncs'
for '/data/local/vncs/vncs' (load_library[1093]: Library 'libsurfaceflinger_client.so' not found)CANNOT LINK EXECUTABLE

is the error on galaxy nexus running 4.1.1 which has a 'surfacefinger' shared lib but, not s 'surfaceflinger_client'...

Code:
root@android:/ # find system -name "*so" | grep facefling                      
system/lib/libsurfaceflinger.so

Looks like the executable was linked with a shared lib thats no longer available in the runtime on 4.1.1...
That lib could be taken out of the build or provided as a static lib thats included in the exec.
Or i guess i could install a package that will provide that missing shared lib.
 
Last edited:

knoxbrder

Senior Member
Jan 10, 2009
338
79
I have been out of the country. I will look at the library issues on Jelly Bean tomorrow night.
If someone with the problem wants to PM me I will send them a test build since I don't have a Jelly Bean device yet.
 

knoxbrder

Senior Member
Jan 10, 2009
338
79
If you JB guys want to try this one let me know.
May need cleanup before general use; just tried removing the _client lib.

Need to rename vncs.apk to just vncs if you want to run it from the Android command line.
(I can't seem to upload it as just vncs anymore)

Please let me know if it works on JB.

I'm available anytime :good:
 

Attachments

  • vnclauncher.apk
    274.3 KB · Views: 313
  • vncs.apk
    368.5 KB · Views: 444
  • Like
Reactions: 九千. and frenccw

frenccw

Senior Member
Jun 15, 2011
703
226
If you JB guys want to try this one let me know.
May need cleanup before general use; just tried removing the _client lib.

Need to rename vncs.apk to just vncs if you want to run it from the Android command line.
(I can't seem to upload it as just vncs anymore)

Please let me know if it works on JB.

Working fine so far :D will report back after testing it a couple more hours. Keyboard and mouse input also working flawlessly so far. Thanks for the great update. How it looks on the notification bar now:

K87a0.png
 
  • Like
Reactions: knoxbrder

knoxbrder

Senior Member
Jan 10, 2009
338
79
Good to hear it is working.
Is that notification bar ok? What would you want changed?

Thanks for testing it :)


Working fine so far :D will report back after testing it a couple more hours. Keyboard and mouse input also working flawlessly so far. Thanks for the great update. How it looks on the notification bar now:

K87a0.png
 

rowntreerob

Member
Dec 6, 2010
34
3
thank you

STEPS:
get the 'vncs.apk' just above ( its an ELF exec file not an apk so i just renamed it to 'vncs'
if you have root, adb push renamed file to /data/local/vncs/vncs
then below instruction to start it ( use -m 2 to reduce somewhat large size on Gal Nexus )

CLI start:


# /data/local/vncs/vncs -t /dev/input/event1 -s -n
/data/local/vncs/vncs Version 1.87
need init
Initializing framebuffer device /dev/graphics/fb0...
--Initializing gingerbread access method--
screenshot info: 32 720 1280 3686400
xres=720, yres=1280, xresv=720, yresv=1280, xoffs=0, yoffs=0, bpp=32
bInitializing VNC server:
scale: 1
width: 720
height: 1280
bpp: 32
port: 5901
Initializing keyboard device uinput ...
init keyboard device as uinput
---Initializing uinput...---
---Initializing uinput...---
Not using TOUCH_DEVICE because of uinput
Initializing server...
rfbGetScreen bpp: 32
15/08/2012 21:53:57 Listening for VNC connections on TCP port 5901
15/08/2012 21:53:57 Listening for HTTP connections on TCP port 5801
15/08/2012 21:53:57 URL http://localhost:5801
16 8 8 8 0 8
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 23
    ** You need to have root to run this app! **

    I have been hacking up a vnc server from old code I found on Google. I will try to get the changes merged into the original project; if that fails I will start a new project or just post the source.
    This one works with my rooted Transformer Prime, a rooted Galaxy S2 and a CyanogenMod Nexus One perfectly. On a non-rooted Galaxy S2 everything works except the mouse/touch.

    This uses the new Screenshot code for Android and either the "uinput" user space input device, the "input" command line tool to send keys, or direct access to the Linux keyboard device. It uses either the "uinput" user space input device if specified for the keyboard or the Linux touch device / mousepad device (like on my Prime).

    I have been pushing the NDK app to /data/local/vncs using adb.
    Open an "adb shell" or local connectbot session. cd /data/local. and then a command like below:

    Try this first:
    ./vncs

    galaxy s2 has no mouse pointer: (touch won't work without root)
    ./vncs -t /dev/input/event2 -s -g -x 480 -y 800

    galaxy nexus has no mouse pointer: (touch won't work without root)
    ./vncs -t /dev/input/event1 -s -n -x ? -y ? (I don't know the values for the nexus touch size or if it auto detects)

    prime with keyboard has visible mouse pointer: (rooted ICS)
    ./vncs -t /dev/input/event5

    prime without keyboard has no mouse pointer: (rooted ICS)
    ./vncs -t /dev/input/event3

    nexus one with cyanogenmod: (rooted Gingerbread)
    ./vncs -t /dev/input/event3

    local Escape key is "back" on remote Android device
    local Windows or Home key is "home" on remote Android device
    local F1 or Menu or Pg-Up key is "menu" on remote Android device
    local F6 key is "camera" on some devices (not all)
    local Pg-Dn key is "call" on some devices (not all)
    local End key is "end call" and/or power on/off
    local Alt-o / Alt-i is "power off/on" on some devices
    local Alt-u is "volume up" on some devices
    local Alt-d is "volume down" on some devices

    Press F2 or Alt-p to pause/resume screen refresh. This is great for watching videos on the TV. If you don't disable the remote refresh then the video will jerk because of the screenshots being taken.
    If you have a Prime with the keyboard then you can use the mouse pointer version and see what you are clicking on even with screen refresh off.

    Press F4 or Alt-r to rotate the screen 90 degrees. 0,90,180,270 then back to 0. The connection disconnects for now so you will need to reconnect again. To keep reconnecting, in a shell on my laptop I use "while :; do vncviewer 192.168.0.5:1; sleep 1; done".

    Press F3 or Alt-s to change the scaling, normal, half, quarter then back to normal. The connection disconnects for now so you will need to reconnect again. To keep reconnecting, in a shell on my laptop I use "while :; do vncviewer 192.168.0.5:1; sleep 1; done".

    Press Alt-q to close the connection from the server side. It can be opened again from the client.

    I haven't tested on many other devices yet. Let me know of failures or successes!

    Command line switches on the server:
    -h show help
    -s swap red/blue colors
    -g galaxy s2 touchscreen
    -n galaxy nexus touchscreen
    -x touchscreen maximim x
    -y touchscreen maximim y
    -r rotate mode 0,1,2,3 = 0,90,180,270 degrees, default is 0
    -T touchscreen pointer rotate offset, 0-3=0,90,180,270, default is 0 (same rotation as screen)
    -m magnification 1/m, 1=fullsize, 2=half size, 4=quarter size
    -t touch device
    -k keyboard device, default is uinput command
    -p : password, default is none
    -d : delay between events, default is 300000
    -P : port, default is 5901
    -32 32bpp; default is 32 for snapshot, 16 for framebuffer
    -16 16bpp; default is 32 for snapshot, 16 for framebuffer
    -o hack to send touch events on non-rooted device
    -c red offset, red length, green offset, green length, blue offset, blue length; defaults 16,8,8,8,8,0
    -R connect to remote host:remote port
    -a average when scaling (slower but better looking)
    -C reconnect to listener if connection dropped

    Version 1.86

    ---------------------------------------
    Version 1.86 includes many new features such as connect to remote vnc listener, deliver VNC Java client on port 5800+, average pixels when scaling, touchscreen pointer rotation offset and generic color sequence settings (needed for some devices).
    If all connected clients support it then size and rotation are updated without disconnecting the client; if any client doesn't support it, then all clients are disconnected as it worked previously. Normally not a problem since most people only connect to a device with one client at a time.

    Connect to your device from a java enabled web browser with something like http://192.168.0.8:5801 if your normal port is 5901. The downloaded jar supports most things the standalone vnc clients support.

    ---------------------------------------
    Version 1.86 includes a Java Control App as well.
    It has the NDK app included in it so you only need to download the standalone exe if you don't want the Java App. The Java App extracts the NDK App when it runs and keeps it in its own Android directory structure (not in /data/local anymore).

    The GUI is now compiled for Android 2.2+ and now includes two desktop widgets: 1x1 and 4x1 and an option to turn on a notification that shows the current server status and a start/stop button. Notification icon and widgets change icon to give visual indication when the server is running.

    Custom Launchers and other apps can call activities to start/stop the server.
    Tasker Action Intent setup:
    Action: com.mrk2012.android.preferences.START (or STOP)
    Cat: Launcher
    Target: Broadcast Receiver

    For instance, I have my phone setup to start the server when I place it in the dock or connect power.

    I found/fixed a small bug with the refresh code, hopefully that will a) keep the widgets/notifications updating unless you stopped them from the menu and b) fix the "VNCPrefs has Stopped" display.

    ** You need to have root to run this app! **

    You can configure everything from the Java GUI. Check out the About/Help menu option to see the list of special keys and their functions.
    Also look in the Help section for a quick guide on how to configure the options for different types of devices. Post if you find some more working or not working devices.

    ---------------------------------------
    Todo:
    + done: scale viewer
    + done: switch between portrait/landscape in viewer
    + done: launch/control from gui
    + create generic option for specifying pointer setup so anyone can add a new device (superseded by using uinput)
    + fix input on undocked Prime (fixed with uinput)
    + add a way to start/stop the server from an email, sms or google voice
    + http server/applet
    - upgrade to latest vnc server library/applet
    - ctrl key (for connectbot mainly)

    Prime specifc keys:
    - page up/down keys
    - home/end keys
    - insert/delete keys
    - media/volume keys
    - other prime hard keys: wireless/mouse/bluetooth/contrast/camera/etc
    2
    Useful program, working well in my s2.
    Anybody knows a way or apk to turn on screen without press any key?? From vncviewer for example..


    Thanks

    local End key is "end call" and/or power on/off
    local Alt-o / Alt-i is "power off/on" on some devices
    2
    If you JB guys want to try this one let me know.
    May need cleanup before general use; just tried removing the _client lib.

    Need to rename vncs.apk to just vncs if you want to run it from the Android command line.
    (I can't seem to upload it as just vncs anymore)

    Please let me know if it works on JB.

    I'm available anytime :good:
    2
    Great. Thanks for the info.

    I will build a GUI version that has the old and new version of vncs in it so everyone can use it.

    I'm also working on compiling for x86; maybe we can give that a go in the new year.


    Hi, i can confirm this works on 4.2.1

    My devics is asus tf101 running eos4 previewB94(20121221) android 4.2.1

    //this the first time I run this app, so just want to let you know it works

    Happy holidays and thank you.
    =========================
    u0_a36@android:/data/local # ./vncs-4.1
    --Initializing gingerbread access method--
    screenshot info: 32 1280 800 4096000
    27/12/2012 13:03:29 Listening for VNC connections on TCP port 5901
    27/12/2012 13:03:29 Listening for HTTP connections on TCP port 5801
    27/12/2012 13:03:29 URL http://localhost:5801
    27/12/2012 13:03:50 Got connection from client 192.168.1.118
    27/12/2012 13:03:50 other clients:
    27/12/2012 13:03:50 Client Protocol Version 3.7
    27/12/2012 13:03:50 Protocol version sent 3.7, using 3.7
    27/12/2012 13:03:50 rfbProcessClientSecurityType: executing handler for type 1
    27/12/2012 13:03:50 Pixel format for client 192.168.1.118:
    27/12/2012 13:03:50 16 bpp, depth 16, little endian
    27/12/2012 13:03:50 true colour: max r 31 g 63 b 31, shift r 11 g 5 b 0
    27/12/2012 13:03:50 Enabling NewFBSize protocol extension for client 192.168.1.118
    27/12/2012 13:03:50 Using ZRLE encoding for client 192.168.1.118
    key: 0x9e 0 0
    ========
    2
    Version 1.60 in this post

    Version 1.60 in this post.

    Lots of new features! If it seems stable I will move it to the first post.

    new vncs command line options:
    -a averages a 2x2 section of pixels in half and quarter zoom (maybe 4x4 in quarter mode later)
    -R host: port (no space between host , : and port) to connect to a host running vncviewer in listen mode (usually -listen on the vncviewer command line).

    new gui options:
    Use Average in zoom modes. (compare the original.png and averaged.png images)
    Connect to remote viewer in listen mode.
    Show Configure Notification.
    Show Start/Stop Notification. Includes status of server: not running or running and PID if running.
    Notification Refresh Time (5,10,15,30,60 seconds). This is polled for now so I am not sure how this will effect battery life.

    Averaging does slow it down (at least for now). And for now you have to restart the server for the option to take effect.

    On ICS devices (maybe Honeycomb?) the Notifications are shown together since individual buttons in a Notification can launch separate intents. On older devices they are shown as separate Notifications.

    You need to use the GUI if you want the notifications since it creates them, not the command line app.

    The remote host option should allow a cellular device to connect to your home computer since you normally have a non-NAT address at home. (at least you can route a port thru your home firewall). Even if you connect in remote/listen mode you can still connect the normal way if the remote connection closes or fails.

    Let me know how it works!