Toon as a domotica controller?

Everything about rooting Toons 1 and 2.

Moderators: marcelr, TheHogNL, Toonz

Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Toon as a domotica controller?

Post by Ierlandfan »

Just a little spinoff: Can we use vnc or can we recompile QT to include vnc?
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

Can we use vnc or can we recompile QT to include vnc?
VNC: possibly, some (not very sophisticated) code is available on github, for framebuffer devices.

I don't know where the VNC support in QT is located. If it's in the libraries, it should be feasible. If it's supposed to be in the gui (qt-gui, by Quby) it's a no-go.
Had a quick look at freerdp. It has lots of dependencies, at least when I build it on my x86_64 machine. It's not straightforward to port it to toon.

grtz,

marcelr
cygnusx
Starting Member
Starting Member
Posts: 48
Joined: Tue Apr 14, 2015 10:12 am

Re: Toon as a domotica controller?

Post by cygnusx »

The link you specified refers to QT 4. If i'm correct Quby uses QT 5.
There should be QT support in QT 5, but it's not out of the box i'm afraid. I tried it:

Code: Select all

toontje:~# /HCBv2/sbin/qt-gui -platform vnc:mode=websocket
[hxml] libhcb_xml          v0.1 r83    (Apr  8 2015 14:03:20) [master#7a8b1c7a52] (ezxml 0.8.6)
[hbxt] libhcb_boxtalk      v0.1 r85    (Mar 20 2014 18:55:21) []
[hcom] libhcb_com          v0.1 r91    (Apr  4 2012 15:02:48) [] (OpenSSL 0.9.8m)
[hdrv] libhcb_drv          v0.1 r272   (Jul 28 2015 15:36:22) [master#5c7df840aa]
[hbas] libhcb_base         v0.1 r171   (Aug 26 2014 11:16:40) []
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
This application failed to start because it could not find or load the Qt platform plugin "vnc".

Available platform plugins are: linuxfb.

Reinstalling the application may fix this problem.
Aborted
toontje:~#
Got it from this link: https://forum.qt.io/topic/57522/got-vnc ... -on-qt-5/3
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

I read somewhere that Qt dropped support for VNC some time ago :-(.

In the meantime, I just managed to build x11vnc for toon, with /dev/fb* support. Will try it tomorrow. According to the website of the maintainer, it should be able to inject touchscreen events as well. We'll see ..

grtz,

marcelr
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

Works, see attached images.

With x11vnc for toon and TigerVNC as client on my linux box, at least.

It also works on my (ancient) phone (android 2.something). I think we have our own version of "Toon op Afstand" within reach :-).

Need to clean up the start-up script, shrink the x11vnc server a little, figure out password handling, make the server persistent, write a short manual and then we're good to go.

grtz,

marcelr
Attachments
toon_remote_control.jpg
toon_remote_control.jpg (214.37 KiB) Viewed 16752 times
root_window_1280x720.jpg
root_window_1280x720.jpg (242.83 KiB) Viewed 16753 times
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Toon as a domotica controller?

Post by Ierlandfan »

That's great! Now we can use any device and place it anywhere to read Toon. We can even use the web version of vnc to show it on some webpage!
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

Need to clean up the start-up script, shrink the x11vnc server a little, figure out password handling, make the server persistent, write a short manual and then we're good to go.
Script: almost ready, still need to implement user/passwd.
Shrink the server: from 1.5MB down to 950kB, and more weight to be lost.
Figure out password handling: This is the tough one, can't get in with username/password switched on, probably need to patch the code a little (if I can find the errors I encounter). Without proper password security, the whole exercise is a bit pointless.
Make the server persistent: One CLI option, easy-peasy.
Write a short manual: TBD (installation, iptables, startup, less than 30 lines, most likely).

Extra security requirement: pass all data through SSL (VeNCrypt): done. I'm no expert on network security, so if someone has better ideas for tunneling the VNC connection to the client, I'm all ears.

I tested a bunch of VNC clients for android, so far, the only (free) one that seems to work properly with x11vnc's implementation of SSL is bVNC. On my linux box, TigerVNC works very well together with x11vnc.
Another thing: as soon as toon's screen goes black (modes "Weg", or "Slapen"), the VNC connection is lost. Need to figure out how to wake up toon remotely.

grtz,

marcelr
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Toon as a domotica controller?

Post by Ierlandfan »

Password: can't you use the CLI option - unixpw of -unixpw_nis ? It uses the "normal" unix usernames and passwords outside VNC.

http://www.karlrunge.com/x11vnc/x11vnc_ ... opt-unixpw
Ierlandfan
Member
Member
Posts: 151
Joined: Thu Oct 03, 2013 7:53 pm

Re: Toon as a domotica controller?

Post by Ierlandfan »

Another hardware idea this time. Find the tx and rx on the keteladapter and hook up an inexpensive ESP8266 WIFI module to it. So we can get rid of the cabled line and place Toon anywhere we want. Or hook it up to a Raspberry Pi or whatever server you have laying around and use Qemu to emulate Toon.
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

I had the server running properly with TLS support, client/server private certificates, the whole shebang, but there seems to be only one vnc client that supports this level of security (Karl Runge's own :-) ).
Ierlandfan wrote:Password: can't you use the CLI option - unixpw of -unixpw_nis ? It uses the "normal" unix usernames and passwords outside VNC.
http://www.karlrunge.com/x11vnc/x11vnc_ ... opt-unixpw
For security reasons, I prefer the vnc server not to be run by root. This can be achieved by switching to user 'nobody' immediately after server start-up. Then, the password verification mechanism doesn't work anymore, it relies on /bin/su, and that should be run with root permissions, otherwise it has no access to /etc/passwd. And, equally important, when using -unixpw, x11vnc presents a login screen that's hard to read on a small screen (phone), and then mostly fails to read user:passwd properly (and you would have to type it every time). Not a convenient way to enter your credentials.

So, for now at least, I reverted to an SSL tunnel, with the option -usepw, which uses a standard VNC password. The server still needs to be run with root access, but then again, most servers need to. I have tested with two simultaneously active clients: tigerVNC on my linux box and bVNC-free on my phone. This works, although there are some glitches when the wrong access mechanism is chosen (may hang the server). So, testers wanted!

Summary: VeNCrypt, over SSL, works, with a simple password handler. Not sure if this gives enough security for everyday use. Will cleanup the startup script tomorrow, write a small manual, and post the code (if the forum can take it, it's a ~450kB file). Still need to fix the VNC dropout when toon goes to sleep (Wake-on-lan?).
Ierlandfan wrote:Another hardware idea this time. Find the tx and rx on the keteladapter and hook up an inexpensive ESP8266 WIFI module to it. So we can get rid of the cabled line and place Toon anywhere we want. Or hook it up to a Raspberry Pi or whatever server you have laying around and use Qemu to emulate Toon.
The toon-ketelmodule interface has an unknown, proprietary hardware protocol (24V, with some serial modulation). The communication between the ketelmodule and the boiler is OT (or bang-bang) Also 24V. The module has an Atmel microcontroller (AtMega 328 IIRC), with a 6-pin header next to it. Not sure if this header has a serial port. If so, it could be done, I guess.

grtz,

marcelr
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

The first release of x11vnc for toon is now available :-)

Download the package, and follow the manual:

edit 20160601: download files moved to downloads thread.

Code: Select all

###############################################################################

Toon on a remote desktop and/or phone

20160501, marcelr, first release.

###############################################################################

Some time ago, cygnusx raised the question on remote control of toon, at the 
domoticaforum. Sounded interesting/nifty.

After some googling, x11vnc came out as the best option to run a remote desktop
service: It runs on linux, supports framebuffer devices, touchscreens, and is 
open source, therefore possible to implement on toon.

To cut a long story short: I made a stripped-down version of x11vnc for toon, 
and a script to start it up.

###############################################################################

What you need

###############################################################################

1: A rooted toon

2: x11vnc installation package for toon: x11vnc_0.9.13-r0_qb2.ipk 

3: A VNC client for your remote device (PC, phone, iPad, whatever), supporting
   VeNCrypt over SSL. I use TigerVNC on my desktop (linux or windows), and bVNC
   on my android phone. 

###############################################################################

What you need to do

###############################################################################

1: Download the two parts of the zipped x11vnc package, 
rename part two to x11vnc.z01, unpack, and upload x11vnc_0.9.13-r0_qb2.ipk to 
toon via scp:

$ scp x11vnc_0.9.13-r0_qb2.ipk root@toon:/root/

2: Install the package:

toon:~# opkg install x11vnc_0.9.13-r0_qb2.ipk 
Installing x11vnc (0.9.13-r0) to root...
Configuring x11vnc.

3: Check if the script exists (the binary is called x11vnc-bin):

toon:~# which x11vnc
/usr/bin/x11vnc


4: Run x11vnc. The first time, it will ask for a password, to be used with your
VNC client. Make sure to choose a STRONG password. Check out this list if you 
want to know what NOT to choose:

http://www.passwordrandom.com/most-popular-passwords

After entering the same password twice, x11vnc will ask you to save the 
password. Choose y.
Then, it will create the server and CA certificates for the TLS protocol.

A typical first-time run session looks like this:

toon:~# x11vnc
Enter VNC password: 
Verify password:    
Write password to /root/.vnc/passwd?  [y]/n y
Password written to: /root/.vnc/passwd

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            bd:32:02:0b:

...

what follows are several pages of text on the generated certificates.

...

-----END CERTIFICATE-----


The SSL VNC desktop is:  toon:0
PORT=5900
SSLPORT=5900
toon:~# 

5: x11vnc serves on tcp port 5900. This has to be opened on your toon's 
firewall.
Add the following line to /etc/default/iptables.conf:

-A HCB-INPUT -p tcp -m tcp --dport 5900 --tcp-flags SYN,RST,ACK SYN -j ACCEPT
   
(I like to keep these directives more or less tidy, so in my iptables.conf 
this line is in between similar directives for ports 22 and 10080).  

Restart the firewall:

$ /etc/init.d/iptables restart

###############################################################################

Accessing toon through VNC

###############################################################################

Install a VNC client (as said already: TigerVNC and bVNC are known to work).

Choose "Secure VNC over SSL tunnel" or something along these lines as 
connection type, enter your toon's access data (name, IP, port (default 5900) ) 
and the password set earlier in the first run of x11vnc. 

Connect to toon.

You should now have a working VNC connection, with toon's interactive display 
on your remote device.

For connections outside your own subnet, forward some unused high-number port 
(typically: 10000 < portnumber < 65535) to toon's port 5900 on your router. 
Read your router's manual for more info on port forwarding.

###############################################################################

To do

###############################################################################

Lots of testing :-)

Add x11vnc startup to /etc/inittab. x11vnc will not yet start up by itself 
after a reboot.

Find a way to keep toon from falling asleep when a VNC connection is active, or
wants access. When toon's screen is black ("Weg", or "Slapen") the VNC 
connection is dropped.
 
Maybe enhance security with dedicated server/client/root certificates.
Below is a picture of my test toon, forwarding its screen to a linux, a windows, and an android device :-).
Enjoy.

grtz,

marcelr
Attachments
x11vnc_on_toon.txt.zip
manual, also as download
(1.99 KiB) Downloaded 606 times
Toon's VNC on linux, windows and android, simultaneously.
Toon's VNC on linux, windows and android, simultaneously.
x11vnc_sc.jpg (211.65 KiB) Viewed 16478 times
wwolkers
Member
Member
Posts: 273
Joined: Tue Sep 23, 2008 10:10 am
Location: Netherlands
Contact:

Re: Toon as a domotica controller?

Post by wwolkers »

very ver nice again Marcel, thanks!
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

Thanks,
It's fun to do (beats a crossword or jigsaw puzzle any time).

About the issues:

Lots of testing :-) I trust you all do that, and report back :-)

Add x11vnc startup to /etc/inittab. x11vnc will not yet start up by itself
after a reboot. TBD

Find a way to keep toon from falling asleep when a VNC connection is active, or
wants access. When toon's screen is black ("Weg", or "Slapen") the VNC
connection is dropped. Seems not to be a server issue. My (older) TigerVNC client had that problem, bVNC doesn't.

Maybe enhance security with dedicated server/client/root certificates. Is that necessary? Any network security professionals out there?

grtz,

marcelr
hayman
Starting Member
Starting Member
Posts: 36
Joined: Fri Feb 26, 2016 6:16 pm

Re: Toon as a domotica controller?

Post by hayman »

after rooting toon when i type the ipadress of toon on explorer it's give me ((((advanced Zwave is disable on the app)))) how can i fix that ...?
thanks
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: Toon as a domotica controller?

Post by marcelr »

Try this.
(look for a post from Ierlandfan, just a bit down the page):

http://www.domoticaforum.eu/viewtopic.p ... 53#p=77453

Newer toon FW uses 10080 as http port instead of 7080.

grtz,

marcelr
Post Reply

Return to “Toon Rooting”