** 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
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
Attachments
Last edited: