Re: Live Touchscreen Calibration [WAS: magictouch touch screen driver]

2005-06-10 Thread damian gruszka

Hi,
I don't think a functionality like this is really necessary. A 
calibration utility is started by a user once
to find the mapping from touchscreen coordinates to real screen. In 
general it is a matrix doing shifting,
stretching and rotating. To use scrn-currentMode is from my perspective 
not a hack. What can this function do
more than reading these fields from screen structure. Another question 
is, what should be done in  case of
changing geometry? Automatically adjust the matrix? That is a 90% 
solution. What about external scaling facilities?
Letter box display? IMHO, this should be done by userland program 
using DeviceControl.



Best Regards
Damian

[EMAIL PROTECTED] wrote on 10.06.2005 01:00:54:

 It would be great if you could add that... what do you mean by live
 calibration ?

 It seems to me that calibration should be (mostly) a userland utility,
 that you do not want to run everytime the Xserver starts. I probably
 misunderstood what you meant.

 My only issue currently, is that if resolution changes, the mapping from
 touchscreen coords to screen coords changes, thus the touchscreen driver
 should be able to be notified, or query what the actual screen resolution
 is.

 The trick mentioned previsously about querying the current modeline would
 work, but it's a hack... something cleaner (portable, etc.)  would be
 nicer.

 I admit I do not know the specifics of touchpad/stylus support, but I
 imagine that is also the only dynamic/live resolution support that would
 be necessary ?

 Something like XFGetCurrentMonitorResolution(displayID, width, height)
 ...

 BTW, I submitted the source for the magictouch driver on this mailling
 list, is there any chance it will appear in the XFree86 tree someday ? If
 a comitter needs changes, fixes to it or has questions, I'll be happy to
 help as I can.

 bruno

 On Thu, 9 Jun 2005, Fred Gleason wrote:

  On Tuesday 07 June 2005 16:04, Tristan Van Berkom wrote:
   Since touchscreen drivers seem to be getting back in style, maybe
   we should write up some live calibration support ;-)
 
  I'm game.  I've actually been toying with the idea of doing 
something like

  this for the ELO drivers for some time.
 
  Before I go charging off and reinventing the wheel, does anything
 simiklar to
  this exist already?  Ideally, it should be sufficiently generic 
that any

  input device that uses absolute coordinates will be able to use it.
 
  Cheers!
 

 ___
 Devel mailing list
 Devel@XFree86.Org
 http://XFree86.Org/mailman/listinfo/devel


___
Devel mailing list
Devel@XFree86.Org
http://XFree86.Org/mailman/listinfo/devel


Changes to via_drv.o solving problems of hardwired devices.

2005-05-10 Thread damian gruszka
Hello,
to support hardwired TV and LVDS devices, which doesn't apear on I2O 
bus I suggest following changes.
The Option ConnectedDevice set the correesponding field in 
VIABIOSInfo.Since my routine and the the switch for ActiveDevice
are quite similar, I also risked to replace  this code  by  new  
visually shorter  code.

via.patch  - contains combined changes done to  .c and .h files.
via_driver.c.patch, via_bios.h.patch and via_bios.c.patch - patches in 
separate files.

Pls. comment this changes.
Best Regards
Damian
--- via_driver.c2005-05-09 13:53:06.854268208 +0200
+++ ../via/via_driver.c 2005-05-09 14:09:47.974074864 +0200
@@ -152,7 +152,8 @@
 OPTION_CAP0_DEINTERLACE,
 OPTION_CAP1_DEINTERLACE,
 OPTION_CAP0_FIELDSWAP,
-OPTION_DRIXINERAMA
+OPTION_DRIXINERAMA,
+OPTION_CONNECTED_DEVICE
 } VIAOpts;
 
 
@@ -184,9 +185,31 @@
 {OPTION_CAP1_DEINTERLACE, Cap1Deinterlace,OPTV_ANYSTR,  {0}, FALSE},
 {OPTION_CAP0_FIELDSWAP, Cap0FieldSwap,OPTV_BOOLEAN,  {0}, FALSE},
 {OPTION_DRIXINERAMA,  DRIXINERAMA,OPTV_BOOLEAN, {0}, FALSE},
+{OPTION_CONNECTED_DEVICE,ConnectedDevice,OPTV_ANYSTR,{0},FALSE},
 {-1,NULL,   OPTV_NONE,{0}, FALSE}
 };
 
+struct OutputDesc { char *Name;unsigned char Mask;};
+const static  struct OutputDesc Values[]=
+{
+   {NONE,0} ,
+   {BIOS,0xFF} ,
+   {CRT,VIA_DEVICE_CRT1} ,
+   {CRT ONLY,VIA_DEVICE_CRT1} ,
+{TV, VIA_DEVICE_TV},
+{TV ONLY, VIA_DEVICE_TV},
+{LCD,VIA_DEVICE_LCD},
+{LCD ONLY,VIA_DEVICE_LCD} ,
+   {DVI,VIA_DEVICE_DFP},
+   {DVI ONLY,VIA_DEVICE_DFP},
+   {DFP,VIA_DEVICE_DFP},
+   {DFP ONLY,VIA_DEVICE_DFP},
+   {CRT2,VIA_DEVICE_CRT2}
+};
+static char *DevMask2Str[5]=
+{
+   CRT,LCD,TV,DFP,CRT2
+};
 
 static const char *vgaHWSymbols[] = {
 vgaHWGetHWRec,
@@ -346,7 +369,8 @@
 XF86ModuleData viaModuleData = {VIAVersRec, VIASetup, NULL};
 
 
-static pointer VIASetup(pointer module, pointer opts, int *errmaj, int *errmin)
+/* static */ 
+pointer VIASetup(pointer module, pointer opts, int *errmaj, int *errmin)
 {
 static Bool setupDone = FALSE;
 
@@ -673,8 +697,67 @@
 ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
 }
 }
+/***
+ Purpose: sets connectedDevice map according to user requirements
 
+ Input:   string passed to driver via ConnectedDevice option
 
+ output:  mask of connected devices
+
+ Remarks: the option BIOS sets the value according to register SR32
+  ~ char negates the value;
+
+/ 
+static unsigned char ParseDeviceMask(
+   ScrnInfoPtr  pScrn, 
+   VIAPtr  pVia,
+   const char *opt_value,
+   const char *opt_name,
+   const int  start)
+{
+VIABIOSInfoPtr  pBIOSInfo;
+   unsigned char val=0;
+   pBIOSInfo = pVia-pBIOSInfo;
+   do {
+   char str[5],neg=0;
+   unsigned char pv=0;
+   int  n;
+   int  err = 1;
+   const char *p=strchr(opt_value,',');
+   if(!p)
+   p = opt_value + strlen(opt_value);
+   if(*opt_value == '~') {
+   ++opt_value;
+   neg=1;
+   }
+   if((n=p - opt_value) = sizeof(str)) {
+   memcpy(str,opt_value,n*sizeof(str[0]));
+   str[n]='\0';
+   for(n=start;nsizeof(Values)/sizeof(Values[0]);++n)
+   if (!xf86NameCmp(str,Values[n].Name))
+   break;
+   if( n  (sizeof(Values)/sizeof(Values[0]))) {
+   pv=Values[n].Mask;
+   if(pv == 0xFF)
+   pv = 
VIAGetBIOSConnectedDevice(pBIOSInfo);
+   if(neg) 
+   val = ~pv;
+   else
+   val |= pv;
+   err = 0;
+   }
+   }
+   if(err) {
+   xf86DrvMsg(pScrn-scrnIndex, X_CONFIG, 
+   Option %s, value %s is unknown in this context.\n,
+   opt_name, opt_value);
+   
+   }
+   opt_value = p+ ((*p) ? 1:0);
+   } while(*opt_value);
+   return val;
+}
+/*/
 static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags)
 {
 EntityInfoPtr   pEnt;
@@ -984,53 +1067,22 @@
 /* ActiveDevice Option for device selection */
 pBIOSInfo-ActiveDevice = 0x00;
 if ((s = xf86GetOptValString(VIAOptions, OPTION_ACTIVEDEVICE))) {
-if (!xf86NameCmp(s, CRT,TV) || !xf86NameCmp(s, TV,CRT)) {
-pBIOSInfo-ActiveDevice