[Q] Keymap alteration not working - Huawei Ideos X5 U8800

Hi,
In conjunction with what I was trying to do here - http://forum.xda-developers.com/showthread.php?t=1333674 ,
I modified the keylayout in /system/usr/keylayout/AVRCP.kl so that the keycode that was earlier assigned to MEDIA_NEXT is now assigned to MEDIA_PLAY_PAUSE.
From
Code:
key 200 MEDIA_PLAY_PAUSE WAKE
key 201 MEDIA_PLAY_PAUSE WAKE
key 166 MEDIA_STOP WAKE
key 163 MEDIA_NEXT WAKE
key 165 MEDIA_PREVIOUS WAKE
key 168 MEDIA_REWIND WAKE
key 208 MEDIA_FAST_FORWARD WAKE
to
Code:
key 200 MEDIA_PLAY_PAUSE WAKE
key 201 MEDIA_PLAY_PAUSE WAKE
key 166 MEDIA_STOP WAKE
key 163 MEDIA_PLAY_PAUSE WAKE
key 165 MEDIA_PLAY_PAUSE WAKE
key 168 MEDIA_REWIND WAKE
key 208 MEDIA_FAST_FORWARD WAKE
For good measure, I also changed the MEDIA_PREVIOUS to MEDIA_PLAY_PAUSE.
Trouble is, this fix isnt working. Am I doing something wrong? Is it reading the configuration from elsewhere?
Meanwhile, the default headset is working fine with these settings as well. I could really use some help here
Soumen

Related

Building a better Vogue-Android KeyMap

We all know that the physical keys mapped for Android are less than ideal--so let's work together to build a better Vogue key map, that we can ultimately customize the layout to our individual likings.
Here is an excellent link detailing information regarding Key Input and the Key Map--if nothing else, glaze over this quickly: http://www.kandroid.org/android_pdk/keymaps_keyboard_input.html
Android KeyMaps are stored in /system/usr/keylayout. On your particular build, you'll probably see a number of .kl files: AVRCP.kl, h2w_headset.kl, qwerty.kl, sapphire-keypad.kl, trout-keypad.kl, etc. For our purposes, disregard all of them except qwerty.kl. If Android can find no other .kl file, it will default to qwerty.kl. You can (for example) delete all of the other .kl files, and your phone will function exactly the same based on qwerty.kl.
If you examine your qwerty.kl, it will look very similar to the KeyMap from the link above. It follows this format:
SCANCODE KEYCODE [FLAGS]
Here is, for example, my qwerty.kl as pulled from Plemen's 1.6 AOSP build:
key 399 GRAVE
key 2 1
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
key 11 0
key 158 BACK WAKE_DROPPED
key 230 SOFT_RIGHT WAKE
key 60 SOFT_RIGHT WAKE
key 107 ENDCALL WAKE_DROPPED
key 62 ENDCALL WAKE_DROPPED
key 229 MENU WAKE_DROPPED
key 139 MENU WAKE_DROPPED
key 59 MENU WAKE_DROPPED
key 127 SEARCH WAKE_DROPPED
key 217 SEARCH WAKE_DROPPED
key 228 POUND
key 227 STAR
key 231 CALL WAKE_DROPPED
key 61 CALL WAKE_DROPPED
key 232 DPAD_CENTER WAKE_DROPPED
key 108 DPAD_DOWN WAKE_DROPPED
key 103 DPAD_UP WAKE_DROPPED
key 102 HOME WAKE
key 105 DPAD_LEFT WAKE_DROPPED
key 106 DPAD_RIGHT WAKE_DROPPED
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 116 POWER WAKE
key 212 CAMERA
key 16 Q
key 17 W
key 18 E
key 19 R
key 20 T
key 21 Y
key 22 U
key 23 I
key 24 O
key 25 P
key 26 LEFT_BRACKET
key 27 RIGHT_BRACKET
key 43 BACKSLASH
key 30 A
key 31 S
key 32 D
key 33 F
key 34 G
key 35 H
key 36 J
key 37 K
key 38 L
key 39 SEMICOLON
key 40 APOSTROPHE
key 14 DEL
key 44 Z
key 45 X
key 46 C
key 47 V
key 48 B
key 49 N
key 50 M
key 51 COMMA
key 52 PERIOD
key 53 SLASH
key 28 ENTER
key 56 ALT_LEFT
key 100 ALT_RIGHT
key 42 SHIFT_LEFT
key 54 SHIFT_RIGHT
key 15 TAB
key 57 SPACE
key 150 EXPLORER
key 155 ENVELOPE
key 12 MINUS
key 13 EQUALS
key 215 AT
Click to expand...
Click to collapse
When a button is pressed, it sends a SCANCODE to Android, which is interpretted and this file defines the corresponding action--back, volume up, end, camera, etc.--as well as the FLAGS that code may have, such as "WAKE", which means that button can then wake the device from sleep.
What we need is to map the button single-press and long-presses on our Vogue and identify the SCANCODES. With them, we can write our own .kl file, completely customized for us.
Currently, getting the SCANCODES seems to be the roadblock. I've tried "GetKeys" from the terminal without any luck. In the research I've done so far, it appears it may require some native C code to interpret system input and print it back out.
Please contribute and feel free to dig away in an effort to accelerate this project. Once this is done, it's one more item checked off for Android development--and it should be portable to all versions (1.5, 1.6, 2.0, 2.1, etc.)
Lastly, while I believe everything I've cited to be true, I may be incorrect--please correct me if I am.
this is something we've addressed before a few times, and have already changed the default keymap to what it is now.
Currently the keymap is set by the kernel, not by the userspace. check the kernel git and you should be able to find what you're looking for.
In case someone's still trying to find out which key does which scancode (or rather key number in the .kl files): Just use "getevent" in the terminal or ADB.
Second column of numbers is "key number" in hex.
Hi,
I'm looking to something like this to a bluetooth keyboard. How to implement deadkeys?

dvorak with ESC external keyboard layout, needs CTL

The section at the end of this post maps an extrnal keyboard to dvorak.
Note, the escape key sends escape instead of going back as in the original
qweryt layout. I have not figured out how to send the Ctrl modifier key.
If someone can figure out how to put that in the position of the Cap Lock key,
that would be great.
This may help:
developer.android.com/reference/android/view/KeyEvent.html
To make this work, copy the keycodes into a file, say dvorak.kl, then make backups
of your qwerty layout and copy:
Code:
su
cp /system/usr/keylayout/en_us.kl /system/usr/keylayout/en_us_backup.kl
cp dvorak.kl /system/usr/keylayout/en_us.kl
cp /system/usr/keylayout/gpio-keys.kl /system/usr/keylayout/gpio-keys_backup.kl
cp dvorak.kl /system/usr/keylayout/gpio-keys.kl
Then select English (us) from your Settings-> Language and keyboard-> Select external keyboard layout menu.
Don't know how to make dvorak show up as an option.
Code:
key 399 GRAVE
key 2 1
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
key 11 0
key 158 BACK WAKE_DROPPED
key 230 SOFT_RIGHT WAKE
key 60 SOFT_RIGHT WAKE
key 107 ENDCALL WAKE_DROPPED
key 62 ENDCALL WAKE_DROPPED
key 229 MENU WAKE_DROPPED
key 139 MENU WAKE_DROPPED
key 59 MENU WAKE_DROPPED
key 127 MENU WAKE_DROPPED
key 217 SEARCH WAKE_DROPPED
key 228 POUND
key 227 STAR
key 231 CALL WAKE_DROPPED
key 61 CALL WAKE_DROPPED
key 232 DPAD_CENTER WAKE_DROPPED
key 108 DPAD_DOWN WAKE_DROPPED
key 103 DPAD_UP WAKE_DROPPED
key 102 HOME WAKE
key 105 DPAD_LEFT WAKE_DROPPED
key 106 DPAD_RIGHT WAKE_DROPPED
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 116 POWER WAKE
key 212 CAMERA
key 16 APOSTROPHE
key 17 COMMA
key 18 PERIOD
key 19 P
key 20 Y
key 21 F
key 22 G
key 23 C
key 24 R
key 25 L
key 26 SLASH
key 27 EQUALS
key 43 BACKSLASH
key 30 A
key 31 O
key 32 E
key 33 U
key 34 I
key 35 D
key 36 H
key 37 T
key 38 N
key 39 S
key 40 MINUS
key 14 DEL
key 44 SEMICOLON
key 45 Q
key 46 J
key 47 K
key 48 X
key 49 B
key 50 M
key 51 W
key 52 V
key 53 Z
key 28 ENTER
key 56 ALT_LEFT
key 100 ALT_RIGHT
key 42 SHIFT_LEFT
key 54 SHIFT_RIGHT
key 15 TAB
key 57 SPACE
key 150 EXPLORER
key 155 ENVELOPE
key 12 LEFT_BRACKET
key 13 RIGHT_BRACKET
key 215 AT
key 125 HOME WAKE
key 172 HOME WAKE
key 1 ESCAPE WAKE_DROPPED
key 173 DPAD_CENTER WAKE_DROPPED
key 71 7
key 72 8
key 73 9
key 74 MINUS
key 75 4key 76 5
key 77 6
key 78 PLUS
key 79 1
key 80 2
key 81 3
key 82 0
key 83 PERIOD
key 55 STAR
key 96 ENTER
key 98 SLASH
key 121 COMMA

[FIX] Use your headset button to control music playing on miui rom!

Use the RE Explorer (remember change the folder read-only permissions to read and write) into the / system / usr / keylayout folder, in qwerty.kl file, add a few lines of code:
key 113 MUTE
key 163 MEDIA_NEXT
key 164 MEDIA_PLAY_PAUSE
key 165 MEDIA_PREVIOUS
key 226 HEADSETHOOK WAKE
key 231 CALL WAKE_DROPPED
Now it can control music playing!
One click- play, pause music, answer/ end the call
long press- play the next music
double click- play the previous music
Doesn't work on Oxygen how can check what button code a button have?
Sent from my Ideos x5
Sorry, I have no idea about Oxygen rom. Try to fetch offcial conduction from the Oxygen group.
Okay thanks!
Sent from my Ideos x5
这个可以有!~~up!~~
excelwang said:
Use the RE Explorer (remember change the folder read-only permissions to read and write) into the / system / usr / keylayout folder, in qwerty.kl file, add a few lines of code:
key 113 MUTE
key 163 MEDIA_NEXT
key 164 MEDIA_PLAY_PAUSE
key 165 MEDIA_PREVIOUS
key 226 HEADSETHOO K WAKE
key 231 CALL WAKE_DROPPED
Now it can control music playing!
One click- play, pause music, answer/ end the call
long press- play the next music
double click- play the previous music
Click to expand...
Click to collapse
Are you sure it isn't key 226 HEADSETHOOK WAKE without a space between oo and k?
Code:
key 113 MUTE
key 163 MEDIA_NEXT
key 164 MEDIA_PLAY_PAUSE
key 165 MEDIA_PREVIOUS
key 226 HEADSETHOOK WAKE
key 231 CALL WAKE_DROPPED
This works on Oxygen too, thanks dude! =D
Play/pause music
Answer call/mute mic/long press to end call
andreasha said:
Are you sure it isn't key 226 HEADSETHOOK WAKE without a space between oo and k?
Click to expand...
Click to collapse
Ur, I'm sorry. There is no space between oo and K.
have anyone tried them on stock rom ?
My headset button worked fine on stock atleast on 136. But this may add some functionality like mute mic (I dont remember that function on stock). Anyway you should find a .kl file in that folder on stock too.
Sent from my Ideos x5

IR Remote Mapping Help

Hi All,
So basically I flashed another firmware on my box and it works except the remote.
The buttons on the remote are messed up but work but some buttons aren't recognised.
However, i found the file that is responsible for the mapping of the buttons.
The file is located in /system/usr/keylayout/sun7i-ir.kl
So opening the file sun7i-ir.kl reveals this:
key 0x57 POWER WAKE
key 0x52 MEDIA_PLAY_PAUSE
#key 43 MEDIA_STOP
#key 60 MEDIA_PREVIOUS
#key 79 MEDIA_NEXT
key 0x1d 0
key 0x10 1
key 0x11 2
key 0x12 3
key 0x13 4
key 0x14 5
key 0x15 6
key 0x17 7
key 0x18 8
key 0x19 9
key 0x1c BROWSER
key 0x1e DEL
key 0x4d BACK
key 0x4e HOME
key 0x1a MENU
key 0x50 MOUSE
key 0x43 DPAD_UP
key 0x0a DPAD_DOWN
key 0x06 DPAD_LEFT
key 0x0e DPAD_RIGHT
key 0x02 DPAD_CENTER
key 0x1b VOLUME_UP
key 0x58 VOLUME_DOWN
key 0x5b MUTE
#key 0x0f PROG_RED
#key 0x4c PROG_GREEN
#key 31 PROG_YELLOW
key 0x4f SETTINGS
I found other configurations but none follows the same as my remote.
So I have attached an image of my remote so if anyone has the same remote or a similar one with the same buttons please extract your sun7i-ir.kl and send it to me.
Many thanks
faddys123 said:
Hi All,
So basically I flashed another firmware on my box and it works except the remote.
The buttons on the remote are messed up but work but some buttons aren't recognised.
However, i found the file that is responsible for the mapping of the buttons.
The file is located in /system/usr/keylayout/sun7i-ir.kl
So opening the file sun7i-ir.kl reveals this:
key 0x57 POWER WAKE
key 0x52 MEDIA_PLAY_PAUSE
#key 43 MEDIA_STOP
#key 60 MEDIA_PREVIOUS
#key 79 MEDIA_NEXT
key 0x1d 0
key 0x10 1
key 0x11 2
key 0x12 3
key 0x13 4
key 0x14 5
key 0x15 6
key 0x17 7
key 0x18 8
key 0x19 9
key 0x1c BROWSER
key 0x1e DEL
key 0x4d BACK
key 0x4e HOME
key 0x1a MENU
key 0x50 MOUSE
key 0x43 DPAD_UP
key 0x0a DPAD_DOWN
key 0x06 DPAD_LEFT
key 0x0e DPAD_RIGHT
key 0x02 DPAD_CENTER
key 0x1b VOLUME_UP
key 0x58 VOLUME_DOWN
key 0x5b MUTE
#key 0x0f PROG_RED
#key 0x4c PROG_GREEN
#key 31 PROG_YELLOW
key 0x4f SETTINGS
I found other configurations but none follows the same as my remote.
So I have attached an image of my remote so if anyone has the same remote or a similar one with the same buttons please extract your sun7i-ir.kl and send it to me.
Many thanks
Click to expand...
Click to collapse
Did you find anything useful?
I want to know what Prog_green and etc is?
The "color" buttons are commented out there, but you don't have any "color" buttons anyway.
Step one: Connect your remote and look at logcat to double check that it is loading the .kl file that you think it is.
Step two: Determine which keys do not work.
Step three: Android does lots of goofiness with MEDIA_XYZ keys, they go through MediaSessionServer.
The "color" keys are unlabeled keys on TV style remotes.

hardware key change

Hi All,
I have a ac8317 head unit which doesn't have the hardware BACK button.
Since I don't user the equalizer, I was wondering if it could be possible to update the unit keymap to use the EQ button as BACK button.
Anyone knows which parameter needs to be changed in order to do so?
key 2 1
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
key 11 0
key 18 E
key 23 I
key 24 O
key 25 P
key 28 ENTER
key 30 A
key 32 D
key 33 F
key 34 G
key 35 H
key 36 J
key 37 K
key 38 L
key 46 C
key 48 B
key 49 N
key 50 M
key 102 HOME
key 103 DPAD_UP
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 108 DPAD_DOWN
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 158 BACK WAKE_DROPPED
key 116 POWER WAKE
key 139 MENU WAKE_DROPPED
key 229 APP_SWITCH WAKE_DROPPED
I got root of that unit and going to try. Which .ini file shall we edit?

Categories

Resources