nanogui: touchscreen calibration


Previous by date: 22 Mar 2002 08:23:25 -0000 Re: Debug microwindow: nxclient:Corrupted packet, ShingYuen Wong
Next by date: 22 Mar 2002 08:23:25 -0000 "Keyboard Initialize Error" when using on X11?, "SangBaek Lee(=?EUC-KR?B?wMy787np?=)"
Previous in thread: 22 Mar 2002 08:23:25 -0000 Re: touchscreen calibration, Alex Holden
Next in thread: 22 Mar 2002 08:23:25 -0000 Touch screen calibration, Gabriel Goldstein

Subject: RE: [nanogui] touchscreen calibration
From: Henry Chea ####@####.####
Date: 22 Mar 2002 08:23:25 -0000
Message-Id: <ED968F412990DE4080ADEC412897784907C6B7@gotz-fs1.semcon.se>

Alex & others,

Sorry I didn't get a chance to edit the ADS touchscreen driver earlier.  But
the hardware I was working on has just gotten shipped away, so I am no
longer able to work on adding the new calibration scheme to the driver.
Does anybody else have an ADS Graphicsmaster platform they're willing to
continue the development with?  If so, perhaps I can help point you in the
right direction.

Cheers,
//Henry Chea
Semcon Sweden AB

-----Original Message-----
From: Alex Holden
To: Henry Chea
Cc: ####@####.####
Sent: 3/13/2002 1:01 PM
Subject: Re: [nanogui] touchscreen calibration

Henry Chea wrote:
> In mou_ads.c I am editing PD_SetCalibration() because it seems there
is no
> SetCalibration() function in this file.

That's right.

>         case 5: 
>            res_x = arg; 
>            break; 

You may possibly have to set these values yourself to the display 
resolution (or it may be done by the kernel framebuffer code when the 
framebuffer size is set).

>         case 13:         /* 0 = Enable calibration ; 1 = Calibration
OK */ 
>            cal_ok = arg; 

I'm not sure what that does. Check to see what cal_ok is used for; it 
may possibly put the driver into a raw ("calibration") mode.

> Looking at this, I see no cases for "SHOULD_KERNEL_SCALE_DATA" and
> "SET_Z_THRESHOLD".  Should I remove the ioctl lines from my code that
deal
> with these two?  Also, is "MWMOUSEMODE_RAW" something I have to edit?

For SHOULD_KERNEL_SCALE_DATA what you'll need to do is put the device 
into a mode where it doesn't do any scaling on the data when the driver 
asks for MWMOUSEMODE_RAW. If there isn't any specific ioctl that can do 
that, you could set the calibration values (xmin, xmax, ymin, ymax) to 
the limits of the values supplied by the chip (IIRC, I think they are 
0-1024 in both axes).

For SET_Z_THRESHOLD, you need to find out what the third byte of the 
data packet from the kernel is. If it is a raw pressure value, (which is

what you want really so you can supply it to the client applications), 
remove the SET_Z_THRESHOLD ioctl, and modify the PD_Read() function so 
that instead of:

         if(data[2] > 0) {
                 *pb = MWBUTTON_L;
                 *pz = 100;
         } else {
                 *pb = 0;
                 *pz = 0;
         }

You have something like:

	*pz = data[2];
	if(data[2] > mousedev.zthresh) *pb = MWBUTTON_L;
	else *pb = 0;

If the kernel handles the z threshold itself and just returns a 
true/false "button is pressed"/"button is not pressed", then remove the 
SET_Z_THRESHOLD ioctl() and live with the fact that you have no way to 
calibrate the value and no way for clients to make use of the pressure 
information the device provides (or hack the kernel driver so it returns

the raw pressure information and do what I said above).

If your driver does return pressure information and you make the 
modification to set *pz properly, have a go with the "pressure" demo 
(you may need to mess with the calibration values in 
demos/nanox/pressure.c). It's a version of the classic "scribble" demo 
but with the width of the line varying depending on how hard you press- 
it's quite fun on the TuxScreen.

BTW, I personally think the scaling and filtering is all best done in 
user space anyway, like the new ucb1x00 driver.

-- 
------------ Alex Holden - http://www.linuxhacker.org ------------
If it doesn't work, you're not hitting it with a big enough hammer

Previous by date: 22 Mar 2002 08:23:25 -0000 Re: Debug microwindow: nxclient:Corrupted packet, ShingYuen Wong
Next by date: 22 Mar 2002 08:23:25 -0000 "Keyboard Initialize Error" when using on X11?, "SangBaek Lee(=?EUC-KR?B?wMy787np?=)"
Previous in thread: 22 Mar 2002 08:23:25 -0000 Re: touchscreen calibration, Alex Holden
Next in thread: 22 Mar 2002 08:23:25 -0000 Touch screen calibration, Gabriel Goldstein


Powered by ezmlm-browse 0.20.