Кнопки в Андроиде

Материал из Toshiba AC100 wiki
Версия от 13:48, 24 апреля 2016; Stuw (обсуждение | вклад) (→‎Android keymaps)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)
Перейти к навигации Перейти к поиску

Кикоды клавиатуры ac100


Ошибка создания миниатюры: Не удаётся сохранить эскиз по месту назначения

Список устройств ввода


Вывод getevent ниже

getevent -p
add device 1: /dev/input/event6
  name:     "tegra-alc5632 Headset Jack"
  events:
    SW  (0005): 0002  0004
  input props:
    <none>
add device 2: /dev/input/event5
  name:     "ETPS/2 Elantech Touchpad"
  events:
    KEY (0001): 0110  0111  0145  014a  014d  014e
    ABS (0003): 0000  : value 1499, min 0, max 2268, fuzz 0, flat 0, resolution 0
                0001  : value 401, min 0, max 756, fuzz 0, flat 0, resolution 0
                0018  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                001c  : value 0, min 0, max 15, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 2268, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 756, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
  input props:
    <none>
could not get driver version for /dev/input/mouse0, Not a typewriter
add device 3: /dev/input/event3
  name:     "NVEC lid switch button"
  events:
    SW  (0005): 0000
  input props:
    <none>
add device 4: /dev/input/event2
  name:     "NVEC power button"
  events:
    KEY (0001): 0074
  input props:
    <none>
add device 5: /dev/input/event1
  name:     "NVEC sleep button"
  events:
    KEY (0001): 008e
  input props:
    <none>
add device 6: /dev/input/event0
  name:     "nvec keyboard"
  events:
    KEY (0001): 0001  0002  0003  0004  0005  0006  0007  0008
                0009  000a  000b  000c  000d  000e  000f  0010
                0011  0012  0013  0014  0015  0016  0017  0018
                0019  001a  001b  001c  001d  001e  001f  0020
                0021  0022  0023  0024  0025  0026  0027  0028
                0029  002a  002b  002c  002d  002e  002f  0030
                0031  0032  0033  0034  0035  0036  0037  0038
                0039  003a  003b  003c  003d  003e  003f  0040
                0041  0042  0043  0044  0047  0048  0049  004a
                004b  004c  004d  004e  004f  0050  0051  0052
                0053  0056  0057  0058  0061  0062  0063  0064
                0066  0067  0068  0069  006a  006b  006c  006d
                006e  006f  0071  0073  0074  007d  008b  00d0
                00d9  00df
    LED (0011): 0001
  input props:
    <none>
could not get driver version for /dev/input/mice, Not a typewriter
add device 7: /dev/input/event4
  name:     "gpio-keys"
  events:
    KEY (0001): 0074
  input props:
    <none>

Вывод dumpsys относительно устройств ввода

dumpsys window
WINDOW MANAGER INPUT (dumpsys window input)
Event Hub State:
  BuiltInKeyboardId: -1
  Devices:
    1: tegra-alc5632 Headset Jack
      Classes: 0x00000080
      Path: /dev/input/event6
      Location: ALSA
      UniqueId:
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile:
      KeyCharacterMapFile:
      ConfigurationFile:
    2: ETPS/2 Elantech Touchpad
      Classes: 0x00000014
      Path: /dev/input/event5
      Location: nvec/input0
      UniqueId:
      Identifier: bus=0x0011, vendor=0x0002, product=0x000e, version=0x0000
      KeyLayoutFile:
      KeyCharacterMapFile:
      ConfigurationFile:
    3: NVEC lid switch button
      Classes: 0x00000080
      Path: /dev/input/event3
      Location: NVEC
      UniqueId:
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile:
      KeyCharacterMapFile:
      ConfigurationFile:
    4: NVEC power button
      Classes: 0x00000001
      Path: /dev/input/event2
      Location: NVEC
      UniqueId:
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile:
    5: NVEC sleep button
      Classes: 0x00000001
      Path: /dev/input/event1
      Location: NVEC
      UniqueId:
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile:
    6: nvec keyboard
      Classes: 0x00000023
      Path: /dev/input/event0
      Location: nvec
      UniqueId:
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: /system/usr/keylayout/nvec_keyboard.kl
      KeyCharacterMapFile: /system/usr/keychars/nvec_keyboard.kcm
      ConfigurationFile:
    7: gpio-keys
      Classes: 0x00000001
      Path: /dev/input/event4
      Location: gpio-keys/input0
      UniqueId:
      Identifier: bus=0x0019, vendor=0x0001, product=0x0001, version=0x0100
      KeyLayoutFile: /system/usr/keylayout/gpio-keys.kl
      KeyCharacterMapFile: /system/usr/keychars/gpio-keys.kcm
      ConfigurationFile:

Input Reader State:
  Device 1: tegra-alc5632 Headset Jack
    IsExternal: false
    Sources: 0x80000000
    KeyboardType: 0
  Device 2: ETPS/2 Elantech Touchpad
    IsExternal: false
    Sources: 0x00002002
    KeyboardType: 0
    Motion Ranges:
      X: source=0x00002002, min=0.000, max=1023.549, flat=0.000, fuzz=0.451
      Y: source=0x00002002, min=0.000, max=599.207, flat=0.000, fuzz=0.793
      PRESSURE: source=0x00002002, min=0.000, max=1.000, flat=0.000, fuzz=0.000
    Touch Input Mapper:
      Parameters:
        GestureMode: spots
        DeviceType: pointer
        AssociatedDisplay: id=0, isExternal=false
        OrientationAware: false
      Raw Touch Axes:
        X: min=0, max=2268, flat=0, fuzz=0, resolution=0
        Y: min=0, max=756, flat=0, fuzz=0, resolution=0
        Pressure: unknown range
        TouchMajor: unknown range
        TouchMinor: unknown range
        ToolMajor: unknown range
        ToolMinor: unknown range
        Orientation: unknown range
        Distance: unknown range
        TiltX: unknown range
        TiltY: unknown range
        TrackingId: min=0, max=65535, flat=0, fuzz=0, resolution=0
        Slot: min=0, max=1, flat=0, fuzz=0, resolution=0
      Calibration:
        touch.size.calibration: none
        touch.pressure.calibration: none
        touch.orientation.calibration: none
        touch.distance.calibration: none
      SurfaceWidth: 1024px
      SurfaceHeight: 600px
      SurfaceOrientation: 0
      Translation and Scaling Factors:
        XScale: 0.451
        YScale: 0.793
        XPrecision: 2.216
        YPrecision: 1.262
        GeometricScale: 0.622
        PressureScale: 0.000
        SizeScale: 0.000
        OrientationCenter: 0.000
        OrientationScale: 0.000
        DistanceScale: 0.000
        HaveTilt: false
        TiltXCenter: 0.000
        TiltXScale: 0.000
        TiltYCenter: 0.000
        TiltYScale: 0.000
      Last Button State: 0x00000000
      Last Raw Touch: pointerCount=0
      Last Cooked Touch: pointerCount=0
      Pointer Gesture Detector:
        XMovementScale: 0.397
        YMovementScale: 0.397
        XZoomScale: 0.149
        YZoomScale: 0.149
        MaxSwipeWidth: 597.986755
  Device 3: NVEC lid switch button
    IsExternal: false
    Sources: 0x80000000
    KeyboardType: 0
  Device 4: NVEC power button
    IsExternal: false
    Sources: 0x00000101
    KeyboardType: 1
    Keyboard Input Mapper:
      Parameters:
        AssociatedDisplayId: -1
        OrientationAware: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 0
  Device 5: NVEC sleep button
    IsExternal: false
    Sources: 0x00000101
    KeyboardType: 1
    Keyboard Input Mapper:
      Parameters:
        AssociatedDisplayId: -1
        OrientationAware: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 0
  Device 6: nvec keyboard
    IsExternal: false
    Sources: 0x00000301
    KeyboardType: 2
    Keyboard Input Mapper:
      Parameters:
        AssociatedDisplayId: -1
        OrientationAware: false
      KeyboardType: 2
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 0
  Device 7: gpio-keys
    IsExternal: false
    Sources: 0x00000101
    KeyboardType: 1
    Keyboard Input Mapper:
      Parameters:
        AssociatedDisplayId: -1
        OrientationAware: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 0
  Configuration:
    ExcludedDeviceNames: [AVRCP, USB 2.0 Camera, USB Camera]
    VirtualKeyQuietTime: 0.0ms
    PointerVelocityControlParameters: scale=1.000, lowThreshold=500.000, highThreshold=3000.000, acceleration=3.000
    WheelVelocityControlParameters: scale=1.000, lowThreshold=15.000, highThreshold=50.000, acceleration=4.000
    PointerGesture:
      Enabled: true
      QuietInterval: 100.0ms
      DragMinSwitchSpeed: 50.0px/s
      TapInterval: 150.0ms
      TapDragInterval: 300.0ms
      TapSlop: 20.0px
      MultitouchSettleInterval: 100.0ms
      MultitouchMinDistance: 15.0px
      SwipeTransitionAngleCosine: 0.3
      SwipeMaxWidthRatio: 0.2
      MovementSpeedRatio: 0.8
      ZoomSpeedRatio: 0.3

Android keymaps

Наша клава работает с keycharmap и keylayout с названиями nvec_keyboard.kcm/kl Ссылки на текущие их версии ниже
https://github.com/zombah/android_device_toshiba_paz00-common/blob/98b71fbb08c4e7cd515d3d35bd5af475ff8de2db/keymaps/nvec_keyboard.kcm
https://github.com/zombah/android_device_toshiba_paz00-common/blob/98b71fbb08c4e7cd515d3d35bd5af475ff8de2db/keymaps/nvec_keyboard.kl

Вопросы

  • Нужно связать NVEC power button и NVEC lid switch с конфигами чтобы правильно сконфигурировать их события.
    • Как делать это, пока не очень понятно.
    • Может gpio-keys тут участвует, но как понять по девайсу на какой конфиг оно ссылается, я пока не понял
      • Как видно из вывода dumpsys кнопка питания использует дефолтный кеилайаут, что не есть верно, нужно к ней прицепить свой. Но как

это вопрос.

      • Свой лайоут тоже не помогает, видимо в нвеке нет uevent на долгое (2+ сек) нажатие кнопки питания. Функуция полного выключения реализована

аппаратно.



Info from Android 2.2

  • Getevent from android 2.2
add device 1: /dev/input/event3
  name:     "nvec ec_event"
add device 2: /dev/input/event1
  name:     "nvec mouse"
could not get driver version for /dev/input/mouse0, Not a typewriter
add device 3: /dev/input/event0
  name:     "nvec keyboard"
could not get driver version for /dev/input/mice, Not a typewriter
add device 4: /dev/input/event2
  name:     "USB Camera"
  • Getevent -p
getevent -p
add device 1: /dev/input/event3
  name:     "nvec ec_event"
  events:
    SYN (0000): 0000 
add device 2: /dev/input/event1
  name:     "nvec mouse"
  events:
    SYN (0000): 0000  0001  0002 
    KEY (0001): 0110  0111  0112 
    REL (0002): 0000  0001  0008 
could not get driver version for /dev/input/mouse0, Not a typewriter
add device 3: /dev/input/event0
  name:     "nvec keyboard"
  events:
    SYN (0000): 0000  0001 
    KEY (0001): 0000  0002  0003  0004  0005  0006  0007  0008 
                0009  000a  000b  000c  000d  000e  000f  0010 
                0011  0012  0013  0014  0015  0016  0017  0018 
                0019  001a  001b  001c  001d  001e  001f  0020 
                0021  0022  0023  0024  0025  0026  0027  0028 
                0029  002a  002b  002c  002d  002e  002f  0030 
                0031  0032  0033  0034  0035  0036  0037  0038 
                0039  003a  003b  003c  003d  003e  003f  0040 
                0041  0042  0043  0044  0047  0048  0049  004a 
                004b  004c  004d  004e  004f  0050  0051  0052 
                0053  0056  0057  0058  0061  0062  0063  0064 
                0066  0067  0068  0069  006a  006b  006c  006d 
                006e  006f  0071  0073  0074  007d  0086  008b 
                008e  009e  00c1  00ce  00d3  00d9  00df  01d0 
could not get driver version for /dev/input/mice, Not a typewriter
add device 4: /dev/input/event2
  name:     "USB Camera"
  events:
    SYN (0000): 0000  0001 
    KEY (0001): 00d4
  • Short press power button
/dev/input/event0: 0001 008e 00000001
/dev/input/event0: 0001 008e 00000000
    • Keylayout in android for this event
key 142   F24
  • Another short press on power button after first short
/dev/input/event0: 0001 0086 00000001
/dev/input/event0: 0001 0086 00000000
    • Keylayout in android for this event
key 134   LIDSWITCH_OFF     WAKE_DROPPED
  • Long press for >4sec on power button
/dev/input/event0: 0001 004a 00000001
/dev/input/event0: 0001 004a 00000000
    • Keylayout for this event
key 74    POWER_MENU
  • Close lid event, device go suspend after some delay
/dev/input/event0: 0001 00d3 00000001
/dev/input/event0: 0001 00d3 00000000
    • Keylayout for this event
key 211   LIDSWITCH_SUSPEND
  • dmesg after short press, device go susspend
<6>[  137.241963] request_suspend_state: sleep (0->3) at 1225738313152 (2012-12-14 12:27:55.025994288 UTC)
<6>[  137.248892]       BATTERY: stop battery query during suspend --->>>
<4>[  138.244033] stop_drawing_early_suspend: timeout waiting for userspace to stop drawing
<6>[  138.244087] notify_daemon: wait for nvrm_daemon
<6>[  138.244131] nvrm_notifier_show: returning with 'PM_DISPLAY_OFF'
<6>[  138.246388] nvrm_notifier_show: blocking
<6>[  138.551514] usbcore: deregistering interface driver rt2870
<4>[  138.551622] RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=ra0!
<4>[  138.815764] <--- rtusb exit
<4>[  149.174032] CPU1: Booted secondary processor
<7>[  149.174088] CPU0 attaching NULL sched-domain.
<7>[  149.233648] CPU0 attaching sched-domain:
<7>[  149.233657]  domain 0: span 0-1 level CPU
<7>[  149.233665]   groups: 0 1
<7>[  149.233679] CPU1 attaching sched-domain:
<7>[  149.233686]  domain 0: span 0-1 level CPU
<7>[  149.233693]   groups: 1 0
<7>[  151.098413] CPU0 attaching NULL sched-domain.
<7>[  151.098447] CPU1 attaching NULL sched-domain.
<7>[  151.213759] CPU0 attaching NULL sched-domain.
<5>[  151.214953] CPU1: clean shutdown
<4>[  162.984017] CPU1: Booted secondary processor
<7>[  162.984072] CPU0 attaching NULL sched-domain.
<7>[  163.033646] CPU0 attaching sched-domain:
<7>[  163.033655]  domain 0: span 0-1 level CPU
<7>[  163.033664]   groups: 0 1
<7>[  163.033678] CPU1 attaching sched-domain:
<7>[  163.033684]  domain 0: span 0-1 level CPU
<7>[  163.033691]   groups: 1 0
<6>[  167.603845] PM: Syncing filesystems ... 
<7>[  167.724386] CPU0 attaching NULL sched-domain.
<7>[  167.724423] CPU1 attaching NULL sched-domain.
<7>[  167.863792] CPU0 attaching NULL sched-domain.
<5>[  167.864902] CPU1: clean shutdown
<4>[  167.913925] done.
<6>[  167.939928] tegra_pm_notifier: start processing event=3
<6>[  167.950699] nvrm_notifier_show: returning with 'PM_SUSPEND_PREPARE'
<6>[  167.961686] notify_daemon: wait for nvrm_daemon
<4>[  168.289106] bt_usb0: resume
<4>[  168.300043] bt_usb0: not in suspend mode
<4>[  170.541467] bt_usb0: went to suspend (PM message: 0x0402)
<4>[  170.552044] bt_usb0: already suspended


  • Dmesg message of battery stat polling
<6>[   91.864004]       BATTERY: polling battery information! --->>>
<6>[  121.873858]       BATTERY: polling battery information! --->>>
<6>[  151.883798]       BATTERY: polling battery information! --->>>

Jellybean MR1 aka 4.2

Функциональные кнопки в CM

CM allows to use device specific key handler.