Hi,

the usbtouchscreen driver as included in kernel 2.6.19 almost works with
 the itm based touchscreen that I have (an LG L1730SF).

I reported earlier that the screen does not provide valid x and y values
when the screen is not touched and the driver was modified (see return
of function itm_read_data) to not use these values.

The problem however is that when itm_read_data returns 0 (when the
screen is not touched), the generic part (usbtouch_process_pkt) returns
without updating the BTN_TOUCH status.

So in short, when using an itm screen the driver never sends BTN_TOUCH
with a zero value.

The attached patch causes the itm driver to remember valid x and y
values and send the last valid ones when the screen is not touched. I am
not sure if this is the best approach, but I did not want to mess with
the generic driver part.

regards
jp

diff usbtouchscreen.orig.c usbtouchscreen.c
--- usbtouchscreen.orig.c       2006-12-08 11:24:13.000000000 +0200
+++ usbtouchscreen.c    2006-12-08 10:34:54.000000000 +0200
@@ -254,12 +254,21 @@
 #ifdef CONFIG_USB_TOUCHSCREEN_ITM
 static int itm_read_data(unsigned char *pkt, int *x, int *y, int
*touch, int *press)
 {
-       *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F);
-       *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F);
-       *press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F);
+       static int validx = 0;
+       static int validy = 0;
+
        *touch = ~pkt[7] & 0x20;
+       *press = ((pkt[2] & 0x01) << 7) | (pkt[5] & 0x7F);

-       return *touch;
+       if (*touch) {
+               validx = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F);
+               validy = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F);
+       }
+
+       *x = validx;
+       *y = validy;
+
+       return 1;
 }
 #endif

-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
 
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
 
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 
 
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
[EMAIL PROTECTED]


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to