转自:http://blog.chinaunix.net/uid-28320320-id-3389196.html
1、参考文章 【Andorid】input系统的事件处理 2、源码分析 linux 3.6.3 1)查看linux-3.6.3/drivers/input下Makefile 点击(此处)折叠或打开 obj-$(CONFIG_INPUT) += input-core.o input-core-y := input.o input-compat.o input-mt.o ff-core.o 2)查看文件input.c 点击(此处)折叠或打开 /* input subsystem entry */ subsys_initcall(input_init); module_exit(input_exit); 3)input.c搞啥子 点击(此处)折叠或打开 /* sysfs/procfs/devfs show */ |-----------| | / | err = class_register(&input_class); | |-----------| | / | err = input_proc_init(); | |-----------| | / | err = register_chrdev(INPUT_MAJOR, "input", &input_fops); 根据下面的方法,发现手机的tp 对应event1 点击(此处)折叠或打开 # getevent add device 1: /dev/input/event0 name: "fluid-keypad" add device 2: /dev/input/event3 name: "7k_handset" add device 3: /dev/input/event2 name: "sensors" add device 4: /dev/input/event1 name: "Synaptics RMI4" # pwd /sys/class/input # ls event0 event1 event2 event3 input0 input1 input2 input3 # cat /proc/bus/input/devices I: Bus=0019 Vendor=0001 Product=0001 Version=0001 N: Name="fluid-keypad" P: Phys=fluid-keypad/input0 S: Sysfs=/devices/i2c-6/6-0000/pm8058-keypad/input/input0 U: Uniq= H: Handlers=kbd event0 B: EV=13 B: KEY=1200000 0 0 c0000 0 0 0 B: MSC=10 I: Bus=0000 Vendor=0000 Product=0000 Version=0000 N: Name="Synaptics RMI4" P: Phys=Synaptics_rmi S: Sysfs=/devices/virtual/input/input1 U: Uniq= H: Handlers=event1 B: EV=b B: KEY=400 0 0 0 2000000 0 40000800 40 0 0 0 B: ABS=770000 11030003 I: Bus=0018 Vendor=0003 Product=0000 Version=0000 N: Name="sensors" P: Phys= S: Sysfs=/devices/virtual/input/input2 U: Uniq= H: Handlers=event2 B: EV=9 B: ABS=8000 20304bf I: Bus=0000 Vendor=0001 Product=0001 Version=0001 N: Name="7k_handset" P: Phys= S: Sysfs=/devices/virtual/input/input3 U: Uniq= H: Handlers=kbd event3 B: EV=23 B: KEY=4 0 28 0 1c0800 0 0 0 B: SW=4 4)touch panel驱动源码 点击(此处)折叠或打开 #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/platform_device.h> #include <linux/i2c.h> #include <linux/input.h> #include "gsl1680.h" #define gsl_pr(fmt, arg...) printk(KERN_ERR "[GSL]%s: 33[32m" fmt "