[RFC] Remapping volume buttons

tazzix

Senior Member
Nov 12, 2005
119
17
0
Karachi
tazzix.com
pgdn has a few things hard coded. The first thing I'd try for another system is /dev/input/event1. Use evtest to find which input device actually corresponds to the hardware keys on your system. At the same time you can also check if the key codes are the same.

Thanks! now I understand the android input system much better and might have some luck with the NDK.


EDIT / UPDATE: Oops this device is a mess to say the least, 10 input event FIFOs and 2 for the device keys, input3 and input4. Now input3 is for capacitive keys of home, menu, back and search. Each key press generates around 20 events. I would pass on this one. input4 is much better and has the keys I am looking for (Vol+, Vol-, Power) with the keys of the QWERTY keypad which I don't intend to map. Keypresses are much cleaner as well:

# /system/evtest /dev/input/event4
Input driver version is 1.0.0
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "chacha-keypad-steng"
...<possible events ommitted>....

Event: time 30551.286304, type 1 (Key), code 115 (VolumeUp), value 1
Event: time 30551.518177, type 1 (Key), code 115 (VolumeUp), value 0
Event: time 30552.407215, type 1 (Key), code 114 (VolumeDown), value 1
Event: time 30552.570240, type 1 (Key), code 114 (VolumeDown), value 0
Event: time 30560.423572, type 1 (Key), code 116 (Power), value 1
Event: time 30560.546527, type 1 (Key), code 116 (Power), value 0
 
Last edited:

tazzix

Senior Member
Nov 12, 2005
119
17
0
Karachi
tazzix.com
@MatanZ

tried my luck with the NDK but not seem to work, my executable even with stderr prints uncommented generates no logcat but found this in the dmesg:

<3>[35741.434875] init: untracked pid 6607 exited

I tried using input.h and uinput.h from /usr/include/linux.

I would appreciate if you can add a keyword to the config file like:

Code:
event /dev/input/event1
or something, might be all that is required for cross device support.

EDIT:

Never mind, got it working and implemented the parameter, trivial once I got it working :) Was an issue with my uinput.h

Loving it :)
 
Last edited:

tazzix

Senior Member
Nov 12, 2005
119
17
0
Karachi
tazzix.com
how exactly do we run it... do i go to the file in root explorer and cliclk on the file or do something else...
i have the pgdn4 placed in /data
If you are aware of the Linux way of "services" you can add a file to /system/etc/init.d/

if not, then you can do something like (adb or terminal):

# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# echo "/data/pgdn" >> /system/etc/init.d/99complete
# reboot

If you did not understand what is happening here then DO NOT DO IT. The reboot will help in two things, making your /system read only once again and making sure it worked, I had to spend one hour with a phone with a disabled power and home key while not in front of a computer to fix it. So I can tell you its pretty bad to lose any way of waking your phone ;)
 
  • Like
Reactions: manisht720

manisht720

Senior Member
Jan 3, 2011
113
6
0
If you did not understand what is happening here then DO NOT DO IT. The reboot will help in two things, making your /system read only once again and making sure it worked, I had to spend one hour with a phone with a disabled power and home key while not in front of a computer to fix it. So I can tell you its pretty bad to lose any way of waking your phone ;)
hahaha... this did happen to me as i could not wake it up using any key combo so i had to restart the phone and immediately i changed the key file by removing the # that i had put to remove those wake commands...

---------- Post added at 01:07 PM ---------- Previous post was at 01:02 PM ----------

if not, then you can do something like (adb or terminal):

# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# echo "/data/pgdn" >> /system/etc/init.d/99complete
# reboot
and i dont know a thing about linux but will sure try these commands in terminal...
thanks dear...
 

shubham.12

Senior Member
Oct 28, 2011
131
28
0
www.facebook.com
The latest version has a configuration file: /sdcard/.pgdn .


With configuration file http://my.svgalib.org/android/config.pgdn and with /system/usr/keylayout/sec_key.kl containing:

key 115 VOLUME_UP WAKE
#key 114 VOLUME_DOWN WAKE
#key 102 HOME WAKE
key 107 ENDCALL
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 103 DPAD_UP
key 108 DPAD_DOWN
key 232 DPAD_CENTER
#key 116 POWER WAKE
key 212 CAMERA WAKE

The power key works as shutter key in camera application and as the usual power key when not in camera application.
hey!! i used this MOD
placed pgdn file in /data
rebooted but nothing changed
IN camera app Power key is not working as Shooter Key :(
What is that i am doing wrong????

---------- Post added at 02:21 AM ---------- Previous post was at 02:11 AM ----------

I don't get how to execute the pgdn file?
place it where?
in /system or /data
 

bouvrie

Senior Member
May 19, 2007
102
9
0
Business idea : u could make an app with options. I am sure this will sell well
Re-use of buttons would be an EXCELLENT addition to Android devices, now that they seem to lack hardware buttons a lot. Perhaps for this app, the Windows Mobile-based AE Button Plus could function as a reference in terms of features (distinguish up to 4 different keypress events on each button grabbed: single, double, triple and "long" keypresses, perhaps make context-sensitive actions ('active' application) possible, etc.)