New issue 369 by sophana78: Ctrl, Alt and ESC keys not working on bluetooth
keyboard
http://code.google.com/p/connectbot/issues/detail?id=369
What steps will reproduce the problem?
1.Use bluetooth HID stack from cyanogenMod firmwares
2.Any bluetooth HID keyboard
3.
What is the expected output? What do you see instead?
Ctrl, Alt and ESC keys (on the keyboard) don't work.
What version of the product are you using (you can see this by using Menu
-> About in the Host List)?
connectBot stable (from market)
What type of system are you trying to connect to?
linux ssh
If you are able to connect, what is the output of "echo $TERM", "uname -a",
and any other relevant information on the host?
Please provide any additional information below.
I don't know if this is a connectBot issue, a bluetooth stack issue or an
IME issue. It would be nice to have all keyboard keys working (Ctrl, Alt
and ESC) with a real bluetooth keyboard.
Using the phone pad to do ctrl works, but it is unusable.
The bluetooth stack is also available in opendesire and defrost firmwares.
The same is also valid for USB keyboards and all types of hardware
keyboards.
I think this may be a problem that stems from the Android base system, as
the situation is the same for any other Android app at the moment - I don't
think the buttons are exposed via the API.
I'm seeing the same problem here with a Freedom Pro keyboard connected via
Bluetooth to a Galaxy Tab.
This problem with hardware keyboards is really limiting. With working
hardware keyboard support, ConnectBot on a Galaxy Tab would make an
excellent remote login solution.
This problem appears to be due to mappings within Android. The Escape key
seems to map to the 'back' button. Ctrl keys simply send the non-ctrl
character.
It'd be great if ConnectBot could work around this, but I'm sceptical if
it's possible to work around at the layer ConnectBot operates.
You can't work around it perfectly, but you can make it quite a bit
better by making the system "teachable". For individual keys, like
Escape, do something like:
Configure "Escape" key > Please hit the key you would like to map to
"Escape" on your keyboard.
For modifier keys, you may need to try to infer the modifier key from
multiple key presses:
Configure "Ctrl" key > Please hit "Ctrl-A" on your keyboard, using the
modifier key that you would like to map to "Ctrl". > Please hit "Ctrl-B"
on your keyboard.
And you might have the option of mapping "Ctrl" to a prefix (the keys
aren't hit simultaneously, but one after the other):
Configure "Ctrl" key as a prefix. > Please hit the key on your keyboard
that you would like to map to a "Ctrl" prefix.
Finally, you may be able to use arbitrary keys as "Ctrl" keys by
detecting chording (X-down, Y-down, X/Y-up); I believe Bluetooth HID
supports that and I would guess the Android keyboard driver should pass
that on as well.
That way, whatever is possible with a keyboard and phone can be done.
Also, I can remap printable characters (e.g., weird national characters)
to act as "Escape" or a "Ctrl" prefix.
Tom
This would be a very useful feature. I have Freedom Pro keyboard, and
Ctrl, Tab, Alt, Esc do not work with connectbot. I bought the keyboard so
it would be easier to code in emacs over connectbot, but without special
keys it is not very useful
Comment #5 is RIGHT-ON. EXACTLY what I've been asking for! I made the
point that this is similar to how some emulators work, mapping keys to
keypresses in the key binding menu (ala the *oid emulators by "yongzh").
Tab key works OK when I edit memo on my Galaxy S. In ConnectBot I need to
touch the screen, then tap CTRL then press "i" on my external BT keyboard.
Can this be fixed?
I have similar problems with connectbot when using my Motorola Xoom and a
Motorola Bluetooth keyboard. Tab doesn't work in Connectbot but it works
fine in other applications. Arrow keys seem to work most of the time, but
none of the control key sequences work at all.
Batteries on keyboard are still fresh and Xoom charged over 80%.
Same symotoms on my Samsung Galaxy Tab hardware keyboard dock.
Same issue on ASUS transformer when using hardware keyboard dock.
Wouldn't it be really handy if ConnectBot same with a menu option to print
keyboard scancodes so that you can see what the heck your keys map out to
so that we can tell the author what our different keyboards are showing up
for things like CTRL or the mysterious blank key (like on my Samsung Galaxy
Tab keyboard dock, under the ENTER key)? :P Would be a nice debugging
tool and helpful way for users to give back some info on their varying
hardware.
Just saying.
When I try to use the * (works fine in the browser as you can see) but in
ConnectBot, what it displays is ~9 on my Linux box. If I knew what I could
do to help, I would be happy to look up key codes for you or whatever, but
I'd need a little how-to that would help me give you what you're looking
for. Better yet, if you provided an application that gave me the list of
keys to hit, I could press each of them for you and send you the output
from the program. One way or the other, please help me help make CB
better. :-) It's been my favorite ssh program since my first Android
phone. :-)
KB
it's open source, seems that doing it yourself is the option. Look, this
case hangs since Sep 2010 and does not even have an owner.
Not everyone is a developer and can fix this for themselves. As well,
fixing it for yourself doesn't make it available as a new version in the
market for everyone else. Suggestions for the rest of us?
I experience the same issue (at least, can verify the ctrl key) with a
Bluetooth keyboard on stock 3.1 with a Xoom. I also have seen issues with
shift-#s, e.g., I cannot type a * by doing shift-8 when connecting to a
server. It would be increase the functionality of connectbot dramatically
if ctrl, esc, and shift worked properly (Emacs user here!). Tab would also
be useful (since tab-completion seems to not work).
I can also verify that these keys do seem to work in other programs, such
as Google Talk.
In regards to the past couple comments -- I am a programmer by day, so if
someone can point me to the section of code which deals with this, I'd be
glad to go through the code on my upcoming flight and try to figure out
what is going wrong.
there are already some partial fixes posted:
http://code.google.com/p/connectbot/issues/detail?id=378
Seems that nobody from connectbot has included them.
Is connectbot a dead project?
I have observed the same issue on xoom using bluetooth keyboard. no tab or
ctrl functionality.
Same issue with Motorola Atrix
I've opened pull request #16 on github
(https://github.com/kruton/connectbot/pull/16) -- works great with my
logitech bluetooth keyboard
I installed the latest development build a few minutes ago. I can see that
the built-in shortcuts work now, such as ctrl+c for copy, ctrl+u for URL
search, but connectbot still doesn't seem to be *sending* ctrl or alt to
the remote server when pressed. :(
I take that back, sorta. I undocked my transformer and redocked it, and now
the meta keys seem to be working like a charm.
I just tried the latest featured (4.26.38) version with my BT keyboard. I
just connected to my linux box and press some keys :-) The results is:
- The Alt button start working. Hurrah! Although it is not "sticky", but
this is the begin :-)
Unfortunately, this is only good thing. All other is bad :-(
- The "Ctrl" key still don't work at all
- The "Home" key works like home button and the "End" key works like power
button. This is small problem, but Esc key works as "back button" ant this
is much worse for any *nix system :-(
Please, don't stop! The connectbot is the best ssh client for Androis OS
and we all waiting for resolving this issue :-)
Sounds like your keyboard doesn't send the correct key code for ctrl esc
home or end.
Alt shouldn't be sticky on an external keyboard.
I don't know. I use some "standard" unnamed BT keyboard. This model works
fine with WM, Symbian and iPhone. So I think this must be some program
error. I repeat - this is _BlueTooth_ keyboard, not just "external". I'm
sure this is important.
P.S. Apropos, The Cntrl key on BT keyboard works just fine in "Better
Terminal Emulator Pro" SSH Client. Unfortunately I can't use this client
because of some another problems with it ;-)
I dunno about your keyboard, but it works fine with my bluetooth logitech
keyboard which sends all the standard scancodes.
Are you on honeycomb? No idea how it would work prior to 3.0
I use Gingerbread (2.3.3)
Yeah, that explains that
So, right now we have the solution for tablets, but still do not have
solution for smartphones :'-(
actually, after installing latest development version (2011-07-01) the TAB
key started working, the rest of the keys (CTRL, ALT, ESC) still not working
working on the ASUS transformer. NOW it's become a serious productivity
machine. Where should my donation go?
For Asus Transformer support see Issue 459.
Using plain USB keyboard on an Acer Iconia Tab A500, similar problems.
Ctrl+anything always inserts ^@, and shift+numbers inserts random control
codes instead of correct symobols like !@#$%^&*(). Makes it nearly
impossible to perform tasks on linux servers :'(
https://code.google.com/p/connectbot/issues/detail?id=426#c1
Have you guys tried the tablet branch version yet? Works perfectly fine
with my bluetooth keyboard. (honeycomb and newer only).
On my samsung galaxy S2 tablet branch crashes after connect and just after
screen turning. Master version still don't work with ctrl.
Tablet branch isn't ready for phones yet, I think
Notion Ink Adam, Android 2.2 (BeastRom), tablet branch crashes on start.
Is there an available apk for the tablet branch? Will it install on a
Samsung Galaxy Tab running Froyo?
Tablet branch is a no-go on Samsung Galaxy Tab running Android 2.2, nor
Motorola Droid A855 running Android 2.3.4, sooooo..... no. Haven't tried
it. :)
I think there's a fairly simple patch for this. In short, I added a
hardkeyboard check using is(Alt|Shift|Ctrl)Pressed() to update curMetaState.
It seems to work on my Xoom using a bluetooth keyboard. I also tested the
virtual keyboard and that seemed to stay the same.
Feel free to review, optimize and test since the beer tends to make me miss
stuff.
Attachments:
issue_369.diff 1.8 KB
If that's all we need... OH.. MY.. GOD! You are THE MAN! :) I eagerly
await a new update/release in the Android market to try this out on my
various Android-based devices. I DESPERATELY need this functionality in
order to do any kind of real work. THANK YOU! :)
@jrcon... the tablet branch already has support for bluetooth/external
keyboards.
Additionally, your patches only work on honeycomb or newer anyway. Can't
go into the master branch as-is.
@pfngu
I tried a Tablet SVN build and it didn't support ctrl and meta on my USB
keyboard. Is the tablet branch supposed to do this?
I tried this version:
http://sourceforge.net/projects/chdistro-droid/files/ConnectBot-ext-keyboard/
ctrl, alt, tab, esc all work on my htc desire with bluetooth keyboard.
Cool, thanks for confirming! It works by using keyboard scancodes, which is
industry standard (even if maybe de facto). Just need to collect more
evidence to convince the maintainer, following first attempt (with not too
clean code, yeah) at https://github.com/kruton/connectbot/pull/3
Just in case, my changes can be reviewed here:
https://sourceforge.net/p/chdistro-droid/connectbot/ci/ext-keyboard/log/
> Cool, thanks for confirming! It works by using keyboard scancodes, which
> is industry >standard (even if maybe de facto). Just need to collect more
> evidence to convince the >maintainer, following first attempt (with not
> too clean code, yeah) at >https://github.com/kruton/connectbot/pull/3
> Just in case, my changes can be reviewed here:
> https://sourceforge.net/p/chdistro->droid/connectbot/ci/ext-keyboard/log/
I tried this version on my Thinkpad Tablet with three USB keyboards, and I
didn't have any luck. I used the Thinkpad folio case, a wireless mini
keyboard (Rii Mini), and a standard USB desktop keyboard.
(Feel like this bug becomes semi-offtopic forum, but it actually did long
time ago, so just continuing.)
How did you test it, what output did you get and what you expected? Besides
that, your next step is using tool like
http://github.com/chrisboyle/keytest/downloads to carefully write down its
output for each of "problematic" keys like Esc, both Ctrl's, etc.
> "How did you test it, what output did you get and what you expected?"
Using ConnectBot-ext-keyboard-0-g815d488-debug on Thinkpad Tablet running
Android 3.1, kernel 2.6.36.3.
With Rii N7:
Steps to reproduce:
1. Connected Rii N7 via USB transceiver
2. Opened a connection by unlocking a key and waiting for a bash prompt to
appear
3. Typed in "test"
4. Hit ctrl+a
Expected results:
The text caret moves to the beginning of the line
Actual Results:
The text caret remained where it was. No text was entered (i.e., no
erroneous "a" as entered).
Dump from keytest while pressing ctrl:
> Keycode: 113
> KeyEvent: KeyEvent{action=ACTION_DOWN keycode=KEYCODE_CTRL_LEFT
> scancode=29 metaState=META_CTRL_ON|META_CTRL_LEFT_ON flags=0x8 repeat=0
> device=19 source=0x101}
Dump from keytest while pressing ctrl+a:
> Keycode: 29
> KeyEvent: KeyEvent{action=ACTION_DOWN keycode=KEYCODE_A scancode=30
> metaState=META_CTRL_ON|META_CTRL_LEFT_ON flags=0x8 repeat=0 device=23
> source=0x101}
With USB Thinkpad Tablet Keyboard Folio Case:
Steps to reproduce:
Same as above
Results:
1. Immediately after depressing the a key when pressing ctrl+a, an "a" is
inserted. (i.e., "testa")
2. After releasing the depressed ctrl key, the menu appears
Expected Results:
1. Text caret moves to beginning of line, no "a" inserted
2. The menu doesn't appear.
On the keyboard folio case, the keycap for the control key is inscribed
with both "Ctrl" and the Android menu icon, indicating, presumably, that it
functions as a menu button when not used as a control.
Dump from keytest for ctrl on keyboard from keyboard folio case:
> Keycode: 82
> KeyEvent: KeyEvent{action=ACTION_DOWN keycode=KEYCODE_MENU scancode=139
> metaState=0 flags=0x8 repeat=0 device=22 source=0x101}
Thanks for detailed report. Few things I see from it. First of all, Lenovo
Thinkpad Tablet is Android 3.x device, and 3.x has native Control keys
support, and handling that already included in ConnectBot upstream. It's
very strange it doesn't work for you (but I don't have 3.x device and never
tested it).
Otherwise:
Rii N7:
KeyEvent: KeyEvent{action=ACTION_DOWN keycode=KEYCODE_CTRL_LEFT scancode=29
metaState=META_CTRL_ON|META_CTRL_LEFT_ON flags=0x8 repeat=0 device=19
source=0x101}
3.x CTRL state is reported as expected, and scancode is correct for Left
Ctrl (my code would recognize it).
Does Rii have Right Ctrl and would you be able to post KeyEvent for it?
USB Thinkpad Tablet Keyboard Folio Case:
KeyEvent: KeyEvent{action=ACTION_DOWN keycode=KEYCODE_MENU scancode=139
metaState=0 flags=0x8 repeat=0 device=22 source=0x101}
This is completely mad, you see. Scancode (0x8b) is unknown to
http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html (way above nornal
range), and keycode generated is for menu, so menu you get.
Summing up:
Rii not working is weird. Did you try pristine ConnectBot? Tablet branch? I
will look if my patch might interact badly with Honeycomb CTRL handling
(though I already tried to write is so that scancode handling happens as
the last resort, if nothing else processed a key before).
Folio case not working is the result of typical OEM braindeadness (you can
see other examples in AC100 pull request above). It would be possible to
make it work by extending my scancode patch (but first need to figure out
why it doesn't work for you of course).
According to Linux kernel:
#define KEY_MENU 139
So, it's not random scancode, the vendor *wanted* that key to be menu, so
there it is. Are you sure it's a Ctrl key at all? ;-)
Just tried
http://sourceforge.net/projects/chdistro-droid/files/ConnectBot-ext-keyboard/
on my Acer a500 with a logitech usb keyboard : does not seems to work at all
Can't abord a ping request using ctrl + c
keytest confirm that correct scancode are received
Looks to me as if TerminalKeyListener is only trying to process Ctrl keys
when there is no hardware keyboard.
Similarly, shift-number keys aren't working with a hardware keyboard
because it is inappropriately using sendFunctionKey() to deal with them.
The following patch appears to fix both issues on my Xoom/Motorola
Bluetooth Keyboard combo; but I'm not sufficiently familiar with the
Connectbot codebase, or Android development in general to know what I might
have broken in the process (which is why I feel it is appropriate to put it
inline rather than make it all-too-easy to apply). Note that while the
Ctrl-key combinations now work, they're *also* recognized as menu
accelerators :(
diff --git a/src/org/connectbot/service/TerminalKeyListener.java
b/src/org/connectbot/service/TerminalKeyListener.java
index 6330479..3e15d1e 100644
--- a/src/org/connectbot/service/TerminalKeyListener.java
+++ b/src/org/connectbot/service/TerminalKeyListener.java
@@ -251,12 +251,6 @@ public class TerminalKeyListener implements
OnKeyListener, OnSharedPreferenceCha
key = keyAsControl(key);
}
- // handle pressing f-keys
- if ((hardKeyboard && !hardKeyboardHidden)
- && (curMetaState &
KeyEvent.META_SHIFT_ON) != 0
- && sendFunctionKey(keyCode))
- return true;
-
if (key < 0x80)
writeToBridge(key);
else
@@ -266,8 +260,7 @@ public class TerminalKeyListener implements
OnKeyListener, OnSharedPreferenceCha
return true;
}
- // send ctrl and meta-keys as appropriate
- if (!hardKeyboard || hardKeyboardHidden) {
+ if (true) {
int k = event.getUnicodeChar(0);
int k0 = k;
boolean sendCtrl = false;
> I tried this version:
> http://sourceforge.net/projects/chdistro-droid/files/ConnectBot-ext-keyboard/
> ctrl, alt, tab, esc all work on my htc desire with bluetooth keyboard.
confirmed on HTC Rezound with Zippy BT500 keyboard.
Issue: shift-numeric keys are broken:
Shift-1 = ! and shift-4=$ are broken when using VI... I can't force quite
VI (without saving) ... bummer!
Hope this is an easy fix?
Thanks for the good work!
Bought a dell Y-RAQ-DEL2 aka GM952 for $25 on eBay.
Google Nexus Galaxy ICS 4.0
In ConnectBot none of the shift keys ex: shift 1 "!" through shift 0 ")" -
the phone just buzzes like I pressed an invalid key. The numeric keypad
does work as :"<>? all work.
The shift keys DO work in the Gmail app on the phone making me think this
is limited to a connectbot issue.
@beatty.d...@gmail.com, this was LOVELY, thank you!
You are welcome Michael. I've been waiting for my gnu/linux palmtop with
phone since I read Sam's "Linux Unleashed, Slackware 2.0". Still waiting.
QUESTION? Is there some valid reason to smubosh the ctrl/alt/esc keys in an
ssh session? Looks to me like the code came from a Java Terminal project of
some kind that predates Android.
Could it be something like the BBS operators did back in the days of yore
to keep folks from crashing the board and gaining control of the box?
I'm still trying to figure out where VDUINput.java came from and why
they did that. Almost at the point where I'll try to map foo/bar/baaz to
crtl/alt/esc.
Apparently they keep their dead at http://javatelnet.org/ .... I'm
starting here. http://javatelnet.org/space/Docs+and+Tutorials The site
ain't been updated in seven years. At least it's GNU licensed.
Just tried the same test with a logitech tablet keyboard Android 3.0+
930-003390 and it does the same thing (no ctrl/esc, no shift #'s)
Also tried the latest developer build, and the ChDistro Ext Keyboard for
Connectbot
sourceforge.net/projects/chdistro-droid/files/ConnectBot-ext-keyboard/ and
it does not work either.
Note: This issue persists with Android 4.
Logitech Bluetooth (
http://www.logitech.com/en-za/gaming/mice-keyboard-combos/devices/3616 )
and Galaxy Nexus with Android 4.0.2 adn Connectbot 1.7.1 2010.10.08
I'll try connectbot-ext-keyboard later.
Update: Android4
I yesterday installed
http://sourceforge.net/projects/chdistro-droid/files/ConnectBot-ext-keyboard/
The tab and alt keys work now, control does not. I have hackerskeyboard
installed,
and a tap on screen brings up the control, escape, and keyboard icons, and
after clicking control, the hardware keyboard control does send control.
This is still quite inconvenient compared to a hardware keyboard's control
key working.
No luck with Ctrl key with a Motorola Bluetooth Keyboard on a Motorola XOOM
Wi-Fi tablet.
ConnectBot-ext-keyboard package mentioned above works just GREAT with
Samsung Galaxy i9000 and Freedom Keyboard Pro. I feel the power of
this small machine again, typing this over links with byobu enabled.
Everything works as expected, THANK YOU THANK YOU THANK YOU.
2012/1/26, conne...@googlecode.com <conne...@googlecode.com>:
Galaxy Nexus ICS 4.0.2 and freedom pro keyboard does not work for the top
row keys like ! And # with the anroid market version of connectbot;
however, keys work fine in other apps like google.docs for instance.
Have gotten Xoom and BT keyboard working in following way -- start
ConnectBot (tablet version) without BT keyboard; ssh to server; leave
ConnectBot (e.g., go to home screen); connect to BT keyboard; go back to
ConnectBot; everything works. Not sure why that is needed, but it works.
I can confirm that ConnectBot-ext [1]_ works with Apple Wireless
Keyboard [2]_ on my Samsung Galaxy S2 [3]_ and provides full use of
Ctrl, Alt, function keys, and most importantly, Esc. (Tested on a
Samsung Galaxy S2).
Results with the same ConnectBot-ext [1]_ on with the Samsung Galaxy
Tab 10.1 Bluetooth Keyboard Case [4]_ on my Samsung Galaxy Tab 10.1
[5]_ are less stellar: Esc and function keys work, but Ctrl does not.
- Robert
PS - Is there a wiki we can collate a compatibility table on? I lack
permission to create a wiki page on [1]_.
.. [1]
http://sourceforge.net/projects/chdistro-droid/files/ConnectBot-ext-keyboard/
(g815d488)
.. [2] http://www.apple.com/uk/keyboard/
.. [3] Android v2.3.3
.. [4]
http://www.samsung.com/us/mobile/galaxy-tab-accessories/BKC-1B1USBGSTA
.. [5] Android v3.1
Connectbot-ext-keyboard also works great for me (CTRL and Tab function
correctly) with external USB keyboard (built into case) with a generic
Chinese tablet, Tabtronics M009SC running Android 2.3.4.
2 robert.m... : It's for sure good idea to collect the compatibility data,
and it would be even more useful if accompanied by output from
http://github.com/chrisboyle/keytest/downloads (for cases it doesn't work).
I'm not sure what would be the good place to collect that info.
chdistro-droid project, where ConnectBot-ext-keyboard happens to be hosted,
is dedicated to other topic, so I'm not sure if it's worth to put such data
there. All in all, if you'd start such a wiki page somewhere with public
access, just post it here, that would be good step.
Hackerskeyboard is a tremendous find! It doesn't fix the problems with the
external keyboard, but it is a vast improvement over the stock soft
keyboard that comes with Android. Wow!
KB
I tested the solution posted on COMMENT 67. I am having XOOM and Logitech
BT keyboard. Everything works, including:
1) esc
2)ctrl
3) shift + numerical keys: !@#$%^&*()
The solution posted inside COMMENT 67 works. I have XOOM (android 4.0) +
Logitech BT keyboard. The following functions are working
1) ESC
2) CTRL
3) Shift+numerical keys !@#$%^&*()
The solution posted inside COMMENT 55 seems to be a better solution. I
recompiled the code by using the latest build (on 3/14/2012) and combining
the code inside COMMENT 55.
The following keys are verified on XOOM (Android 4.03)+Logitech BT keyboard:
1) ESC
2) TAB
3) Shift + Numerical Keys !@#$%^&*()
Attachments:
connectbot.apk 881 KB