Notices


Reply
Thread Tools
Posts: 2 | Thanked: 11 times | Joined on Nov 2017
#1
Not wishing to necrobump and old post; https://talk.maemo.org/showthread.php?t=41848 I found a clunky workaround to capturing keyboard input for X forwarding.

I did this with Chromium, which may appeal to those that don't wish to use the native web-browser due to security issues.

Initially I found that the hardware N900 keyboard did not capture the X forwarded Chromium instance and instead sent keyboard input to the terminal, so tried to use xvkbd as an alternative input method, but accidentally discovered that typing with xvkbd it gave the N900 hardware keyboard focus of the X forwarded application and continued to work even if I killed xvkbd.

This is a clunky fix though so there's probably a more elegant solution, this could be written into a shell script or other. Regardless, here are the steps I go through to run Chromium on the N900;

First up is the SSH session to the server with Chromium and xvkbd installed on it;

Code:
ssh -YC user@192.x.x.x
C for compression, Y as this is a trusted client.
Then with the remote shell;
Code:
chromium > /dev/null 2>&1 &
xvkbd -window *Chrom* > /dev/null 2>&1 &
It's important to wait for Chromium to open, such that xvkbd's explicit window capture works, so if you write this into a shell script you may wish to add a sleep command before invoking xvkbd, this is because you cannot select the Chromium window normally from xvkbd's GUI on the N900, you must specify it from the shell. This should work for any other X forwarded program you need input with, though I've not tested it.

Once both are open, go into the xvkbd GUI and type anything and press xvkbd's return, Chromium should accept this input, plus at this stage it will give the N900's own hardware keyboard focus of Chromium, so you can close xvkbd.

As I say, it's far from elegant, but it's a workaround some of you may appreciate.

 

The Following 11 Users Say Thank You to opt1mus For This Useful Post:
Community Council | Posts: 4,438 | Thanked: 11,076 times | Joined on May 2012 @ Southerrn Finland
#2
Okay, this qualifies as the crazy hack of the month!
 

The Following 5 Users Say Thank You to juiceme For This Useful Post:
Posts: 799 | Thanked: 2,601 times | Joined on Jan 2011 @ Germany
#3
You should be able to get the same result with wmctrl and its -a or -R switch.
You'll still need to wait for the Chromium window to be rendered, but you won't have to close the xvkbd window afterwards.

slightly off-topic:
Combine this with a pocketable computer (some compute stick or a Zbox pico or a single-board computer) that is powered by a powerbank, and you should be able to offload any computing from the aged N900 to a relatively powerfull "server" at rather low costs in terms of money and mobility.
For testing, any laptop will do that doesn't die due to overheating when stored running in your backpack.

Im not sure about the optimal interface betweeen those two devices though.
The obvious choice would be wifi, but you might need that for communicating with the outside world. A 2nd wifi adapter might be necessary.
An alternative could be Bluetooth (PAN), but the N900 only supports BT 2.1, which severely limits the data rate to 2.1Mbit/s.
 

The Following 8 Users Say Thank You to sulu For This Useful Post:
Posts: 805 | Thanked: 2,861 times | Joined on Apr 2012
#4
Originally Posted by sulu View Post
Im not sure about the optimal interface betweeen those two devices though.
What about USB? As a bonus, you get charging for the n900 as well.
 

The Following 2 Users Say Thank You to taixzo For This Useful Post:
mrsellout's Avatar
Posts: 832 | Thanked: 1,891 times | Joined on Sep 2010 @ Manchester
#5
Originally Posted by taixzo View Post
What about USB? As a bonus, you get charging for the n900 as well.
Wouldn't that put additional stresses on the n900's notoriously fragile usb port?
 

The Following 4 Users Say Thank You to mrsellout For This Useful Post:
Posts: 2 | Thanked: 11 times | Joined on Nov 2017
#6
Interesting idea sulu, when X forwarded from a local machine it certainly seems a little quicker than the native browsers.

Regarding the USB; I would err on the side of caution and only have it connected when it's safely planted on a desk, sadly at that point it renders X forwarding moot, as I only plug the N900 into USB when I'm next to a perfectly usable desktop PC or similar. I think the use-case for X forwarding with a browser is to hand-off the CPU load and gain the security of a frequently updated browser.

I have noticed that Luakit (a webkit & lua, w/ vi-binds browser) managed to capture the hardware keyboard of the N900 just fine with no fiddling, I didn't dig around to find why. At this point though it'd require some fettling as fonts were quite small... also Luakit receives infrequent commits, so something to be mindful of.

I think it gets to a stage here of diminishing returns, but interesting to know it can be done.

 
Posts: 19 | Thanked: 32 times | Joined on Oct 2011
#7
Originally Posted by taixzo View Post
What about USB? As a bonus, you get charging for the n900 as well.
complain nokia or jolla. ok, for n9x it might be too late,
but for jolla they are still in business, so you can just
tell them that my usb port is broken after 1 year
of usage and let them repair it or ask to give refund.
 

The Following User Says Thank You to vilva For This Useful Post:
Posts: 799 | Thanked: 2,601 times | Joined on Jan 2011 @ Germany
#8
Originally Posted by opt1mus View Post
Code:
ssh -YC user@192.x.x.x
C for compression, Y as this is a trusted client.
Then with the remote shell;
Code:
chromium > /dev/null 2>&1 &
xvkbd -window *Chrom* > /dev/null 2>&1 &
I just tried that with a sleep 5 in between, but it didn't give me keybord focus in Chromium. Neither did my idea with using wmctrl -a chromium (or -R for that matter).
I also found that some other applications (e.g. Stellarium or VBox) produce segfaults, when run via X forwarding from the N900.

Then I remembered, that I have Presence VNC installed on my N900, so I created a Xephyr desktop with 800x480 pixels on $DISPLAY :2 of my desktop computer, started openbox and lxpanel on it and attached an x11vnc instance to it.
To this I connected via Presence VNC and could run Chromium, Stellarium, a VBox VM and Libreoffice without actual problems.
The display refresh lag was considerable though, with the bottleneck being the N900's wifi. So I'd say it's ok for pretty static window contents (most websites with a sane layout), but not for dynamic content (panning the view in Stellarium).
If possible I'd still prefer X forwarding.


Originally Posted by mrsellout View Post
Wouldn't that put additional stresses on the n900's notoriously fragile usb port?
That!
Also connecting both devices via USB would mean, you'd have a cable dangling from your N900 which I'd consider a limitation in mobility, either because you have to hold another device in your hands or because you're literally tied to whatever bag you store the other device in.
 

The Following 3 Users Say Thank You to sulu For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 02:17.