Wednesday, April 12, 2017

Remote desktop/remote display viewer for Ubuntu Touch devices?



I was wondering, is there a tool that I could run on Ubuntu Desktop, and be connected to an Ubuntu Touch device through a remote desktop (or remote display) application, such that mouse clicks are also propagated as taps on the device (and also, copy/paste of text)?



Basically, if Ubuntu Touch used X11, then I could have used vinaigre or xvnc4viewer on Ubuntu Desktop as VNC clients, and Vino as VNC server on the device - however, Ubuntu Touch uses Mir, and I cannot really find any information about remote desktop/display via Mir.



So, is there anything like this out there?



Well, there is a partial solution - in the sense of you can view the screen, but not control it from the mouse. I noticed it by running phablet-screenshot in debug mode, which reports that it uses a program mirscreencast on the phone.




There is a bit more about it in https://wiki.ubuntu.com/Touch/ScreenRecording, however, the most convenient command line I found on ... Youtube:



Realtime screencasting from Ubuntu Phone - mirscreencast to computer desktop in real time. - YouTube




Starting transmission (on device):



mirscreencast -m /run/mir_socket --stdout --cap-interval 1 -s 270 480 | gzip -c | nc 192.168.0.5 1234  



Receiving transmission (on desktop PC):



nc -l -p 1234 | gzip -dc | mplayer -demuxer rawvideo -rawvideo w=270:h=480:format=rgba -






Also, there is https://github.com/ycheng/mir-vnc-server - kinda experimental, I managed to get it to compile on 14.04 phone and run, and can connect through a VNC client, but I cannot get a realtime update of screen (only the first frame is shown, and no mouse is updated); here are my notes - unfortunately, not totally complete, but gives an idea:




# in 64-bit Ubuntu 14.04:
# (/path/to/docker is general storage dir)
git clone https://github.com/ycheng/mir-vnc-server.git /path/to/docker/mir-vnc-server_git
sudo docker pull z3ntu/ubuntu-touch-build-env
sudo service docker start
sudo docker run -vit /path/to/docker/:/var/ubuntu_touch z3ntu/ubuntu-touch-build-env /bin/bash

sudo apt-get install gcc-arm-linux-gnueabi binutils-arm-linux-gnueabi
sudo apt-get install g++-arm-linux-gnueabi

sudo apt-get install g++-arm-linux-gnueabihf
sudo apt-get install libvncserver-dev # else dummyvncserver.c:3:21: fatal error: rfb/rfb.h: No such file or directory
sudo ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include/ # else /usr/include/zlib.h:34:19: fatal error: zconf.h: No such file or directory
sudo apt-get install libmirclient-dev # else fatal error: mir_toolkit/mir_client_library.h: No such file or directory
sudo apt-get install libgles2-mesa-dev # else fatal error: EGL/egl.h: No such file or directory



# because of ..../arm-linux-gnueabi/bin/ld: cannot find -lvncserver:
apt-get source libvncserver0


apt-get source zlib1g
cd zlib-1.2.8.dfsg/
./configure
CC=arm-linux-gnueabi-gcc make
# should get: ./libz.so.1.2.8: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, ...
cp -a *.so* /path/to/docker/libvncserver-0.9.9+dfsg/
cd ..

cd libvncserver-0.9.9+dfsg

aclocal
autoconf
autoheader
automake --add-missing
# ld: cannot find -lgcrypt, -lgnutls, -lws2_32; so:
# in configure, comment out 'LIBS="$LIBS -lws2_32"', and then:
LD_LIBRARY_PATH=${PWD} ./configure --host=arm-linux-gnueabi --without-gcrypt --without-gnutls
cd libvncserver/
CC=arm-linux-gnueabi-gcc make CFLAGS+="-DLIBVNCSERVER_HAVE_GETTIMEOFDAY -DLIBVNCSERVER_HAVE_LIBZ"
# should get: libvncserver/.libs/libvncserver.so.0.0.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, ...

cp libvncserver/.libs/* /path/to/docker/mir-vnc-server_git/

cd /path/to/docker/mir-vnc-server_git/
LD_LIBRARY_PATH=${PWD} CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabihf-g++ make

# here got stuck, and went on phone instead:
# http://askubuntu.com/questions/600065/consequences-of-using-apt-get-in-ubuntu-touch
# phablet-config writable-image
# more-less repeated the procedure above, but on the phone - possibly with some changes in Makefile and/or source files (unfortunately, lost)
# final linking command for executable had to be issued manually, it was:

g++ mirvncserver.o -o mirvncserver -L/usr/lib/arm-linux-gnueabihf -lpthread -lmircommon -lmirclient -lmirprotobuf -lEGL -lboost_program_options -lxcb-glx -lGLESv2 -lmirserver -lvncserver

# run like this - in a phone terminal shell:
# -s 270 480: WARNING: Width (270) is not a multiple of 4. VncViewer has problems with that.
./mirvncserver -m /run/mir_socket --cap-interval 2 -s 268 480

# then on desktop - use the IP address of the phone on the local network:
xvnc4viewer 192.168.XXX.YYY

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...