zoukankan      html  css  js  c++  java
  • 树莓派 -- 输入设备驱动 (key) 续1

    测试
    安装 input-utils

    pi@raspberrypi:~ $ sudo apt-get install input-utils
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following NEW packages will be installed:
      input-utils
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 14.9 kB of archives.
    After this operation, 60.4 kB of additional disk space will be used.
    Get:1 http://mirrors.shu.edu.cn/raspbian/raspbian stretch/main armhf input-utils armhf 1.0-1.1 [14.9 kB]
    Fetched 14.9 kB in 1min 20s (183 B/s)                  
    Selecting previously unselected package input-utils.
    (Reading database ... 124722 files and directories currently installed.)
    Preparing to unpack .../input-utils_1.0-1.1_armhf.deb ...
    Unpacking input-utils (1.0-1.1) ...
    Setting up input-utils (1.0-1.1) ...
    Processing triggers for man-db (2.7.6.1-2) ...
    pi@raspberrypi:~ $ 

    lsinput

    /dev/input/event0
       bustype : BUS_HOST
       vendor  : 0x1
       product : 0x1
       version : 256
       name    : "gpio_keys"
       phys    : "gpio-keys/input0"
       bits ev : EV_SYN EV_KEY

    input-events. 如果没有键按下,timeout

    pi@raspberrypi:~ $ input-events 0
    /dev/input/event0
       bustype : BUS_HOST
       vendor  : 0x1
       product : 0x1
       version : 256
       name    : "gpio_keys"
       phys    : "gpio-keys/input0"
       bits ev : EV_SYN EV_KEY
    
    waiting for events
    timeout, quitting

    如果有键按下, 这里的key值是dts中定义的 linux,code = <100>;

    pi@raspberrypi:~ $ input-events 0
    /dev/input/event0
       bustype : BUS_HOST
       vendor  : 0x1
       product : 0x1
       version : 256
       name    : "gpio_keys"
       phys    : "gpio-keys/input0"
       bits ev : EV_SYN EV_KEY EV_REP
    
    waiting for events
    13:59:42.712941: EV_KEY KEY_RIGHTALT (0x64) pressed
    13:59:42.712941: EV_SYN code=0 value=1

    注: 上一篇中的dts中gpio-keys的部分需要加上

    autorepeat;
  • 相关阅读:
    HDMI介绍与流程
    HDMI热插拔检测原理
    在AES标准规范中,分组长度、密钥长度的关系
    WORD-每5行添加一个行号
    FreeRTOS 调试方法(printf---打印任务执行情况)
    SELinux深入理解
    一文彻底明白linux中的selinux到底是什么
    云锵投资 2020 年 06 月简报
    ubuntu16.04 安装opencv-2.4.9
    Windows高DPI系列控件(二)
  • 原文地址:https://www.cnblogs.com/feiwatson/p/9478208.html
Copyright © 2011-2022 走看看