求助,USB触摸屏驱动初始化有时会自动飞到右上角或右下角

内核编译和嵌入式产品的设计与开发
回复
mianhuacar
帖子: 6
注册时间: 2014-10-14 14:44
系统: XP

求助,USB触摸屏驱动初始化有时会自动飞到右上角或右下角

#1

帖子 mianhuacar » 2014-10-14 15:45

最近在做一个USB触摸屏的ubuntu驱动,由于自己不懂驱动,所以经历了好长时,百度了无数资料后,才终于让触摸屏勉强用起来,但有很严重的问题。
问题:
第一次接上USB的时间必定会出现错误提示“___proc pkg error___”,这个错误由函数my_ts_proc_pkg给出,它判断读取到的数据dma_buf[0]!=3时就会给出这个错误。只要出现这个错误,鼠标指针就会自动飞到右上角或右下角,大多数会飞到右上角。然后touch触摸屏,my_ts_proc_pkg这个函数不会再有错误提示,但可以正常读取到坐标数据并上报,但鼠标仍然会锁定到右上角或右下角。只要触摸一下,鼠标瞬间飞到触摸的坐标,但马上会飞回去右上角或右下角。
断开USB连接后,USB鼠标可以动,但整个系统环境会无响应一段时间,这段时间的长短和我摸触摸屏的时间有关。
再次连接USB,有可能不再出现“___proc pkg error___”,触摸正常,此时断开触摸屏也不会导致系统无响应。
断开USB一段时间后,再连接又会出现上面的问题。

想了很久都不明白为什么只要出现错误提示“___proc pkg error___”,后来不再出错也会导致触摸屏不正常。我也做了很多尝试,特别是把上报坐标的命令去掉了,只要出现这个错误就会把鼠标飞到右上角或右下角。
特别特别不明白,为什么我不上报坐标,鼠标也会飞走呢?请各位帮忙解救一下,我已经为了这个吃不饱,睡不好了。 :em18

附件是我的驱动文件。

下面是第一次连接,必定出错的printk信息:

Oct 14 15:09:43 my-Satellite-C600 kernel: [ 3554.971401] usbcore: registered new interface driver mytouch
Oct 14 15:09:49 my-Satellite-C600 kernel: [ 3561.246969] usb 2-1.1: new full-speed USB device number 10 using ehci-pci
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.419071] usb 2-1.1: New USB device found, idVendor=0306, idProduct=ff3f
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.419079] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.419084] usb 2-1.1: Product: VTL HID Digitizer
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.419089] usb 2-1.1: Manufacturer: VTL
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.459556] ___my_ts_probe(462)___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.462526] ___my_ts_get_input_endpoint(431)___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.465335] ___endpoint num = 2___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.468013] ___my_ts_get_output_endpoint(446)___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.470823] input: mytouch as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input29
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.574716] ______write CMD1______
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.574865] write_end~~~
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.575416] ___my_ts_ep_out_handler(333)___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.575418] ___write data len = 64,intaval time = 1,cmd = 1,status = 0___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.575419] just now mode_cmd going to read XY_CMD
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.575421] ___my_ts_read(146)___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.575448] read_end~~~
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.576538] ___my_ts_proc_pkg(172)___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.576540] ___proc pkg error___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.576543] dma_buf[0]=243,dma_buf[1]=40,dma_buf[2]=227,dma_buf[3]=128,dma_buf[4]=221,dma_buf[5]=95,dma_buf[6]=130,dma_buf[7]=253,dma_buf[8]=9
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.576544] ___read data len = 64,intaval time = 1,status = 0___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.576545] proc_pkg_err~~~
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.605040] ___probe end___
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.607757] input: VTL VTL HID Digitizer as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.1/input/input30
Oct 14 15:09:50 my-Satellite-C600 kernel: [ 3561.608011] input: VTL VTL HID Digitizer as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.2/input/input31
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.497558] ___my_ts_proc_pkg(172)___
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.500022] ___proc pkg OK___
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.502240] dma_buf[0]=3,dma_buf[1]=19,dma_buf[2]=20,dma_buf[3]=127,dma_buf[4]=9,dma_buf[5]=8,dma_buf[6]=8,dma_buf[7]=255,dma_buf[8]=255
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.504718] ___my_ts_report_xy_coord(199)___
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.507188] donw~~~~
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.509584] id = 1,status = 1,X = 9952,Y = 10720
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.521549] ___my_ts_proc_pkg(172)___
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.524175] ___proc pkg OK___
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.526724] dma_buf[0]=3,dma_buf[1]=19,dma_buf[2]=21,dma_buf[3]=112,dma_buf[4]=10,dma_buf[5]=8,dma_buf[6]=8,dma_buf[7]=255,dma_buf[8]=255
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.529584] ___my_ts_report_xy_coord(199)___
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.532476] donw~~~~
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.535370] id = 1,status = 2,X = 9952,Y = 10752
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.552552] ___my_ts_proc_pkg(172)___
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.555681] ___proc pkg OK___
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.558717] dma_buf[0]=3,dma_buf[1]=19,dma_buf[2]=21,dma_buf[3]=112,dma_buf[4]=11,dma_buf[5]=8,dma_buf[6]=8,dma_buf[7]=255,dma_buf[8]=255
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.562060] ___my_ts_report_xy_coord(199)___
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.565455] up~~~~
Oct 14 15:09:53 my-Satellite-C600 kernel: [ 3564.568864] id = 1,status = 3,X = 9952,Y = 10752
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.499624] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.506605] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.513577] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.523580] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.533600] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.543601] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.547803] usb 2-1.1: USB disconnect, device number 10
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.549430] my_ts_ep_in_handler - ESHUTDOWN
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.553022] my_ts_ep_in_handler - urb shutting down with status: -108
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.556584] usb 2-1.1: can't resubmit intr, 0000:00:1d.0-1.1/input0, status -19
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.556636] ___my_ts_disconnect(410)___
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.563611] usb 2-1.1: can't resubmit intr, 0000:00:1d.0-1.1/input0, status -19
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.630919] ___disconnet free___
Oct 14 15:10:00 my-Satellite-C600 kernel: [ 3571.634469] ___disconnet end___

下面是不出错的printk信息:

Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.062969] usb 2-1.1: new full-speed USB device number 12 using ehci-pci
Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.234943] usb 2-1.1: New USB device found, idVendor=0306, idProduct=ff3f
Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.234951] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.234957] usb 2-1.1: Product: VTL HID Digitizer
Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.234961] usb 2-1.1: Manufacturer: VTL
Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.274932] ___my_ts_probe(462)___
Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.277433] ___my_ts_get_input_endpoint(431)___
Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.279847] ___endpoint num = 2___
Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.282191] ___my_ts_get_output_endpoint(446)___
Oct 14 15:10:24 my-Satellite-C600 kernel: [ 3596.284631] input: mytouch as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input35
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.386730] ______write CMD1______
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.386874] write_end~~~
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.387416] ___my_ts_ep_out_handler(333)___
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.387419] ___write data len = 64,intaval time = 1,cmd = 1,status = 0___
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.387420] just now mode_cmd going to read XY_CMD
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.387421] ___my_ts_read(146)___
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.387449] read_end~~~
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.403133] ___probe end___
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.405703] input: VTL VTL HID Digitizer as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.1/input/input36
Oct 14 15:10:25 my-Satellite-C600 kernel: [ 3596.405903] input: VTL VTL HID Digitizer as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.2/input/input37
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.667558] ___my_ts_proc_pkg(172)___
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.670008] ___proc pkg OK___
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.672296] dma_buf[0]=3,dma_buf[1]=20,dma_buf[2]=21,dma_buf[3]=25,dma_buf[4]=9,dma_buf[5]=8,dma_buf[6]=8,dma_buf[7]=255,dma_buf[8]=255
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.674805] ___my_ts_report_xy_coord(199)___
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.677303] donw~~~~
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.679781] id = 1,status = 1,X = 10272,Y = 11040
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.698553] ___my_ts_proc_pkg(172)___
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.701182] ___proc pkg OK___
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.703582] dma_buf[0]=3,dma_buf[1]=20,dma_buf[2]=21,dma_buf[3]=25,dma_buf[4]=11,dma_buf[5]=8,dma_buf[6]=8,dma_buf[7]=255,dma_buf[8]=255
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.706119] ___my_ts_report_xy_coord(199)___
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.708630] up~~~~
Oct 14 15:10:27 my-Satellite-C600 kernel: [ 3598.711115] id = 1,status = 3,X = 10272,Y = 11040
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.423625] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.429581] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.435581] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.443577] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.451577] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.459601] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.467576] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.475577] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.483601] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.491577] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.499579] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.507577] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.515577] my_ts_ep_in_handler - nonzero urb status received: -71
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.520557] usb 2-1.1: USB disconnect, device number 12
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.521603] usb 2-1.1: can't resubmit intr, 0000:00:1d.0-1.1/input0, status -19
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.526528] my_ts_ep_in_handler - ESHUTDOWN
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.529356] my_ts_ep_in_handler - urb shutting down with status: -108
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.532222] usb 2-1.1: can't resubmit intr, 0000:00:1d.0-1.1/input0, status -19
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.532260] ___my_ts_disconnect(410)___
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.558866] ___disconnet free___
Oct 14 15:10:31 my-Satellite-C600 kernel: [ 3602.561704] ___disconnet end___
附件
mini.c
驱动源码
(15.34 KiB) 已下载 83 次
mianhuacar
帖子: 6
注册时间: 2014-10-14 14:44
系统: XP

Re: 求助,USB触摸屏驱动初始化有时会自动飞到右上角或右下角

#2

帖子 mianhuacar » 2014-10-15 10:54

真的请求各位路过的大侠帮帮忙,不求完全解决,能解析一下为什么不上报坐标也会飞到右上角或右下角,或者告诉小弟从哪里可以看到这个异常问题是执行了什么代码导致就可以了。
我们家做触摸屏的,如果能解决这个问题,送些触摸屏样品玩玩都没问题。
谢谢~
mianhuacar
帖子: 6
注册时间: 2014-10-14 14:44
系统: XP

Re: 求助,USB触摸屏驱动初始化有时会自动飞到右上角或右下角

#3

帖子 mianhuacar » 2014-10-17 8:19

坚持每天来顶一下,等待大侠出现
mianhuacar
帖子: 6
注册时间: 2014-10-14 14:44
系统: XP

Re: 求助,USB触摸屏驱动初始化有时会自动飞到右上角或右下角

#4

帖子 mianhuacar » 2014-10-22 14:06

还是没有大侠可以出手帮下忙吗? :em18
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 求助,USB触摸屏驱动初始化有时会自动飞到右上角或右下角

#5

帖子 eexpress » 2014-10-22 16:29

没人搞,就没人答。你这么可怜,去国外网站试试吧。
● 鸣学
mianhuacar
帖子: 6
注册时间: 2014-10-14 14:44
系统: XP

Re: 求助,USB触摸屏驱动初始化有时会自动飞到右上角或右下角

#6

帖子 mianhuacar » 2014-10-25 15:15

有一个新发现,即使不insmod自己写的触摸屏驱动,只要连上触摸屏,鼠标也会飞到右上角。难道是有其他驱动连接了触摸屏?

不insmod自己触摸屏驱动,连接触摸屏时,USB系统提示:
input: VTL VTL HID Digitizer as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.1/input/input30
input: VTL VTL HID Digitizer as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.2/input/input31
难道这个提示就是说被其他驱动连接了?

insmod自己触摸屏驱动,连接触摸屏时,USB系统提示:
input: mytouch as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input35
input: VTL VTL HID Digitizer as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.1/input/input36
input: VTL VTL HID Digitizer as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.2/input/input37

我还做了进一步试验,修改了内核的input.c文件,加上了硬件送数据给系统的debug信息,重编译了内核,看到不insmod自己触摸屏驱动,连接触摸屏时(此时鼠标也没有动),触摸屏竟然会送数据给系统:
___input_event___
type=1,code=272,value=1鼠标左键按下
___input_handle_event___
disposition=1处理
___input_event___
type=1,code=273,value=1鼠标右键按下
___input_handle_event___
disposition=1处理
___input_event___
type=1,code=274,value=0鼠标中键没按下
___input_handle_event___
disposition=0不处理
___input_event___
type=1,code=275,value=0鼠标侧键没按下
___input_handle_event___
disposition=0不处理
___input_event___
type=1,code=276,value=1鼠标前键按下
___input_handle_event___
disposition=1处理
___input_event___
type=2,code=0,value=40 X+40
___input_handle_event___
disposition=1处理
___input_event___
type=2,code=1,value=-29 Y-29
___input_handle_event___
disposition=1处理
___input_event___
type=2,code=8,value=-128滚轮-128
___input_handle_event___
disposition=1处理
___input_event___
type=0,code=0,value=0同步信息
___input_handle_event___
disposition=9提交
___input_pass_values___

如果insmod了自己驱动,且没有提示___proc pkg error___时,就没有上面那些奇怪的鼠标动作都是0,所有鼠标动作的disposition都是0

求解???
mianhuacar
帖子: 6
注册时间: 2014-10-14 14:44
系统: XP

Re: 求助,USB触摸屏驱动初始化有时会自动飞到右上角或右下角

#7

帖子 mianhuacar » 2014-11-14 17:12

我终于找到问题所在了,我那个触摸屏有三个interface,其中一个被我自己的驱动使用,另外两被usbmouse使用,因为实际上usbmouse不是合适的驱动,它不会正常接收数据,就一直上报右上角的坐标,所以就会飞到右上角了。
现在我重编了USB的内核,避免USBmouse驱动,可以解决飞右上角的问题了,可是出现新的奇怪问题:
就是在ctrl+F1的终端里正常,但按ctrl+F7回来后就不正常了,urb读取不到数据,请问有怎么解决呢?
回复