nanogui: Interfacing problem: How do I connect my touchscreen driver to nano-X?


Previous by date: 18 Jul 2007 08:18:31 +0100 Re: client/server nano-x howto ??, aLUNZ
Next by date: 18 Jul 2007 08:18:31 +0100 Nano WM, Rowan Maclachlan
Previous in thread: 18 Jul 2007 08:18:31 +0100 Re: Interfacing problem: How do I connect my touchscreen driver to nano-X?, Robin Clark
Next in thread: 18 Jul 2007 08:18:31 +0100 Re: Interfacing problem: How do I connect my touchscreen driver to nano-X?, Greg Haerr

Subject: AW: [nanogui] Interfacing problem: How do I connect my touchscreen driver to nano-X?
From: "Wein, Peter \(ext\)" ####@####.####
Date: 18 Jul 2007 08:18:31 +0100
Message-Id: <0C9BD57BDE7F5947B6E8AF9C655EBD99CAD945@khes0e1a.ww001.siemens.net>

Thank you both and to all the others who gave me tips! It did work very well for me.

But how can I turn on/off the mouse pointer if I use mou_toucscreen.c?
And how can I optionally compile Nano-X, so that I can use a USB-Mouse as well.
If I turn on the option GPMOUSE the makefile starts to complain about too much mice in the system (my touch and my USB!). How can I handle this?

Calibration with nxcal:
I do not see where nxcal.dat is handled by nano-X! I am using the latest Nano-X full tar ball v0.91. 

And last but not least:
Does anybody know if I have to lock my data while processing in my workqueue task?
I am asking, cause the read function of the mouse is using some ring structure data from my touch device, which is processed in my workqueue task , sheduled by my interrupt handler. And by coincidence: could it be, that my read function is trying to copy some data to the user space while the workqueue task is still processing (it sleeps after writing every meausurement to the ring structure for 10 ms. It works and measures as long as the pressure is big enough)? Or is the workqueue task capable of sleeping but works its instruction atomically without being interrupted, for example by my read function (both functions are situated in the same driver( process, task, thread(?))?


Here is the locking algorithm which probably could work  very well with only one integer value instead of a structure (cause i++ should work in atomic mode).

In the workqueue task of my touch driver:
...
while(atomic_read(&lock)){
	msleep(10);
}
atomic_inc(&lock);
tp_ev_ring[inwert].x = tp_ev.x;
tp_ev_ring[inwert].y = tp_ev.y;   
tp_ev_ring[inwert++].pressure = 1;
inwert &= 0x3f;
atomic_dec(&lock);
msleep(10);
...

In the read function of my touch driver

...
if(inwert!=outwert&&!atomic_read(&lock)){
	atomic_inc(&lock);
	memcpy(&tp_last,&tp_ev_ring[outwert],sizeof(struct tp_event));
	outwert++;
	outwert &= 0x3F;
	atomic_dec(&lock);
	if(!copy_to_user (tpstruct,&tp_last,sizeof(struct tp_event))){
		return sizeof(struct tp_event);
	}
}
...

It would be very nice if you could help me out once more, cause I am late on my schedule.
Thanks in advance

Regards
Peter


-----Ursprüngliche Nachricht-----
Von: Robin Clark ####@####.#### 
Gesendet: Mittwoch, 4. Juli 2007 10:26
An: Laine Walker-Avina; Wein, Peter (ext)
Cc: ####@####.####
Betreff: Re: [nanogui] Interfacing problem: How do I connect my touchscreen driver to nano-X?

Look for where the mouse driver is read from in the gui you are using.
Then use your driver to send the 'C' stucture for X,Y and P (pressure)
back up to nano-X.

You may have to decide when an end of press has occurred, and send back a P==0
packet to indicate a 'release' event (which most nano-X widgets respond to anyway).

And dont forget to allow the touch screen to settle. The first few milliseconds will always
be wrong in a press because of capacitive effects in the touchscreen and wiring to it.

The readings are pretty noisy anyway and you need to average what you consider to be 'good' or consistent 
presses (perhaps 10 to every one sent up). This averaging should be done in the driver.
Nano X does some of its own averaging on what it gets too.

Also the raw adc readings from the 7846 need to be translated into screen coordinates. Look at
nxcal (it also irons out distortions to a certain extent). This builds a simultaneous equation
solver matrix and applies it to the raw ADC readings to give you screen coordinates. Nano-X
does this so your driver only needs to send the raw readings.
nxcal can also 'flip' the screen for you.

Robin


----- Original Message ----
From: Laine Walker-Avina ####@####.####
To: "Wein, Peter ((ext))" ####@####.####
Cc: ####@####.####
Sent: Tuesday, 3 July, 2007 5:35:18 PM
Subject: Re: [nanogui] Interfacing problem: How do I connect my touchscreen driver to nano-X? 


On Jul 02, 2007, at 06:02, Wein, Peter ((ext)) wrote:

> Hi all,
>
> I am new here and I need your help! I have recently written my SPI  
> driver for connecting my touch panel controller ADS7846n to the  
> kernel on my ARM9-Board (NS 9360). Because printing of x and y  
> coordinates  on my debug screen is very boring and does not help  
> on, I am now looking for the interface to connect it to the (nano)- 
> X-Server. Actually I did not find enough useful info on the www.  
> Can anybody of you give me a hint where to look? In which form do I  
> have to present my open, read and write functionality for the  
> server? Which are the arguments? And in which way do I have to  
> modify what config file...
>
> I appreciate any hints.
>
>
> Mit freundlichen Grüßen
>
> Peter Wein

The generic touch screen driver in drivers/mou_touchscreen.c will  
probably work for you. If your kernel driver uses the /dev/ts device  
file, then you may just be able to use one of the available  
touchscreen modes. Look at the headers in devices/touchscreen_*.h to  
see how they work.

-Laine
---------------------------------------------------------------------
To unsubscribe, e-mail: ####@####.####
For additional commands, e-mail: ####@####.####






      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 

Previous by date: 18 Jul 2007 08:18:31 +0100 Re: client/server nano-x howto ??, aLUNZ
Next by date: 18 Jul 2007 08:18:31 +0100 Nano WM, Rowan Maclachlan
Previous in thread: 18 Jul 2007 08:18:31 +0100 Re: Interfacing problem: How do I connect my touchscreen driver to nano-X?, Robin Clark
Next in thread: 18 Jul 2007 08:18:31 +0100 Re: Interfacing problem: How do I connect my touchscreen driver to nano-X?, Greg Haerr


Powered by ezmlm-browse 0.20.