Android 系统 遥控器适配

Android 遥控器按键映射

  • 步骤
    • Root设备
    • 系统文件夹下找到kl文件夹
    • 确定文件
    • 修改映射
    • 将文件拷入kl文件夹下

步骤

Root设备

adb root

系统文件夹下找到kl文件夹

通常在device目录下对应设备类型文件夹下寻找

确定文件

使用命令cat/proc/bus/input/devices查看,根据Vendor,Product,Version确定kl,有没有对应的kl文件,没有则新建:Vendor_vendor值_Product_product值(_Version_version值).kl,例如:

1|petrel-p1:/ # cat /proc/bus/input/devices
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name=“axp80-powerkey”
P: Phys=m1kbd/input2
S: Sysfs=/devices/soc/pmu0/axp80-powerkey/input/input0
U: Uniq=
H: Handlers=autohotplug kbd event0 cpufreq_interactive
B: PROP=0
B: EV=7
B: KEY=100000 0 0 0
B: REL=0

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name=“sunxi-keyboard”
P: Phys=sunxikbd/input0
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=autohotplug kbd event1 cpufreq_interactive
B: PROP=0
B: EV=3
B: KEY=c0000 0 0 0

那么第一个设备文件名为:Vendor_0001_Product_0001(_Version_0100).kl

修改映射

输入命令 getevent -l 获取input列表和按键事件,记住自己按下的键,命令行里输出的就是对应得linux键值,如下:event9 对应BLuetooth 4.0 RC, MSC_SCAN 00070051对应输入的“方向下”,取后4位0x0051转换为对应十进制键值,在这个文件中修改成想要的android键值

130|petrel-p1:/ # getevent -l
add device 1: /dev/input/event9
name: “BLuetooth 4.0 RC”
could not get driver version for /dev/input/mouse1, Not a typewriter
add device 2: /dev/input/event6
name: “sunxi-ir-uinput”
add device 3: /dev/input/event5
name: “bt-powerkey”
add device 4: /dev/input/event4
name: “sunxi-gpiokey”
add device 5: /dev/input/event3
name: “MCE IR Keyboard/Mouse (sunxi-rc-recv)”
could not get driver version for /dev/input/mouse0, Not a typewriter
add device 6: /dev/input/event2
name: “sunxi-ir”
add device 7: /dev/input/event1
name: “sunxi-keyboard”
could not get driver version for /dev/input/mice, Not a typewriter
add device 8: /dev/input/event0
name: “axp80-powerkey”
/dev/input/event9: EV_MSC MSC_SCAN 00070051
/dev/input/event9: EV_KEY KEY_DOWN DOWN
/dev/input/event9: EV_SYN SYN_REPORT 00000000
/dev/input/event9: EV_MSC MSC_SCAN 00070051
/dev/input/event9: EV_KEY KEY_DOWN UP
/dev/input/event9: EV_SYN SYN_REPORT 00000000
/dev/input/event9: EV_MSC MSC_SCAN 00070051
/dev/input/event9: EV_KEY KEY_DOWN DOWN
/dev/input/event9: EV_SYN SYN_REPORT 00000000
/dev/input/event9: EV_MSC MSC_SCAN 00070051
/dev/input/event9: EV_KEY KEY_DOWN UP
/dev/input/event9: EV_SYN SYN_REPORT 00000000

将文件拷入kl文件夹下

你可能感兴趣的:(笔记)