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;
  • 相关阅读:
    一行代码搞定Dubbo接口调用
    测试周期内测试进度报告规范
    jq 一个强悍的json格式化查看工具
    浅析Docker容器的应用场景
    HDU 4432 Sum of divisors (水题,进制转换)
    HDU 4431 Mahjong (DFS,暴力枚举,剪枝)
    CodeForces 589B Layer Cake (暴力)
    CodeForces 589J Cleaner Robot (DFS,或BFS)
    CodeForces 589I Lottery (暴力,水题)
    CodeForces 589D Boulevard (数学,相遇)
  • 原文地址:https://www.cnblogs.com/feiwatson/p/9478208.html
Copyright © 2011-2022 走看看