How to map android keys to your usb/bluetooth keyboard
来源:互联网 发布:java gbk转utf8 乱码 编辑:程序博客网 时间:2024/05/29 16:44
I couldn’t tell if this was covered in another post, so I thought I would pass it on.
If you are using an external keyboard (via Bluetooth or usb), you may find that certain basic android key events (home, back and menu) are either missing or not logical. In my case, my Bluetooth keyboard had no way to return home or open menus for apps, requiring me to use both the edge hardware keys as well as the keyboard. To address this, you can try the following:
NOTE: While this worked for me, I can’t guarantee results for other keyboards. And, as always, back up files before making any changes.
Before you start, here are some helpful tools/links:
• Android keymaps overview and handy tool – Within this site is a handy tool called “KeyTest” It is a very simple android app that helps you find what number corresponds to a given key on the keyboard.
• Android keycodes – This page lists all the common android events that can be attached to a key. We are only going to look at the ones starting with “KEYCODE_”
1. Ensure your edge is rooted
2. Install the KeyTest apk file
3. Using your favorite file explorer (e.g. Root Explorer), go to /system/usr/keylayout
4. Back up the file “qwerty.kl” This is the document that contains the default mapping of keys to android functions.
5. Hook up your keyboard and make sure it is working
6. Run the KeyTest app – Every time you press a key on the keyboard (or one of the hardware keys on the lcd) the screen will update with Keycode (a number that relates to the Android action) and a scancode (the number that represents the key you actually pressed on the keyboard). Decide what keys you would like to use and jot down the scancode. You can use ctrl and fn keys in combination with other keys to get more unique scancodes.
7. Once you know the numbers (scancodes) for the keys you want to map, open up the qwerty.kl file with any convenient text editor. You will quickly see the general format for an entry – the word “key” followed by the number (scancode)* for the key followed by the android event in all caps. For example,
key 165 HOME
On my keyboard, this would mean that hitting fn + F7 (which generates a scancode of 165) will do the same as hitting the "home" key.
8. Save your modified “qwerty.kl” file in the same location as it was (/system/usr/keylayout) and reboot.
If all goes well, the next time you connect your keyboard you should be able to finally access all those important functions with logical (at least to you) keys.
*NOTE: You cannot use the same scancode number more than once!! If you do, your external keyboard will stop responding. Your edge software keyboard should work fine, so you should be able to recover your backup file and fix it.
If you are using an external keyboard (via Bluetooth or usb), you may find that certain basic android key events (home, back and menu) are either missing or not logical. In my case, my Bluetooth keyboard had no way to return home or open menus for apps, requiring me to use both the edge hardware keys as well as the keyboard. To address this, you can try the following:
NOTE: While this worked for me, I can’t guarantee results for other keyboards. And, as always, back up files before making any changes.
Before you start, here are some helpful tools/links:
• Android keymaps overview and handy tool – Within this site is a handy tool called “KeyTest” It is a very simple android app that helps you find what number corresponds to a given key on the keyboard.
• Android keycodes – This page lists all the common android events that can be attached to a key. We are only going to look at the ones starting with “KEYCODE_”
1. Ensure your edge is rooted
2. Install the KeyTest apk file
3. Using your favorite file explorer (e.g. Root Explorer), go to /system/usr/keylayout
4. Back up the file “qwerty.kl” This is the document that contains the default mapping of keys to android functions.
5. Hook up your keyboard and make sure it is working
6. Run the KeyTest app – Every time you press a key on the keyboard (or one of the hardware keys on the lcd) the screen will update with Keycode (a number that relates to the Android action) and a scancode (the number that represents the key you actually pressed on the keyboard). Decide what keys you would like to use and jot down the scancode. You can use ctrl and fn keys in combination with other keys to get more unique scancodes.
7. Once you know the numbers (scancodes) for the keys you want to map, open up the qwerty.kl file with any convenient text editor. You will quickly see the general format for an entry – the word “key” followed by the number (scancode)* for the key followed by the android event in all caps. For example,
key 165 HOME
On my keyboard, this would mean that hitting fn + F7 (which generates a scancode of 165) will do the same as hitting the "home" key.
8. Save your modified “qwerty.kl” file in the same location as it was (/system/usr/keylayout) and reboot.
If all goes well, the next time you connect your keyboard you should be able to finally access all those important functions with logical (at least to you) keys.
*NOTE: You cannot use the same scancode number more than once!! If you do, your external keyboard will stop responding. Your edge software keyboard should work fine, so you should be able to recover your backup file and fix it.
Also, you can generally only map keys to normal keyboard activities (like DEL) or events that the edge has hardware keys for (MENU, BACK, HOME, SEARCH, VOLUME_UP , VOLUME_DOWN and the DPAD directions). While it would be nice to map a keystroke to automatically open email or the camera, those types of mappings do not appear to actually end up doing anything. As long as you have a backup you can probably play around without serious consequences.
From: http://www.mobileread.com/forums/showthread.php?t=159538
0 0
- How to map android keys to your usb/bluetooth keyboard
- How to Create a Customized Keylayout for Any USB or Bluetooth Keyboard (ROOTED)
- Android 4.0 How to enable Bluetooth PANU
- How to debug Bluetooth
- How to change your USB Serial Port COM number?
- How to Install Android on Your PC
- How to Flash a ROM to Your Android Phone
- How to Cast Your Android Screen onto Your Linux Desktop
- MDM USB How-to
- Framework USB How-to
- How to Advertise Android as a Bluetooth LE Peripheral
- How to Use Google API Keys
- How-to Dump Keys from Memcache
- Emacs: How to Define Keyboard Shortcuts
- How to generate EOF from keyboard
- how to set backgroud of keyboard
- How to analysis your question?
- How to Organize your Thesis
- 读取数字循环(遇非数字退出和跳过继续读取两种情况C++代码)
- django中的时区设置TIME_ZONE,USE_TZ
- 黑马程序员----Sizeof与Strlen的区别与联系
- 阿里巴巴2014前端线上笔试题
- 男生对女生最具诱惑的10句话
- How to map android keys to your usb/bluetooth keyboard
- HDU 3315 My Brute(费用流)
- 使用IDEA创建Scala程序
- 剑指Offer18树的子结构
- Java 不同类型属性在字节码文件class中
- EventDispatcher Mechanism
- 杀人事件测你的潜意识??
- impdp 导入物化视图(mv)时报错 :ORA-31685: Object type MATERIALIZED_VIEW
- linux下如何恢复rm命令删除的文件