RK G-sensor 测试

G-sensor,全称为Accelerometer-sensor,是一种加速度传感器
G-sensor能够感知到加速力的变化,加速力就是当物体在加速过程中作用在物体上的力,
比如晃动、跌落、上升、下降等各种移动变化都能被G-sensor转化为电信号

一.dts 配置

1.1.正常加载

正常的加载 sensor
<4>[    2.978067] sensor_chip_init:stk8baxx_acc:devid=0x0,ops=0xc0e00474
<6>[    2.998169] input: stk8baxx_attr as /devices/virtual/input/input2
<6>[    2.998320] input: gsensor as /devices/ff160000.i2c/i2c-4/4-0018/input/input3
<4>[    2.998441] sensor_misc_device_register:miscdevice: mma8452_daemon
<4>[    2.998449] sensor_probe:initialized ok,sensor name:stk8baxx_acc,type:2,id=27
<4>[    2.998449]
<6>[    2.998478] sensor_init: Probe name sensors

错误的加载 sensor
<4>[    2.646424] sensor_chip_init:gs_stk8312:devid=0x0,ops=0xc0bf44b0
<4>[    2.646944] sensor_initial:fail to init sensor
<4>[    2.646952] sensor_chip_init:fail to init sensor
<3>[    2.646960] i2c i2c-4: sensor_probe failed -11
<3>[    2.646960]
<4>[    2.646975] sensors: probe of 4-003d failed with error -11
<6>[    2.646994] sensor_init: Probe name sensors
<4>[    2.647010] sensor-dev.c v1.4 add angle calculation support between two gsensors 2013-09-01

1.2.getevent  查看数据读取

getevent -p
add device 1: /dev/input/event5
  name:     "PixArt USB Optical Mouse"
  events:
    KEY (0001): 0110  0111  0112
    REL (0002): 0000  0001  0008
    MSC (0004): 0004
  input props:
    <none>
add device 2: /dev/input/event2
  name:     "stk8baxx_attr"
  events:
  input props:
    <none>
add device 3: /dev/input/event3
  name:     "gsensor"
  events:
    ABS (0003): 0000  : value 62496, min -2000000, max 2000000, fuzz 0, flat 0, resolution 0
                0001  : value -7812, min -2000000, max 2000000, fuzz 0, flat 0, resolution 0
                0002  : value 941346, min -2000000, max 2000000, fuzz 0, flat 0, resolution 0
  input props:
    <none>
add device 4: /dev/input/event1
  name:     "rk29-keypad"
  events:
    KEY (0001): 0072  0073  0074  008f
  input props:
    <none>
add device 5: /dev/input/event4
  name:     "rockchip_headset.32"
  events:
    KEY (0001): 00e2
  input props:
    <none>
add device 6: /dev/input/event0
  name:     "rkxx-remotectl"
  events:
    KEY (0001): 0002  0003  0004  0005  0006  0007  0008  0009
                000a  000b  001c  0040  0042  0058  0066  0067
                0069  006a  006c  0071  0072  0073  0074  008b
                008f  0092  009e  00a3  00a5  00ac  00b7  00b9
                00ba  00bb  00bc  00d9  00e8  00f8  0175  0183
                0184  0190  0191  0192
  input props:
    <none>

1.3.android   SensorManager onSensorChanged

https://www.runoob.com/w3cnote/android-tutorial-sensor3.html 

  

原文地址:https://www.cnblogs.com/crushgirl/p/14528245.html