Writing Touchscreen calibration utility

Sergei Mutovkin msergei at gmail.com
Wed Sep 15 14:29:48 PDT 2004


On Wed, 15 Sep 2004 16:57:15 -0400, Tristan Van Berkom
<vantr at touchtunes.com> wrote:

> If its any help, you might want to look at this fix:
>      http://bugs.xfree86.org/show_bug.cgi?id=1332
> 
> I'll be sending that patch to xorg bugzilla as soon as I get the
> chance to look at the xorg code.


Tristan,

thank you for the reply.
I originally had a problem when I was creating ncurses based
calibration utility that I was receiving 8 bytes in a chunk and then
next 2... Well since ELO is sending 10 bytes packets, I decided to
modify code a bit to make it look approximately like (this is sniplet
from my calibration utility):

        if ((fd = open(device, O_RDWR | O_NOCTTY ,0 )) < 0 )
        {
                perror(device);
                Error("Unable to open Elographics touchscreen device",TRUE);
        }

and then later

        /* Configuration of the serial port to operate with touchscreen */
        struct termios termios_tty;
        int tty_result;

        memset (&termios_tty,0,sizeof(termios_tty));

        //Hdw. Control Modes:     9600kbps         8bit  Recv   
Ignore Modem Status Lines
        termios_tty.c_cflag     = ELO_LINK_SPEED | CS8 | CREAD | CLOCAL ;

        //Special Control Characters (Non-canonical mode)
        //MIN Value (Minimum characters to 'read' before 'read' returns)
        termios_tty.c_cc[VMIN]  = 10;            /* blocking read
until 1 character arrives */
        termios_tty.c_cc[VTIME] = 0;
        termios_tty.c_iflag = IGNPAR;
        termios_tty.c_oflag = 0;
        /* set input mode (non-canonical, no echo,...) */
        termios_tty.c_lflag = 0;

        tcflush(fd, TCIFLUSH);
        tty_result = tcsetattr(fd,TCSANOW,&termios_tty);
        if (tty_result < 0)
        {
                Error("Unable to configure Elographics touchscreen port",TRUE);
        }

This made it work appropriately. But I still don't understand how the
original driver works with the its code... Only when I changed to VMIN
from 1 to 10 my application started reading all the input. Though I
didn't think of "select" idea.

I'm somewhat unclear on the latter part of your message since I'm
somewhat unexperienced with pipes (only whatever I did during my
university years)...

Thank you again,
Sergei

P.S. How should I reply correctly to messages in ML? Should I say
"Reply All" or "Reply" and then put "xorg at freedesktop.org" address?



More information about the xorg mailing list