还剩4页未读,继续阅读
文本内容:
Linuxserialtouch设计总结概述最近在做嵌入式linux下串口触摸屏设计遇到一些问题经过查找资料和请教同事总算把问题解决了事后有把linux相关地内核代码仔细看了一遍为了有点成果特别写了个总结.如有任何问题请联系yxj_5421@
163.com转载请标明出处.系统资源Linux
2.
6.36UI QT+TSLIB硬件资源不关心设计方法有两种实现途径.是将要使用地串口单独拿出来作为一个platform总线设备实现在嵌入式平台mach文件里面加上串口中断号和寄存器首地址然后将这个串口注册成一个platform总线设备.在驱动probe函数里面需要得到这个串口中断号以及寄存器映射地址通过寄存器映射地址设置串口波特率数据位停止位等通过中断号注册中断等然后调用input_register_device注册一个input设备.在中断里面得到外面触摸屏地数据然后根据inputtouch协议上报触摸数据.这种方法实现简单明了不需要和linux地ttyserio等打交道.但是要求知道串口硬件spec比如寄存器等而且这个串口就只能给触摸屏使用了不能作为tty使用.因为是嵌入式开发因此很容易知道硬件spec而且嵌入式平台一旦确定那么这个串口肯定就是给触摸屏使用了.因此在嵌入式平台上推荐使用这个方法.是将串口作为一个serio总线设备利用linux内核提供serio总线驱动通过设置对应地串口调用serport提供地函数将串口当做serio总线设备在驱动里面需要按照serio总线设备驱动地框架来实现这方面地例子linux里面有很多比如touchright.c在模块init函数里面调用serio_register_driver注册serio总线设备驱动如果serio总线上对应地serio设备存在就调用connect函数在这个函数里面调用input_register_device注册一个input设备.具体驱动不再分析了很简单相信各位都能看地懂.至此两种方法都实现了串口触摸屏地驱动讲到这里是不是就完了非也本文地重点还在后面请看下面分析第一种方法只要驱动模块被加载就会在/dev/input下面创建一个eventx节点tslib就能访问这个节点获得触摸...。