linux手动输入和触摸屏点击,linux触摸屏驱动编写

这篇文章主要介绍了linux

触摸屏驱动编写,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

早在诺基亚手机还比较流行的时候,那时候触摸屏用的还不多。但是随着触摸屏手机、即智能手机的流行,触摸屏基本成了手机的标配。所以,今天可以看看触摸屏驱动在linux上是如何进行的。

1、驱动目录

drivers/input

2、看看这个目录的Makefile如何设计

obj-(CONFIGINPUT)+=inputcore.oinputcorey:=input.oinputcompat.oinputmt.offcore.oobj

(CONFIG_INPUT) += input-core.o input-core-y := input.o

input-compat.o input-mt.o ff-core.o obj-" role="presentation"

style="box-sizing: border-box; outline: 0px; margin: 0px; padding:

0px; font-family: KaTeX_Main, "Times New Roman", serif; display:

inline; line-height: normal; font-size: 19.36px; word-spacing:

normal; word-wrap: break-word; white-space: nowrap; float: none;

direction: ltr; max-width: none; max-height: none; min-width: 0px;

min-height: 0px; border: 0px; position:

relative;">(CONFIGINPUT)+=input−core.oinput−core−y:=input.oinput−compat.oinput−mt.off−core.oobj−(CONFIG_INPUT) += input-core.o input-core-y := input.o

input-compat.o input-mt.o ff-core.o

obj-(CONFIGINPUT)+=input−core.oinput−core−y:=input.oinput−compat.oinput−mt.off−core.oobj−(CONFIG_INPUT_TOUCHSCREEN)

+= touchscreen/

3、除了input-core.o这个文件外,只需要看touchscreen目录就可以了

config TOUCHSCREEN_S3C2410 tristate “Samsung S3C2410/generic

touchscreen input driver” depends on ARCH_S3C24XX || SAMSUNG_DEV_TS

depends on S3C_ADC help Say Y here if you have the s3c2410

touchscreen. If unsure, say N. To compile this driver as a module,

choose M here: the module will be called s3c2410_ts.

4、看懂了Kconfig之后,再阅读Makefile,注意S3C_ADC宏可以参考arch/arm/plat-samsung/adc.c

obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o

5、继续阅读s3c2410_ts.c文件

static const struct platform_device_id s3cts_driver_ids[] = { {

“s3c2410-ts”, 0 }, { “s3c2440-ts”, 0 }, { “s3c64xx-ts”,

FEAT_PEN_IRQ }, { } }; MODULE_DEVICE_TABLE(platform,

s3cts_driver_ids); static struct platform_driver s3c_ts_driver = {

.driver = { .name = “samsung-ts”, #ifdef CONFIG_PM .pm =

&s3c_ts_pmops, #endif }, .id_table = s3cts_driver_ids, .probe =

s3c2410ts_probe, .remove = s3c2410ts_remove, };

module_platform_driver(s3c_ts_driver);

6、根据probe函数,看看有什么需要注意的内容搜索引擎大全

ts.client = s3c_adc_register(pdev, s3c24xx_ts_select,

s3c24xx_ts_conversion, 1); if (IS_ERR(ts.client)) { dev_err(dev,

“failed to register adc client\n”); ret = PTR_ERR(ts.client); goto

err_iomap; }

7、接着,查看是否有中断函数被注册

ret =

request_irq(ts.irq_tc, stylus_irq, 0, “s3c2410_ts_pen”,

ts.input);

8、最后

很明显,触摸屏驱动本质上还是由TOUCHSCREEN_S3C2410和S3C_ADC两个macro一起完成的。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值