Sample Header Ad - 728x90

How To Map Joypad Axis To Button?

0 votes
1 answer
375 views
How do I map a joypad (specifically the HAT switch/DPad) axis to a button with a key-layout file in /system/usr/keylayout/? I currently have this line in the appropriate file: axis 0x10 split 0x7f BUTTON_L1 BUTTON_R1. I'll explain the line token by token. First token refers to the input type. axis means I'm binding an axis. Second token is the axis ID. The axis I want to remap is 0x10. The Android developer's wiki page concerning key-layout files mention you can split an input axis into two outputs with split so I'm using it. The split is at the value immediately following split, in this case 0x7f. Input values below the split threshold map as the 1st token after the split threshold token. Here it is BUTTON_L1. Input values above the split threshold map as the 2nd token after the split threshold token. Here it is BUTTON_R1. However, when I use the line metioned above the axis does not map to anything anymore. Are you able to map device axes to Android buttons in the first place? If so, what is the proper syntax for it?
Asked by Alexander M (193 rep)
Nov 21, 2021, 04:47 AM
Last activity: Nov 23, 2021, 07:51 PM