AndroidP 增加蓝牙遥控器对应的kl文件 --hisi平台

本文介绍在Hisi平台上为特定蓝牙遥控器配置输入设备的过程。包括获取设备信息、创建配置文件、设置权限、编译拷贝文件及验证配置等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如果本文对个位有用,麻烦点个关注,谢谢

第一步 首先查看蓝牙遥控器设备信息

cat /proc/bus/input/devices

结果如下:

I: Bus=0005 Vendor=568a Product=9869 Version=0111
N: Name="语音助手"
P: Phys=
S: Sysfs=/devices/virtual/misc/uhid/0005:568A:9869.0001/input/input4
U: Uniq=95:59:08:04:0c:26
H: Handlers=kbd leds event4
B: PROP=0
B: EV=12001f
B: KEY=3007f 0 0 0 0 483ffff 17aff32d bf544446 0 0 1 130f93 8b17c007 ffff7bfa d9415fff febeffdf ffefffff ffffffff fffffffe
B: REL=40
B: ABS=ffffff01 0
B: MSC=10
B: LED=3ff

获取到 Vendor=568a Product=9869 的信息

第二步创建 然后创建三个文件如下,(复制其中一组数据进行改名)

路径:device\hisilicon\bigfish\prebuilts*

这俩个值对应如下:

在这里插入图片描述

这个时候再修改Vendor_568a_Product_9869.idc文件

# vinput configuration file.
#
device.internal = 1

touch.deviceType = touchScreen
touch.orientationAware = 1

keyboard.layout = Vendor_568a_Product_9869
keyboard.characterMap = Vendor_568a_Product_9869
keyboard.orientationAware = 1
# the remote control includes a special keyboard but not builtin-keypad.
keyboard.builtIn = 0

cursor.mode = navigation
cursor.orientationAware = 1
 

第三步 增加三个文件的权限

修改如下文件,目的是添加新创建三个文件的权限

路径:device\hisilicon\bigfish\external\sepolicy\vendor\file_contexts

在文件最后面仿照之前文件增加自己的文件权限

############################
# AndroidP
# SP-HAL SP-HAL-DEP
# same_process_hal_file, vndk_sp_file, vendor_app_file
/(vendor|system/vendor)/lib(64)?/hw/gralloc\.bigfish\.so                    u:object_r:same_process_hal_file:s0
/(vendor|system/vendor)/lib(64)?/hw/overlay\.bigfish\.so                    u:object_r:same_process_hal_file:s0
/(vendor|system/vendor)/lib(64)?/libion_ext\.so                             u:object_r:same_process_hal_file:s0
# FIXME
/vendor/usr/idc/Vendor_0001_Product_0001.idc        u:object_r:same_process_hal_file:s0
/vendor/usr/keylayout/Vendor_0001_Product_0001.kl   u:object_r:same_process_hal_file:s0
/vendor/usr/keychars/Vendor_0001_Product_0001.kcm   u:object_r:same_process_hal_file:s0

/vendor/usr/idc/Vendor_045e_Product_00db.idc        u:object_r:same_process_hal_file:s0
/vendor/usr/keylayout/Vendor_045e_Product_00db.kl   u:object_r:same_process_hal_file:s0
/vendor/usr/keychars/Vendor_045e_Product_00db.kcm   u:object_r:same_process_hal_file:s0

/vendor/usr/keylayout/Generic.kl   u:object_r:same_process_hal_file:s0
/vendor/usr/keychars/Generic.kcm   u:object_r:same_process_hal_file:s0

/vendor/usr/idc/Vendor_046d_Product_0002.idc        u:object_r:same_process_hal_file:s0
/vendor/usr/keylayout/Vendor_046d_Product_0002.kl   u:object_r:same_process_hal_file:s0
/vendor/usr/keychars/Vendor_046d_Product_0002.kcm   u:object_r:same_process_hal_file:s0

/vendor/usr/idc/Vendor_568a_Product_9869.idc        u:object_r:same_process_hal_file:s0 //自己新增
/vendor/usr/keylayout/Vendor_568a_Product_9869.kl   u:object_r:same_process_hal_file:s0 //自己新增
/vendor/usr/keychars/Vendor_568a_Product_9869.kcm   u:object_r:same_process_hal_file:s0 //自己新增

# debugfs
# PEA0313 neverallow {write open} debugfs_tracing_debug file
/sys/kernel(/debug)?/tracing/trace_marker   u:object_r:debugfs_trace_marker:s0
 

第四步 修改编译拷贝文件

修改文件路径:device\hisilicon$(CHIPNAME)\device_copyfile.mk
根据芯片信号进入对应目录进行修改
修改如下: (这个不同的hisi芯片可能会有差异,可根据自行情况进行修改)

 #IR xml config
PRODUCT_COPY_FILES += \
    device/hisilicon/$(CHIPNAME)/etc/input/newkey.xml:atv/etc/key.xml \
    device/hisilicon/$(CHIPNAME)/etc/input/newkey_pad.xml:atv/etc/key_pad.xml \
    device/hisilicon/bigfish/prebuilts/Vendor_0001_Product_0001.idc:vendor/usr/idc/Vendor_0001_Product_0001.idc \
    device/hisilicon/bigfish/prebuilts/Vendor_0001_Product_0001.kl:vendor/usr/keylayout/Vendor_0001_Product_0001.kl \
    device/hisilicon/bigfish/prebuilts/Vendor_0001_Product_0001.kcm:vendor/usr/keychars/Vendor_0001_Product_0001.kcm \
    device/hisilicon/bigfish/prebuilts/Vendor_046d_Product_0002.idc:vendor/usr/idc/Vendor_046d_Product_0002.idc \
    device/hisilicon/bigfish/prebuilts/Vendor_046d_Product_0002.kl:vendor/usr/keylayout/Vendor_046d_Product_0002.kl \
    device/hisilicon/bigfish/prebuilts/Vendor_046d_Product_0002.kcm:vendor/usr/keychars/Vendor_046d_Product_0002.kcm \
    device/hisilicon/bigfish/prebuilts/Vendor_045e_Product_00db.idc:vendor/usr/idc/Vendor_045e_Product_00db.idc \
    device/hisilicon/bigfish/prebuilts/Vendor_045e_Product_00db.kl:vendor/usr/keylayout/Vendor_045e_Product_00db.kl \
    device/hisilicon/bigfish/prebuilts/Vendor_045e_Product_00db.kcm:vendor/usr/keychars/Vendor_045e_Product_00db.kcm \
    device/hisilicon/bigfish/prebuilts/Vendor_568a_Product_9869.idc:vendor/usr/idc/Vendor_568a_Product_9869.idc \    #编译拷贝动作
    device/hisilicon/bigfish/prebuilts/Vendor_568a_Product_9869.kl:vendor/usr/keylayout/Vendor_568a_Product_9869.kl \    #编译拷贝动作
    device/hisilicon/bigfish/prebuilts/Vendor_568a_Product_9869.kcm:vendor/usr/keychars/Vendor_568a_Product_9869.kcm \   #编译拷贝动作
    device/hisilicon/bigfish/prebuilts/Generic.kl:vendor/usr/keylayout/Generic.kl \
    device/hisilicon/bigfish/prebuilts/Generic.kcm:vendor/usr/keychars/Generic.kcm

第五步 校验添加是否成功

命令:dumpsys input

结果如下

    5: 语音助手
      Classes: 0x00000123
      Path: /dev/input/event4
      Enabled: true
      Descriptor: 5b54760c3e9394a76eb3bb264b477be06cea8926
      Location:
      ControllerNumber: 0
      UniqueId: 95:59:08:04:0c:26
      Identifier: bus=0x0005, vendor=0x568a, product=0x9869, version=0x0111
      KeyLayoutFile: /vendor/usr/keylayout/Vendor_568a_Product_9869.kl
      KeyCharacterMapFile: /vendor/usr/keychars/Vendor_568a_Product_9869.kcm
      ConfigurationFile: /vendor/usr/idc/Vendor_568a_Product_9869.idc
      HaveKeyboardLayoutOverlay: false

如果本文对个位有用,麻烦点个关注,谢谢

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值