atakz / android-vnc-viewer

Automatically exported from code.google.com/p/android-vnc-viewer
0 stars 0 forks source link

Support additional keys, fix modifier handling #238

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attach hardware Bluetooth keyboard on Xoom
2. Type Ctrl-C in a shell window
3. Type Alt-C in Emacs
4. Use Home/End/Fn etc. keys

What is the expected output? What do you see instead?
2. The Ctrl key is ignored
3. The key combination is treated as a "C with cedilla" character
4. The keys are ignored

What version of android-vnc-viewer are you using? r201 (SVN head)

Which VNC server/version are you using?  On which platform?
XVnc on Linux

What device are you using? Motorola Xoom (Honeycomb)

Please provide any additional information below.
Using a Bluetooth keyboard (Logitech DiNovo Edge)

I've attached a patch to support the additional keys. I tested that this now 
works as expected with a hardware keyboard, and (to the extent that the key are 
present) with a software keyboard.

One change I needed to make was to remove the "metaState = 0" line, this broke 
Control key handling. It resulted in Ctrl-C to result in the key sequence Ctrl 
down, Ctrl up, C down, C up instead of the actual sequence Ctrl down, C down, C 
up, Ctrl up. It appeared to be unnecessary, the metaState also gets cleared 
automatically in the incoming event from evt.getMetaState().

Original issue reported on code.google.com by Klaus.We...@gmail.com on 18 Apr 2011 at 5:31

GoogleCodeExporter commented 9 years ago
Here's a new version of the patch, splitting the modifier bits into ones that 
should be passed to the VNC server (Ctrl and Alt), and ones handled internally 
that need to be cleared (Shift, Sym?). I think this way it should be fully 
compatible with the original code since it's equivalent to "metaState = 0" for 
key combinations not involving Ctrl/Alt.

Original comment by klausw@google.com on 21 Apr 2011 at 8:09

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

I've applied this and tested on my Asus Transformer which has a full 
(netbook-esque 'chiclet') keyboard - works great!

ctrl (both of them), tab, pgup/down/home/end all working now... thanks!

Everything good except for my UK keyboard's GB pound symbol (£) which is on 
shift-3, 
not sure if this is in the same area as this patch or somewhere else. It's also 
unrecognised if I switch to the onscreen keyboard, but it's accepted from both 
keyboards in connectbot.

Original comment by moley...@googlemail.com on 17 May 2011 at 1:35

GoogleCodeExporter commented 9 years ago
Re #2, thanks for testing!

About the GB pound key, if I'm reading it right this should be handled by the 
default section of the switch where it's calling getUnicodeChar() on the key 
event, this should produce \u00A3, and (I think) that's also the X keysymdef 
value it should pass through to the server, so I think this should normally 
just work. The problem may be that this isn't being recognized by the remote 
system as a valid key.

What's the server OS that you're connecting to? Can you try running "xev" to 
see which keycode (if any) the Shift-3 key combination is generating? If you 
get an event but this event isn't mapped to a key string, or if you're getting 
the wrong output, you may need to add an xmodmap mapping. If you don't get any 
event, that would point to it not being handled right in the VNC client.

Original comment by klausw@google.com on 17 May 2011 at 2:14

GoogleCodeExporter commented 9 years ago
Thanks for the reply.
I'm connecting to Fedora on x86, I tried running 'xev' and it reports nothing 
for shift-3, whereas shift-2 and shift-4 produce the expected output.

Out of interest I've added some logging to VncCanvasActivity.onKeyDown(), for 
shift-2 and shift-4 I see three events (for some reason two for shift left) but 
for shift-3 I just get one event, shift left. If I use the symbol on the 
onscreen keyboard I get no events.

Original comment by moley...@googlemail.com on 17 May 2011 at 8:10

GoogleCodeExporter commented 9 years ago
Does this patch look acceptable? I'm currently using the patched build with 
"Hacker's Keyboard" from the Market to get full keyboard support on my tablet 
without needing a hardware keyboard, together with the patch in issue #239 for 
arrow key + tab support, and I think this makes VNC much more usable. 
Gratuitous self-advertisement, check it out here: 
https://market.android.com/details?id=org.pocketworkstation.pckeyboard

Original comment by Klaus.We...@gmail.com on 25 May 2011 at 8:59

GoogleCodeExporter commented 9 years ago
I think so, I've been running this for a while now and it's fine.

My UK pound sign issue is very probably in an unrelated area, it shouldn't 
block this.

Original comment by moley...@googlemail.com on 2 Jun 2011 at 2:12

GoogleCodeExporter commented 9 years ago
Seems this could be applied to connectBot as well?
I could not type ctrl, esc, even symbols above the number keys.

Original comment by pine...@gmail.com on 10 Jun 2011 at 12:11

GoogleCodeExporter commented 9 years ago
What are the chances of this patch being pushed into production anytime soon? 
This issue has been causing me a few problems with my eeePad TF101 today. I can 
go and compile this from source and apply the patch myself, however I won't 
have reliable access to my standrad dev environment for a couple of days.

Original comment by mike.fab...@gmail.com on 27 Jun 2011 at 5:24

GoogleCodeExporter commented 9 years ago
I've chucked my build up at 

http://dl.dropbox.com/u/13927052/androidVNC-branch_antlersoft_eeePadBuild_001.ap
k

if you need. Includes this patch, the one for the mouse cursor/arrow keys (not 
really needed for eeePad but in the same area) and my hacky attempts at getting 
the mouse pointer tracking and right-mouse-button to work on the eeePad. (needs 
much tidying before I can submit a patch, but it seems to work).

Original comment by moley...@googlemail.com on 29 Jun 2011 at 8:23

GoogleCodeExporter commented 9 years ago
Thanks for that, all the keys now seem to work perfectly, although the 
right-mouse-button seems to just send escape which while usefull, probably 
isn't what it's supposed to do.

Original comment by mike.fab...@gmail.com on 4 Jul 2011 at 5:12

GoogleCodeExporter commented 9 years ago
Works great with this patch and the patch for issue 239 on Nexus S using 
Hacker's Keyboard. +1 for official release.

Original comment by tro...@gmail.com on 17 Jul 2011 at 7:03

GoogleCodeExporter commented 9 years ago
Works great samsung galaxy 10.1 please release!

Original comment by triangle...@gmail.com on 30 Jul 2011 at 2:50

GoogleCodeExporter commented 9 years ago
Works great on notion ink adam. +1 for release.

It would be great to include the windows/super (xev: "keycode 133 (keysym 
0xffeb, Super_L)") key as well.

Original comment by deadguys...@gmail.com on 4 Aug 2011 at 7:12

GoogleCodeExporter commented 9 years ago
I am not able to install the patch (error). Please release!

Original comment by P.K.Ton...@gmail.com on 9 Sep 2011 at 11:32

GoogleCodeExporter commented 9 years ago
Any updates on this issue ?
I think working Ctrl, Alt are important.
At the very least could you post a current .apk in the Downloads section ? we 
could install that one.
Thanks!

Original comment by dnast...@gmail.com on 13 Oct 2011 at 10:43

GoogleCodeExporter commented 9 years ago
I can verify that ctrl, tab, esc, up, down, left and right keys are all working 
no my eee pad keyboard after installing the apk posted on June 29th by 
moley...@gmail.com
You need to uninstall android vnc before you can install the new one. 
Fantastic! Thank you very much! Please include in the next official release.

Original comment by yuanfang...@gmail.com on 1 Nov 2011 at 8:51

GoogleCodeExporter commented 9 years ago
Thinkpad tablet with Hacker's Keypad is much better useable. Tested with apk 
from moley as of 29th June. Thanks.

Original comment by k...@gmx.de on 11 Feb 2012 at 6:41

GoogleCodeExporter commented 9 years ago
Using the patch from June 29th, Ctrl Alt and Tab keys (using the Hacker's 
keyboard) work as they should (thanks!) on my Iconia Tab. Unfortunatly the 
arrow keys move the cursor and are not recognized as keypresses. Since it seems 
to work for others - what am I missing?

Original comment by jmuesc...@googlemail.com on 1 Mar 2012 at 9:34

GoogleCodeExporter commented 9 years ago
I intended it to be used together with the patch from issue 239 which adds a 
new interaction mode. With that included, press the Tab key to use arrow keys 
for key events, and press DPAD_CENTER (the circle next to the left arrow in 
Hacker's Keyboard) to switch back to mouse movement.

Original comment by Klaus.We...@gmail.com on 1 Mar 2012 at 10:35

GoogleCodeExporter commented 9 years ago
I'm using your patch (plus #239) with Android-tablet with (builtin*) 
usb-keyboard. Patch made android-vnc way better, but there are some keys not 
working correctly:
(* Like this: http://news.cnet.com/8301-13924_3-20016383-64.html It is tablet, 
but I bought it with case containing keyboard and there is usb-cable for 
connecting)

Working:
tab, alt, escape

Keys which are used with Fn and are working:
numlock

Not working:
capslock, control, del, insert, sysrq,break
(There are two controls, and none of them work)

Keys which are used with Fn not working:
pageup, pagedown, 

Keys which my system captures, and can't be used on any application (so can't 
be tested for this patch):
home, end, F1...F12

I tried to print out values (just before switch(keyCode)), and found that my 
Del is producing 127, not 112 as your patch and specification say it should. 
(http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_FORWA
RD_DEL )

When pressing Ctrl (any) it causes event with keycode=0,metastate=0. So how to 
tackle this?

Is this issue only about my keyboard (or it's hidden settings)? This is what 
logcat says when connected:
I/EventHub( 2035): New keyboard: device->id=0x20001 devname='  USB Keyboard' 
propName='hw.keyboards.131073.devname' 
keylayout='/system/usr/keylayout/qwerty.kl'
I/EventHub( 2035): New device: path=/dev/input/event2 name=  USB Keyboard 
id=0x20001 (of 0x4) index=3 fd=33 classes=0x3

Original comment by aapo.rantalainen on 2 Mar 2012 at 9:57

GoogleCodeExporter commented 9 years ago
Relating to my last comment: I tested with 'normal' Hewlett Packard 
USB-keyboard.
Is anybody else using/tested this with external hardware keyboard?
Is USB and bluetooth so different? 
Or is my Android (2.2-20110803) somehow crappy?

Ctrl, insert, pageup, pagedown are all reporting event keycode=0,metastate=0.

Del reports 127 (which is KEYCODE_MEDIA_PAUSE)
CapsLock reports 126 (which is KEYCODE_MEDIA_PLAY)

Is there anything that can be done for Ctrl on application level?

-----
What I can say about other applications: jota text editor 
[http://code.google.com/p/jota-text-editor/] handles Capslock and Del, but not 
pageup/pagedown. Ctrl is not doing anything, cut/copy/paste are done with 
alt+xcv. 

---
Now I found there are several applications for looking keycodes:
https://github.com/chrisboyle/keytest
https://github.com/alt236/KeyEvent-Display---Android
But is issue about keyboard layout, system/usr/keylayout/, which doesn't have 
ctrl at all?

Original comment by aapo.rantalainen on 2 Mar 2012 at 12:57

GoogleCodeExporter commented 9 years ago
I suspect that Android 2.2 is the issue here, the key events for many of the 
new keys were only added in Honeycomb (3.0) if I remember right, and same with 
the edit field actions for Ctrl-X/C/V.

FYI, I made a simple keytest app in case you want independent confirmation: 
http://code.google.com/p/hackerskeyboard/downloads/detail?name=KeytestActivity-d
ebug.apk . Does Ctrl send any keycode at all?

It may be possible to set up a translation table to convert this device's bad 
keycodes into working ones, but you're probably on your own with that - 
android-vnc-viewer doesn't show any code changes since Mar 2011, and I haven't 
heard any feedback from the developers about my patches so far, so I'm not 
really motivated to work on patching it further :-/

Original comment by klausw@google.com on 2 Mar 2012 at 5:57

GoogleCodeExporter commented 9 years ago
Seems to me also this is issue with Android 2.2. I tested is it possible to add 
system wide CTRL to the Android 2.2.

I tested with KeytestActivity-debug.apk and CTRLs are producing
Left: key=UNKNOWN, code=0, scan=29
Right: key=UNKNOWN, code=0, scan=97

I tried to add /system/usr/keylayout/qwerty.kl:
key 29    CTRL_LEFT
key 97    CTRL_RIGHT

But it caused "expected keycode, got 'CTRL_LEFT'",
( Newer Android has CTRL_LEFT on KEYCODES on: 
http://source-android.frandroid.com/frameworks/base/include/ui/KeycodeLabels.h )

For accessing key from vnc-viewer it must have code, scan is not enough.

------
I looked critically over my keyboard and decided to sacrifice key between 
right-alt and right-control. I would call it 'Menu', Android calls it 'Compose' 
(newer maybe 'MEDIA_CLOSE'), anyway it has keycode=128.

src/android/androidVNC/VncCanvas.java:910
+case 128 /* 'KEYCODE for COMPOSE' */:   key = 0xffe4; break; //send Right 
Control

Original comment by aapo.rantalainen on 27 Mar 2012 at 10:14

GoogleCodeExporter commented 9 years ago
Got an eeePad too (TF201) and this patch really makes the tablet / keyboard a 
remote workstation: wondefull!! Unfortunately, the implemented key codes look 
only compatible with US-keyboards... e.g. French Ctrl-A is US Ctrl-Q, etc.

Do you have an idea on how to implement this as a language-independant feature? 
Also, do you plan to release this within the "official" sooner or later?

Original comment by damien.n...@gmail.com on 4 Jun 2012 at 6:02

GoogleCodeExporter commented 9 years ago
I tried the patch from comment 9 on TF300. Problems so far as shown in xev:
1. pressing Alt generates press Alt_L + release Alt_R - not a problem with that
2. Emacs can't use M- keys and this makes Emacs useless. Fortunately there's 
way to fix this by "echo clear mod4 | xmodmap -".
3. TAB doesn't work - critical for me!

Original comment by ognyan.kulev on 21 Sep 2012 at 6:56

GoogleCodeExporter commented 9 years ago
re comment #25:

(1) That's odd, I may have gotten keycode mixed up. Glad to hear it's harmless 
though.

(2) As you said, this is an issue with your xmodmap settings, not the VNC viewer

(3) Tab should definitely work. Have you tried "xev" to see if it generates 
keycodes?

FYI, I'm not planning to update the patch since this project doesn't seem to be 
active - I haven't seen any updates since Mar 2011.

Original comment by Klaus.We...@gmail.com on 21 Sep 2012 at 3:39

GoogleCodeExporter commented 9 years ago
Hello,

link located in this thread does not work - 
http://dl.dropbox.com/u/13927052/androidVNC-branch_antlersoft_eeePadBuild_001.ap
k, could you add working one? I usually control my linux machine so lack of 
ctr, alt and tab in console is very annoying...

Regards

Łukasz

Original comment by rozbicki...@gmail.com on 18 Nov 2012 at 12:30

GoogleCodeExporter commented 9 years ago
Later version is available here:

http://goo.gl/pvzAZ

I did some playing around to get it to work for international keyboard layouts 
on the Asus Transformer, might help with you might not.

Please leave feedback, and if it doesn't then leave details of what 
device/OS/keyboard you're using and I'll have a look when I get a chance.

@Klaus RE your last comment, I agree. Your patch is the basis of my build, I've 
tweaked it and added Asus Transformer trackpad stuff on top.
I've emailed the project owner to see what his intentions are with the project 
going forward and to see if I can get some sort of access.

Original comment by moley...@googlemail.com on 18 Nov 2012 at 3:27

GoogleCodeExporter commented 9 years ago
Hello,

thank you for that version, on my tf300 it is working very good - ctrl-c and 
ctrl-a working, tab is working too, just as I expected.

One more time - very thank you!

Regards

Łukasz

Original comment by rozbicki...@gmail.com on 18 Nov 2012 at 6:49

GoogleCodeExporter commented 9 years ago
@moley [#28] I just want to confirm this works for an HP Touchpad tablet 
running CM9 20121118 nightly and a Rocksoul BK-101DROBB bluetooth keyboard. 
Everything works great. All special keys (Ctrl, Alt, Shift, Caps, and Tab) work 
as expected.

Original comment by m...@kmwhite.net on 4 Dec 2012 at 1:48

GoogleCodeExporter commented 9 years ago
I also confirm that special keys are correctly mapped in particular fro
foreign (French) keyboards. Great !

Original comment by damien.n...@gmail.com on 4 Dec 2012 at 12:58

GoogleCodeExporter commented 9 years ago
The patched version is also working fine on my AC100 netbook running JB, where 
the market version doesn't. Thanks!

Original comment by david.given@gmail.com on 11 Jan 2013 at 11:46

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
bVNC 

> bVNC is a secure, open source VNC client. 
> 
> - Tested with Hackerskeyboard. Using it is recommended (get hackers keyboard 
from Google Play).

https://play.google.com/store/apps/details?id=com.iiordanov.freebVNC&hl=en

GPL source code here:
https://github.com/iiordanov/bVNC

Original comment by jkan...@gmail.com on 31 Mar 2013 at 5:13

GoogleCodeExporter commented 9 years ago
I can confirm that the build from November 2012 (post #28) is working smoothly 
with the Samsung Galaxy 3 GT-i9305, multimedia dock + a USB keyboard (apple) 
installed.
Right mouse button, Ctrl, Alt, Home, End, Page Up&Down, everything is there.

There are only two things that do not work correctly:
1. The middle mouse button, which is very important for copy&paste operations 
(the scroll wheel works, though).

2. The Tab key, which is important when working with forms, spreadsheets, etc.:
Just pressing Tab makes the mouse pointer move randomly.
Combinations, for example Alt+Tab, are handled by the local Android system 
instead of the remote system.

Keep up the good work - I hope it will be merged finally!

Original comment by keujghnd...@gmail.com on 25 May 2013 at 11:19

GoogleCodeExporter commented 9 years ago
Hi there,

I'm very interested on porting this to my android device. However, I don't 
really know how to apply the patch and, if possible, I would like to avoid 
fighting with the source and recompiling androidvnc; I'm not familiar with the 
sdk environment... Is this patch already included in the last build in the 
downloads sections? If not, could anyone provide me an apk file ready to 
install with the patch included?

Thanks so much

Original comment by albert.g...@gmail.com on 11 Aug 2013 at 4:50

GoogleCodeExporter commented 9 years ago
See comment 28.

Original comment by moley...@googlemail.com on 11 Aug 2013 at 5:40

GoogleCodeExporter commented 9 years ago
#35 choosing 'mouse pointer control mode' should fix the tab problem.

I'll have a look at mmb when I get a chance.

Original comment by moley...@googlemail.com on 11 Aug 2013 at 5:49

GoogleCodeExporter commented 9 years ago
Thanks #37, I didn't see it.

Control C, tab, alt and arrow keys are working wonderfully in my android 4.2.2 
tablet with bluetooth keyboard. I can almost replace my laptop by my tablet 
when using chrooted debian +lxde!

Thanks so much for you work!

Original comment by albert.g...@gmail.com on 13 Aug 2013 at 8:54