Trolltech Home | Qtopia-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qtopia-interest Archive, April 2007
Touch screen problem (Qtopia 4.2.2)


Message 1 in thread

Hi,

I'm writing a plugin for a touchscreen.
With my driver, I can move the mouse pointer with touch panel,
but when I press the panel, Qtopia only move the pointer and
doesn't simulate mouse button click.

How can I solve the problem?

Thanks.

Francesco.

P.S. This is the source code of read function:

void QWSTS2005FMouseHandlerPrivate::readMouseData()
{
    uchar  _buffer[5];   // pacchetto di 5 byte letti


    if (connected = false)  // se il touchscreen non è connesso
       return;  // esco

    // leggo il pacchetto ricevuto
    if (read(fd_serial, _buffer, 5) <= 0) // se c'e' stato un errore in
           	return;  // esco

    // controllo se e' stato premuto il touch panel
    //
    //   bit:  7  6  5  4  3  2  1  0
    // byte1:  1  0  TP 0  0  0  0  0
    // se TP=1 (byte1 = A0) il touchscreen è stato premuto
    // se TP=0 (byte1 = 80) il touchscreen non è stato premuto
    if (_buffer[0] & 0xA0) {
       // calcolo le coordinate del punto di pressione
       //
       //   bit:  7  6  5  4  3  2  1  0
       // byte2:  0  0  0  0  x9 x8 x7 x6
       // byte3:  0  0  x5 x4 x3 x2 x1 x0
       // byte4:  0  0  0  0  y9 y8 y7 y6
       // byte5:  0  0  y5 y4 y3 y2 y1 y0
       position.setX((int)_buffer[1] * 64 + (int)_buffer[2]);
       position.setY((int)_buffer[3] * 64 + (int)_buffer[4]);
       handler->mouseChanged(position, Qt::LeftButton);
    }
    else {
       handler->mouseChanged(position, Qt::NoButton);
    }
}

--
 [ signature omitted ] 

Message 2 in thread

I find my problem...

It's my fault:

I replace this line:

	if (_buffer[0] & 0xA0)

with this

	if (_buffer[0] == 0xA0)

Thanks.

Francesco.

Ing. Francesco Carsana wrote:
> Hi,
> 
> I'm writing a plugin for a touchscreen.
> With my driver, I can move the mouse pointer with touch panel,
> but when I press the panel, Qtopia only move the pointer and
> doesn't simulate mouse button click.
> 
> How can I solve the problem?
> 
> Thanks.
> 
> Francesco.
> 
> P.S. This is the source code of read function:
> 
> void QWSTS2005FMouseHandlerPrivate::readMouseData()
> {
>    uchar  _buffer[5];   // pacchetto di 5 byte letti
> 
> 
>    if (connected = false)  // se il touchscreen non à connesso
>       return;  // esco
> 
>    // leggo il pacchetto ricevuto
>    if (read(fd_serial, _buffer, 5) <= 0) // se c'e' stato un errore in
>               return;  // esco
> 
>    // controllo se e' stato premuto il touch panel
>    //
>    //   bit:  7  6  5  4  3  2  1  0
>    // byte1:  1  0  TP 0  0  0  0  0
>    // se TP=1 (byte1 = A0) il touchscreen à stato premuto
>    // se TP=0 (byte1 = 80) il touchscreen non à stato premuto
>    if (_buffer[0] & 0xA0) {
>       // calcolo le coordinate del punto di pressione
>       //
>       //   bit:  7  6  5  4  3  2  1  0
>       // byte2:  0  0  0  0  x9 x8 x7 x6
>       // byte3:  0  0  x5 x4 x3 x2 x1 x0
>       // byte4:  0  0  0  0  y9 y8 y7 y6
>       // byte5:  0  0  y5 y4 y3 y2 y1 y0
>       position.setX((int)_buffer[1] * 64 + (int)_buffer[2]);
>       position.setY((int)_buffer[3] * 64 + (int)_buffer[4]);
>       handler->mouseChanged(position, Qt::LeftButton);
>    }
>    else {
>       handler->mouseChanged(position, Qt::NoButton);
>    }
> }
> 

--
 [ signature omitted ]