集成旋转编码器作为输入设备(AOSP)

时间:2018-02-07 14:09:12

标签: android android-source

我试图在Android中集成旋转编码器。即使device.type在设备配置文件中设置为rotaryEncoder,也有一个logcat条目显示类0x1000而不是0x400000。我不知道这里有什么问题。期待最愚蠢的错误,因为我并不熟悉AOSP。

输入设备配置文件:

rpi3:/ # cat /system/usr/idc/rotary_0.idc
device.type = rotaryEncoder
device.internal = 1
device.res = 1
device.scalingFactor = 1

密钥布局文件:

rpi3:/ # cat /system/usr/keylayout/rotary_0.kl
axis 0x08 SCROLL

getevent -il

add device 1: /dev/input/event3
  bus:      0019
  vendor    0000
  product   0000
  version   0000
  name:     "rotary@0"
  location: ""
  id:       ""
  version:  1.0.1
  events:
    REL (0002): REL_WHEEL
  input props:
    <none>

dmesg的:

[    3.544491] rotary-encoder rotary@0: gray
[    3.547289] input: rotary@0 as /devices/platform/rotary@0/input/input3

logcat的:

01-17 20:55:47.439   469   515 I EventHub: New device: id=1, fd=83, path='/dev/input/event3', name='rotary@0', classes=0x1000, configuration='/system/usr/idc/rotary_0.idc', keyLayout='', keyCharacterMap='', builtinKeyboard=false, wakeMechanism=EPOLLWAKEUP, usingClockIoctl=true

Android版本为7.1.2

1 个答案:

答案 0 :(得分:0)

虽然Android 7.1的HAL已经支持此功能,但Android SDK不适用于26以下的API级别。因此,需要Android 8.0才能获得无方向性滚轮支持。