New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
samwuff
Old
(Last edited by samwuff; 23rd January 2011 at 06:41 PM.) Reason: Nothing to do with betterkeyboard app
#1  
Junior Member - OP
Thanks Meter 2
Posts: 15
Join Date: Dec 2009
Default PC-like keyboard mapping for hardware USB keyboards

WARNING: This is a work in progress, but I want to get my partially working config out there for someone like me who desperately wants this to work.

Edit 1: In retrospect, titling it "better keyboard support" was a bad idea, this has nothing to do with the "betterkeyboard" app.

I purchased the apad/gpad case with the integrated USB keyboard from witglobal here:
http://witglobal.com/goods-1846-10+i...+Shipping.html

However, there are issues with the control and escape keys, particularly in connectbot. Since I got the keyboard so I could connect to Linux machines, missing those two keys is pretty ugly. I know you can tap the touchscreen to get ctrl and esc, but that's really slow, I'd like to use the hard key.

So far, I have discovered that there are several things getting in the way of the key working. First is the keyboard mapping files. There are no native key mapping for 'esc' and the default key mapping for the 'esc' key is "BACK". This is fine for many uses, but not for mine. Secondly, it looks like there is a very small set of "custom" keys available in the keymappings.h file. Since there are no "USER1" etc keys, it will take a rebuild of the keyboard code with added entries to make it work better.

This is an attempt to fix control and esc functionality with a USB keyboard. It consists of a kcm file and a kl file to replace the current ones. I am doing my work on VEGAn beta5, but I suspect any ROM will benefit from these files.

To install these files, do the following:

MAKE BACKUP
  1. adb pull /system/usr/keychars/usb_keyboard_102_en_us.kcm.bin usb_keyboard_102_en_us.kcm.bin.orig
  2. adb pull /system/usr/keylayout/usb_keyboard_102_en_us.kl usb_keyboard_102_en_us.kl.orig

Install mod
  1. adb remount
  2. adb push usb_keyboard_102_en_us.kcm.bin /system/usr/keychars
  3. adb push usb_keyboard_102_en_us.kl /system/usr/keylayout
  4. Unplug and replug your USB keyboard

Once this is done, the following changes are made:
  1. Ctrl is mapped to DPAD_CENTER
  2. Esc is mapped to DPAD_CENTER

To use it, go to connectbot, log in, and hit esc or ctrl once for ctrl, and hit esc or ctrl 2x for escape.

Current Issues:
  1. Shift , generates a ;, not a < in Connectbot, but works correctly in other places
  2. Shift . generates a :, not a > in Connectbot, but works correctly in other places
  3. Insert does not work
  4. Del generates a backspace
  5. ] and } keys generate the character + a beep
Attached Files
File Type: zip usb_keyboard-fullfunction-0.1.zip - [Click for QR Code] (2.4 KB, 152 views)
The Following 2 Users Say Thank You to samwuff For This Useful Post: [ Click to Expand ]
 
sharpfork
Old
#2  
Member
Thanks Meter 2
Posts: 58
Join Date: Jul 2010
howdy

I'm a long time betterkeyboard user too. So this mod allows a USB keyboard to use the hardware spell checking option like I can on my droid one?
you might want to send a note to the devs about inccluding this by default. They added the ability to change key height pretty quickly when a few folk sasked.



Sent from my GTablet using Tapatalk
 
samwuff
Old
#3  
Junior Member - OP
Thanks Meter 2
Posts: 15
Join Date: Dec 2009
Quote:
Originally Posted by sharpfork View Post
howdy

I'm a long time betterkeyboard user too. So this mod allows a USB keyboard to use the hardware spell checking option like I can on my droid one?
you might want to send a note to the devs about inccluding this by default. They added the ability to change key height pretty quickly when a few folk sasked.
This is to enable escape and control keys in Connectbot (and possibly others eventually). If you don't use connectbot or a terminal emulator on the gtab, it most likely will be useless to you.

The intent, eventually, is to make a hardware USB keyboard work identically to how it works on a PC (control/alt/esc/etc send the correct keycodes)
 
khunny7
Old
#4  
Junior Member
Thanks Meter 0
Posts: 15
Join Date: Dec 2010
Default Thanks, this helps a lot

As an Emacs user, not having ESC doesn't bother me much.
Ctrl key now works, but only in a way that you tap it once than tap another key, instead of conventional way of pressing a key while ctrl key is pressed.
Is there anyway to fix that? Thank you.
 
davr
Old
#5  
Junior Member
Thanks Meter 1
Posts: 22
Join Date: Mar 2009
Thanks for doing this work, I too was upset that after buying a USB keyboard it was useless for SSH. Have you made any progress on the issues listed at the end of your post since posting this in Jan? Hope you found a solution and could share it with us!