Reply
Thread Tools
Posts: 45 | Thanked: 30 times | Joined on Feb 2010 @ Germany
#1
If you have a desktop linux machine, you may be interested in running programs on that machine so they are displayed on the handheld. One way of doing this is to run vnc. The other way is using a traditional X11 connection. The latter has the benefit that you can easily run only a single application rather than getting the entire desktop displayed on the handheld. It is also the more "classic" way of doing this.

For most of you this may be pretty obvious and you can stop reading at this point.

For the others, please read on. The Howto became quite long. Don't let this scare you away. I believe in some points I was a little too verbose. It is really all just unix textbook stuff. You may want to scroll down to "Conclusions" to see what you can expect.

I tested this stuff on my n810 handheld and a debian desktop machine.

Step 1: Install ssh

Make sure you have ssh installed on both machines (desktop and handheld). Ssh consists of a daemon and a client program. For our purposes it is sufficient to have the daemon on the desktop machine and only the client on the handheld, but I strongly recommend to have daemons on both machines, so you can log in to your handheld from the desktop. This simplifies many tasks (including this one) quite a lot, because you can use the desktop keyboard to control your handheld.

Here is what I have installed:

On the desktop (running debian):
Code:
ii ssh 1:5.1p1-5                      
secure shell client and server (metapackage)
On the handheld:
Code:
ii  openssh        1:5.1p1-6.maem 
Secure shell client and server
When installing openssh on the handheld you will be prompted for a root password. On the desktop you no doubt already have a root password.

After the installations the ssh daemons should be running on both machines. Verify this:

On the desktop:
Code:
beaureve:~# ps -efa | grep sshd
root     19225     1  0 Mar10 ?        00:00:00 /usr/sbin/sshd
On the handheld:
Code:
Nokia-N810-43-7:~# ps -efa | grep sshd
 1195 root       3484 SW  /usr/sbin/sshd
Next, you should find out the ip addresses of the two machines and write an entry into the /etc/hosts files so you don't have to remember the IP addresses every time you want to use ssh.

On the desktop:
Code:
beaureve:~# ifconfig eth0 | grep "inet addr"
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
On the handheld
Code:
Nokia-N810-43-7:~# ifconfig wlan0 | grep "inet addr"
          inet addr:192.168.1.101  Bcast:192.168.1.255
          Mask:255.255.255.0
This assumes that the handheld's connection is via wlan and the wlan router is connected to the desktop via ethernet. You may also just run ifconfig without any parameters and it'll show all interfaces with their IP-addresses.

Then edit /etc/hosts on both machines and add entries like this:

On the desktop:
Code:
192.168.1.101   n810
On the handheld:
Code:
192.168.1.100 beaureve
The names "n810" and "beaureve" can be chosen at will. My desktop computer happens to be called "beaureve" (a cheap red wine BTW) and my handheld is called "n810".

At this point you should be able to log in to your handheld from the desktop and vice versa.
Code:
/home/martin >ssh root@n810
root@n810's password:
Nokia-N810-43-7:~# pwd
/root
The first time you do this, ssh will ask you questions like if you really want to do this. Yes you want!

You may get complaints about two unsupported options in /etc/ssh/ssh_config. If you comment out the two lines in that file, then ssh will no longer complain.

The next thing you want to do, it allowing ssh connections without having to answer the password prompt. A good howto can be found here. Here are the fundamentals

On the handheld:

You need to take the following steps as user "user" and not as root. When you start a terminal on the handheld you will be "user", but when you log in as root via ssh you are initially "root" and you need to "su - user". If you are uncertain who you are, run "id". Since we can already ssh to the handheld, we want to do everything from our desktop using a decent keyboard.

Code:
/home/martin >ssh root@n810
root@n810's password:
Nokia-N810-43-7:~# su - user


BusyBox v1.6.1 (2008-09-18 09:43:17 EEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $
Then follow Mathias Kettner's instructions. You better follow the original link above, because the code below has some confusing linebreaks.

Code:
user@n810:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa): 
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 user@n810

user@n810:~> ssh martin@beaureve mkdir -p .ssh
martin@beaureve's password: 

user@n810:~> cat .ssh/id_rsa.pub | ssh martin@beaureve 'cat >> .ssh/authorized_keys'
martin@beaureve's password:
Change the permissions of .ssh to 700 (chmod 700 .ssh)

At this point you should be able to forward commands from your handheld (as "user") to your desktop without having to answer a password:

On the handheld:
Code:
~ $ ssh martin@beaureve date
Thu Mar 11 16:36:33 CET 2010
I did not bother to do the same for the opposite direction, because I do not plan to invoke remote commands on the handheld. I believe it would be difficult anyways because "user" is somewhat crippled.

Step 2: forward X11

So far we can only run remote console commands. But we really want to run X11 (graphical) applications remotely. For this to work you may have to enable X11 forwarding.

On the desktop:
Make sure your /etc/ssh/sshd_config file contains the following lines
Code:
X11Forwarding yes
X11DisplayOffset 10
and they are not commented out. If you need to change the file, you must restart the sshd on the desktop:

Code:
beaureve:~# /etc/init.d/ssh restart
Restarting OpenBSD Secure Shell server: sshd.
beaureve:~#
All this must be done as root. At this point you should be able to invoke an X11 application from your handheld.

On the handheld:

Again make sure you are "user" and not "root".
Code:
Nokia-N810-43-7:/etc/ssh# su - user
Now you can e.g. start an xterm. The program will actually run on the desktop, but is is displayed on the handheld and accepts input from there. Note the two options "-X" and "-f" we pass to ssh:

Code:
~ $ ssh -X martin@beaureve -f xterm
~ $ Warning: No xauth data; using fake authentication data for X11 forwarding.
Warning: Cannot convert string "nil2" to type FontStruct
I'm not sure about the warnings. They never really got in my way. On the handheld you should then see this:

Name:  xterm.jpg
Views: 2519
Size:  12.8 KB

Step 3: Use personal menu

Install the personal menu package on the handheld (available on meamo.org). Then go to Control panel/Panels and replace one of the three existing panels with personal menu (I sacrificed "Contacts").

Next configure personal menu itself. There will be an entry in the Control panel under "Personalisation" called "Personal Menu". In the "Command to execute" field you can enter commands like one we used to invoke the xterm on the remote machine. Then you give the whole thing a name and chose an icon.

Name:  personalMenuEdit.jpg
Views: 2453
Size:  25.2 KB

You can do this for a couple of applications, and in the end your personal menu may look like this:

Name:  personalMenu.jpg
Views: 2448
Size:  21.6 KB

Finally here is a screenshot showing Amarok being displayed on the handheld.

Name:  amarok.jpg
Views: 2462
Size:  57.6 KB

Conclusion: pros and cons

Those applications start and run pretty fast. They use the power of the desktop computer and only need the handheld for displaying things. They are still not as fast as when run natively on the desktop, because there they can make use of good graphics hardware. The epiphany web browser is amazingly snappy as long as you don't run flash movies.

In general any kind of animation will cause high CPU usage or worse. You better disable the visualization in Amarok.

The programs do not respond to the fullscreen button. However some applications have a builtin "fullscreen" option which is selectable via a menu entry. The epiphany web browser runs in fullscreen just fine.

The onscreen keyboard will not pop up, when you need to enter texts. For n810 users, this means you have to use the hardware keyboard.

Some applications heavily rely on right (or middle) mouse clicks. I have not found a way to fake right mouse clicks. This makes file managers pretty difficult to operate and you cannot use mouse gestures in epiphany.

When running Amarok, sound is still played by the desktop's sound card (which is what I want). The sound will not arrive at the handheld's speakers. What you get is a remote control for Amarok.

You can do similar things with VLC. Here you have to use VLC's web interface because you don't want the graphics forwarded to your handheld. This way you will get a remote control for VLC.

Hope some find this useful.

Last edited by drautzburg; 2010-03-11 at 18:42. Reason: Conusing linebraks
 

The Following 4 Users Say Thank You to drautzburg For This Useful Post:
Posts: 1,751 | Thanked: 844 times | Joined on Feb 2010 @ Sweden
#2
Except the missing pictures you have done a great job. I do it little different but tunneling X through ssh is great.

I did it easy and installed a no-ip deamon on my desktop to set a dynamic ip-address. I do not have a router and this way i do not need to configuering ip-addresses.

Last edited by AlMehdi; 2010-03-11 at 18:08.
 
Posts: 45 | Thanked: 30 times | Joined on Feb 2010 @ Germany
#3
Gee, should have read faq_vb3_posting before. Hope the pictured are there now.
 
Reply


 
Forum Jump


All times are GMT. The time now is 01:37.