android 触摸屏路径,android 是如何找到触摸屏设备节点

1.触摸屏属于input设备,住、主设备号是固定是13,但是次设备号,应该不是固定。

2.android会遍历/dev/input, 进行ioctl,读取设备的信息,来判断是不是触摸屏设备。

位置frameworks/base/services/input/EventHub.cpp

status_t EventHub::openDeviceLocked(const char *devicePath)

// Figure out the kinds of events the device reports.读取设备的信息

ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(device->keyBitmask)), device->keyBitmask);

ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(device->absBitmask)), device->absBitmask);

ioctl(fd, EVIOCGBIT(EV_REL, sizeof(device->relBitmask)), device->relBitmask);

ioctl(fd, EVIOCGBIT(EV_SW, sizeof(device->swBitmask)), device->swBitmask);

ioctl(fd, EVIOCGBIT(EV_LED, sizeof(device->ledBitmask)), device->ledBitmask);

ioctl(fd, EVIOCGBIT(EV_FF, sizeof(device->ffBitmask)), device->ffBitmask);

ioctl(fd, EVIOCGPROP(sizeof(device->propBitmask)), device->propBitmask);

内核实现的ioctl

omap/drivers/input/evdev.c

static int handle_eviocgbit(struct input_dev *dev,

unsigned int type, unsigned int size,

void __user *p, int compat_mode)

drivers/input/touchscreen/wacom_w8001.c

static int w8001_setup(struct w8001 *w8001)

input_set_abs_params(dev, ABS_MT_POSITION_X,

0, touch.x, 0, 0);

input_set_abs_params(dev, ABS_MT_POSITION_Y,

0, touch.y, 0, 0);

input_set_abs_params(dev, ABS_MT_TOOL_TYPE,

0, MT_TOOL_MAX, 0, 0);

cat /proc/bus/input/devices 可以看input设备的属性。

getevent  /dev/input/event0 可以看触摸屏的坐标数据。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值