I have a Microsoft Mobile Wedge keyboard. I've connected it to my Nexus 9 and after setting the language in the settings it works almost perfectly. Almost! There are 4 keys on it that don't work, because they're multi-keycode keys. They're the "magnifier glass"-key, the "3 dots on a ring"-key, the "black rectangle intersecting with rectangle border"-key and the "gears/settings"-key.

So far I've found out with

getevent -lt /dev/input/event4

that the Linux keycodes they send are





I've created the 2 files from their Generic.kl and Generic.kcm counterparts


and made sure with

dumpsys input

that they're used.

I tried to enable F21 in the layout first, but that didn't work because there's no Android keycode for F21. So I bound it to INSERT instead, because it's an unused key. Then I went into the character map and tried making an INSERT key (which is actually F21) and applying the right modifiers to it.

key INSERT {
    base:           'a'
    lmeta:          'A'

The above being for the key that only had 2 keycodes. Unfortunately this didn't work. Nothing happened. So now I'm here to pick your brain.

Does anyone know how to do multi-keycode keys?

Thank you very much in advance.

  • Do you mean the keys inside android that you want to link?
    – Matt07211
    Commented Oct 23, 2015 at 0:25
  • Just wanted to point out Android has native magnifier function but it's an accessibility feature called "Magnification". The default shortcuts you can enable for it (on Snow Cone) are: 1) tapping accessibility navigation key (I don't see a standard keycode for that), 2) Vol(+) + Vol(-), or 3) triple tap. On the other hand, if the function is instead the "search" function, that does have an Android int keycode value of keycode_search
    – Arctiic
    Commented Jan 30, 2023 at 21:09

2 Answers 2


Do the following:

  1. Run getevent without the -lt flag.
  2. Press the key you want to test a few times. You'll get three lines something like:

    /dev/input/eventn: 0004 0004 longnum
    /dev/input/eventn: 0001 4_DIGIT_NUMBER_OF_INTEREST MASK
    /dev/input/eventn: 0000 0000 longemptynum

    The 4_DIGIT_NUMBER_OF_INTEREST is the scan-code.

  3. In your .kl file (in /system/usr/keylayout/[yourlayout].kl), add a line:


    You've already gotten that far.

    So, in your .kcm file, you put the following lines and you should be good to go.

    key [UNUSED_BINDING] {
    lmeta:            what_you_want_for_just_lmeta (but it should be first)
    lshift+lmeta:     what_you_want_for_lshift+lmeta
    lalt+lmeta:       what_you_want_for_lalt+lmeta
    lctrl+lmeta:      what_you_want_for_lctrl+lmeta

Reference: Key Character Map Files (under Key Declarations → Properties)


I am not sure if your way works or not, but try and see if this works. I have linked all the necessary stuff, have a look and try and se if it works.

Android Keyboard Devices (Scroll to the bottom of the page for all the key codes)

Keytest Apk (Use to show keycodes when pressed)

How to map android keys to your USB/Bluetooth Keyboard

Map android keys to any Keyboard

Android key Maps (User Blog)

Keyboard shortcuts and navigation, these may help with your problem or not (also extras for users who are reading this)

  • ESC = go back
  • CTRL + ESC = menu
  • CTRL + ALT + DEL = restart (no questions asked)
  • ALT + SPACE = search page (say “OK Google” to voice search)
  • ALT + TAB (ALT + SHIFT + TAB) = switch tasks

Also, if you have designated volume function keys, those will probably work too. There’s also some dedicated app shortcuts like calculator, Gmail, and a few others:

Android Keyboard Shortcuts: Apps

  • CMD (Windows key) + A = calculator
  • CMD + C = contacts
  • CMD + E = e-mail
  • CMD + G = Gmail
  • CMD + L = Calendar
  • CMD + P = Play Music
  • CMD + Y = YouTube

Others keys that are useful include:

Android Keyboard Shortcuts: Scrolling

  • Spacebar: Page down in any Web page/document view
  • Shift + Spacebar: Page up in any Web page/document view

Android Keyboard Shortcuts: Typing

  • Alt + Spacebar: Insert a special character

  • Shift + Del: Delete the character to the right of the cursor

  • Alt + Del: Delete an entire line

  • Shift + Shift (press it twice): Activate caps-lock; press shift once more to exit

  • Alt + Trackball (Mouse) -Left: Move cursor to beginning of line

  • Alt + Trackball-Right: Move cursor to end of line

  • Alt + Trackball-Up: Move cursor to top of page

  • Alt + Trackball-Down: Move cursor to bottom of page

  • Shift + Trackball-Left/Right: Highlight text for cutting or copying

  • Menu + X: Cut text (will cut all text on-screen unless specific characters are highlighted)

  • Menu + C: Copy text to clipboard (will copy all text on-screen unless specific characters are highlighted)

  • Menu + V: Paste text from clipboard

  • Menu + A: Select all text in the current field

Android Keyboard Shortcuts: Browsing

  • Menu + I: Zoom in

  • Menu + O: Zoom out

  • Menu + J: Go back a page

  • Menu + K: Go forward a page

  • Menu + R: Refresh current page

  • Menu + F: Find on page

  • Menu + B: Open bookmarks

  • Menu + S: Open social network sharing menu

  • Menu + H: View browsing history

  • Menu + S: Open browser settings

Android Keyboard Shortcuts: Gmail

  • F: Forward current message (works only while inside the message)

  • R: Reply to current message (works only while inside the message)

  • A: Reply-all to current message (works only while inside the message)

  • Y: Archive message (works from within message or while on main inbox list)

  • Menu + U: Refresh inbox

  • Menu + C: Compose new e-mail

  • Enter: Open an e-mail (from the main inbox list)

  • Alt + Trackball-Up: Jump to top of inbox

  • Alt + Trackball-Down: Jump to bottom of inbox

  • Thanks for writing this up, but it's not an answer to the question. The problem isn't mapping keys, the problem is handling keys that send multiple keycodes to the system. Which are not properly recognized, even by the keytest program. The only software that shows all the keys is getevent.
    – Dominik
    Commented Oct 23, 2015 at 18:27
  • @Dominik Okay, Good luck trying to get it to work, and when these keys get pressed, they don't work either way when you hold shift and don't hold shift? Am i correct to assume that?
    – Matt07211
    Commented Oct 25, 2015 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .