Differences (old = Lepied, new = wacext )



old:  * This driver is only able to handle the Wacom IV protocol.
---
new:  * This driver is only able to handle the Wacom IV protocol. FL
new:  *
new:  * It was adapted to work (rudimentarily) with Wacom II.
new:  *
new:  * This will allow for using the following Wacom tablets:
new:  *
new:  * SD series:     opaque tablets 
new:  *
new:  * HD prototype:  HD486   One of the early 'electronic paper' units.
new:  *                It acts as an external VGA LCD screen, connected to a PC
new:  *                by VGA cable and a serial cable for the XY coordinates.
new:  *                It was 640x480 but monochrome and hardly usable.
new:  * PL100V         Integrated VGA+serial driver board. This greyscale LCD
new:  *                solved most of the problems of the HD prototype. The image
new:  *                and pen coordinate quality was greatly enhanced. The slim
new:  *                and flat unit was connected through a single slim cable
new:  *                to the PC. Resolution was still 640x480.
new:  * PL200V         Color version of PL100V. No experience with it at NICI
new:  *                The presence of (LCD) color is a necessity in pen computers.
new:  *                It allows for a clear distinction between different screen
new:  *                objects and ink traces.
new:  * IBM Thinkpad 360 PE (pen enabled). This is a very good 486 DX 25 MHz
new:  *                notebook computer with an OEM-integrated Wacom color
new:  *                tablet. It could be the same one as in the PL200V...???
new:  *                

               NOTE: only HD and Thinkpad have been thourougly tested 
                     extra modifications may be needed. (LS)

83c109
old: static int      debug_level = 0;
---
new: static int      debug_level = 1;

OFFSETS AND RESOLUTION ARE NEEDED TO CORRECT PARALLAX.
New fields are added for modifaction via your XConfig file (LS):

120a147,149                      
new:   int           wcmOffX;        /* offset X value */
new:   int           wcmOffY;        /* offset Y value */
new:   int           wcmOffZ;        /* offset Z value */
130a160,167
new:   int           wcmRate;        /* Sampling rate, steps of 5ms, 0=max */ 
new:   int           wcmType;        /* Type of Wacom tablet: 
new:                                    0=Wacom IV protocol, ArtPad
new:                                    1=Wacom II protocol, IBM Thinkpad
new:                                    2=Wacom II protocol, HD648   monochrome VGA
new:                                    3=Wacom II protocol, PL100V  greyscale VGA
new:                                    4=Wacom II protocol, PL200V  color VGA
new:                                  */
138a176
new: 
145a184,194
new: #define RESOL_X         8
new: #define RESOL_Y         9
new: #define RESOL_Z        10
new: #define MAX_X          11
new: #define MAX_Y          12
new: #define MAX_Z          13
new: #define OFF_X          14
new: #define OFF_Y          15
new: #define OFF_Z          16
new: #define SAMPLE_RATE    17
new: #define WACOM_TYPE     18
156a206,216
new:   { RESOL_X,            "resolx" },
new:   { RESOL_Y,            "resoly" },
new:   { RESOL_Z,            "resolz" },
new:   { MAX_X,              "maxx" },
new:   { MAX_Y,              "maxy" },
new:   { MAX_Z,              "maxz" },
new:   { OFF_X,              "offx" },
new:   { OFF_Y,              "offy" },
new:   { OFF_Z,              "offz" },
new:   { SAMPLE_RATE,        "rate" },
new:   { WACOM_TYPE,         "wacomtype" },           THIS IS A MAJOR CHANGE
168c228,243
old:   
---
new: 
new: #define TYPE_ARTPAD      0 
new: #define TYPE_THINKPAD    1
new: #define TYPE_LCD_HD648   2
new: #define TYPE_LCD_PL100V  3
new: #define TYPE_LCD_PL200V  4
new: 
new: static SymTabRec TypeTabRec[] = {
new:   { TYPE_ARTPAD,     "artpad" },
new:   { TYPE_THINKPAD,   "thinkpad" },
new:   { TYPE_LCD_HD648,  "hd648" },
new:   { TYPE_LCD_PL100V, "pl100v" },
new:   { TYPE_LCD_PL200V, "pl200v" },
new:   { -1,		"" }
new: };
new:     
191a267
new: #ifdef OLD
192a269,270
new: #define WC_RATE 	"IT2\r"	/* 100 Hz (unit of 5 ms) */
new: #endif
195,196c273
old: static const char * setup_string = WC_MULTI WC_UPPER_ORIGIN
old:  WC_ALL_MACRO WC_NO_MACRO1 WC_RATE;
---
new: static char setup_string[256];
321c398
old:     int			mtoken;
---
new:     int			mtoken, nsign;
383a461,503
new: 	    	
new: 	case WACOM_TYPE:
new: 	    mtoken = xf86GetToken(TypeTabRec);
new: 	    if ((mtoken == EOF) || (mtoken == STRING) || (mtoken == NUMBER)) 
new: 		xf86ConfigError("Mode type token expected");
new: 	    else {
new: 		switch (mtoken) {
new: 		case TYPE_ARTPAD:
new: 		    priv->wcmType = TYPE_ARTPAD;
new: 		    break;
new: 		case TYPE_THINKPAD:
new: 		    priv->wcmType = TYPE_THINKPAD;
new: 		    break;
new: 		case TYPE_LCD_HD648:
new: 		    priv->wcmType = TYPE_LCD_HD648;
new: 		    break;
new: 		case TYPE_LCD_PL100V:
new: 		    priv->wcmType = TYPE_LCD_PL100V;
new: 		    break;
new: 		case TYPE_LCD_PL200V:
new: 		    priv->wcmType = TYPE_LCD_PL200V;
new: 		    break;
new: 		default:
new: 		    xf86ConfigError("Illegal wacomtype");
new: 		    break;
new: 		}
new: 	    }
new: 	    break;
new: 	    
new: 	case SAMPLE_RATE:
new: 	    if (xf86GetToken(NULL) != NUMBER)
new: 		xf86ConfigError("Option number expected");
new: 	    priv->wcmRate = val->num;
new: 	    if(priv->wcmRate <= 0) {
new: 	        priv->wcmRate = 0;
new: 	    }
new: 	    if(priv->wcmRate > 99) {
new: 	        priv->wcmRate = 99;
new: 	    }
new: 	    if (xf86Verbose)
new: 		ErrorF("%s Wacom rate value is %d\n", XCONFIG_GIVEN,
new: 		       priv->wcmSuppress);      
new: 	    break;
393a514,593
new: 	    
new: 	case MAX_X:
new: 	    if (xf86GetToken(NULL) != NUMBER)
new: 		xf86ConfigError("Option number expected");
new: 	    priv->wcmMaxX = val->num;
new: 	    if (xf86Verbose)
new: 		ErrorF("%s Wacom MaxX value is %d\n", XCONFIG_GIVEN,
new: 		       priv->wcmMaxX);      
new: 	    break;
new: 	    
new: 	case MAX_Y:
new: 	    if (xf86GetToken(NULL) != NUMBER)
new: 		xf86ConfigError("Option number expected");
new: 	    priv->wcmMaxY = val->num;
new: 	    if (xf86Verbose)
new: 		ErrorF("%s Wacom MaxY value is %d\n", XCONFIG_GIVEN,
new: 		       priv->wcmMaxY);      
new: 	    break;
new: 	    
new: 	case MAX_Z:
new: 	    if (xf86GetToken(NULL) != NUMBER)
new: 		xf86ConfigError("Option number expected");
new: 	    priv->wcmMaxZ = val->num;
new: 	    if (xf86Verbose)
new: 		ErrorF("%s Wacom MaxZ value is %d\n", XCONFIG_GIVEN,
new: 		       priv->wcmMaxZ);      
new: 	    break;
new: 	    
new: 	    
new: 	case OFF_X:
new: 	    mtoken = xf86GetToken(NULL);
new: 	    if (mtoken == DASH) { 
new: 	          mtoken = xf86GetToken(NULL);
new: 	          nsign = -1;
new: 	    } else {
new: 	    	  nsign = 1;
new: 	    }
new: 	    if (mtoken != NUMBER) 
new: 		xf86ConfigError("Integer number expected");
new: 		
new: 	    priv->wcmOffX = nsign * val->num;
new: 	    if (xf86Verbose)
new: 		ErrorF("%s Wacom OffX value is %d\n", XCONFIG_GIVEN,
new: 		       priv->wcmOffX);      
new: 	    break;
new: 	    
new: 	case OFF_Y:
new: 	    mtoken = xf86GetToken(NULL);
new: 	    if (mtoken == DASH) { 
new: 	          mtoken = xf86GetToken(NULL);
new: 	          nsign = -1;
new: 	    } else {
new: 	    	  nsign = 1;
new: 	    }
new: 	    if (mtoken != NUMBER) 
new: 		xf86ConfigError("Integer number expected");
new: 
new: 	    priv->wcmOffY = nsign * val->num;
new: 	    if (xf86Verbose)
new: 		ErrorF("%s Wacom OffY value is %d\n", XCONFIG_GIVEN,
new: 		       priv->wcmOffY);      
new: 	    break;
new: 	    
new: 	case OFF_Z:
new: 	    mtoken = xf86GetToken(NULL);
new: 	    if (mtoken == DASH) { 
new: 	          mtoken = xf86GetToken(NULL);
new: 	          nsign = -1;
new: 	    } else {
new: 	    	  nsign = 1;
new: 	    }
new: 	    if (mtoken != NUMBER) 
new: 		xf86ConfigError("Integer number expected");
new: 
new: 	    priv->wcmOffZ = nsign * val->num;
new: 	    if (xf86Verbose)
new: 		ErrorF("%s Wacom OffZ value is %d\n", XCONFIG_GIVEN,
new: 		       priv->wcmOffZ);      
new: 	    break;
new: 	    
739c939
old: 		 + priv->wcmData[2]);
---
new: 		 + priv->wcmData[2]) + priv->wcmOffX;
741c941
old: 		 + priv->wcmData[5]);
---
new: 		 + priv->wcmData[5]) + priv->wcmOffY;
746,747c946,949
old: 	      
old: 	    z = ((priv->wcmData[6] & ZAXIS_BITS) * 2) + ((priv->wcmData[3] & ZAXIS_BIT) >> 2);
---
new: 	    
new: /* For pressure pens */	      
new: 	    z = ((priv->wcmData[6] & ZAXIS_BITS) * 2) 
new: 	        + ((priv->wcmData[3] & ZAXIS_BIT) >> 2);
750,751d951
old: 	  
old: 	    is_button = (priv->wcmData[0] & BUTTON_FLAG);
753,754c953,961
old:       
old: 	    buttons = (priv->wcmData[3] & BUTTONS_BITS) >> 3;
---
new: 
new:             if(priv->wcmType == TYPE_ARTPAD) {
new: 	       is_button = (priv->wcmData[0] & BUTTON_FLAG);
new: 	       buttons = (priv->wcmData[3] & BUTTONS_BITS) >> 3;
new: 	       
new:             } else {
new: 	       buttons = (int) priv->wcmData[6] & 1;
new: 	       is_button = (buttons != 0);
new:             }
777a985
new: 		
782a991
new: 		    
788a998
new: 		    
800c1010
old: 	    else {
---
new: 	    else { /* no stylus */
807a1018
new: 	    
838c1049,1050
old: 	    /* coordonates are ready we can send events */
---
new: 	    /* coordinates are ready we can send events to X11 */
new: 	    
843c1055,1056
old: 			xf86PostProximityEvent(device, 1, 0, 5, rx, ry, z, tx, ty);
---
new: 			xf86PostProximityEvent(device, 1, 0, 5
new: 			                             , rx, ry, z, tx, ty);
863a1077
new: 		
897,898c1111,1113
old: 		    DBG(4, ErrorF("xf86WcmReadInput button=%d delta=%d\n", button,
old: 				  delta));
---
new: 		    DBG(4, ErrorF("xf86WcmReadInput button=%d delta=%d\n"
new: 		                 , button
new: 				 , delta));
900,901c1115,1117
old: 		    xf86PostButtonEvent(device, is_absolute, button, (delta > 0),
old: 					0, 5, rx, ry, z, tx, ty); 
---
new: 		    xf86PostButtonEvent(device, is_absolute, button
new: 		                        , (delta > 0)
new: 					, 0, 5, rx, ry, z, tx, ty); 
902a1119
new: 		
911,912c1128,1131
old: 		/* reports button up when the device has been down and becomes out of proximity */
old: 		if (*pbuttons) {
---
new: 		/* reports button up when the device has been down and 
new: 		   becomes out of proximity */
new: 		   
new: 		if (*pbuttons != 0) {
914a1134
new: 
919c1139
old: 		    if (buttons) {
---
new: 		    if (buttons != 0) {
976a1197,1198
new:     
new: 
1073,1089c1295,1333
old: 		     DBG(2, ErrorF("reading model\n"));
old:     if (!send_request(local->fd, WC_MODEL, buffer)) 
old: 	return !Success;
old:     DBG(2, ErrorF("%s\n", buffer));
old:   
old:     if (xf86Verbose)
old: 	ErrorF("%s Wacom tablet model : %s\n", XCONFIG_PROBED, buffer+2);
old: 
old:     /* answer is in the form ~#Tablet-Model ROM_Version */
old:     /* loop while not space */
old:     for(loop=0; loopwcmRate);
new:          strcat(setup_string, tmp);
new:     }
new: 
new:     if(priv->wcmType != TYPE_THINKPAD) {
new: 
new:        DBG(2, ErrorF("reading model\n"));
new:        if (!send_request(local->fd, WC_MODEL, buffer)) 
new: 	   return !Success;
new:        DBG(2, ErrorF("%s\n", buffer));
new: 
new:        if (xf86Verbose)
new: 	   ErrorF("%s Wacom tablet model : %s\n", XCONFIG_PROBED, buffer+2);
new: 
new:        /* answer is in the form ~#Tablet-Model ROM_Version */
new:        /* loop while not space */
new:        for(loop=0; loopflags, version, buffer+loop+2));
new:        if ((priv->flags & TILT_FLAG) && (version >= (float)1.4)) {
new: 	   priv->wcmPktLength = 9;
new:        }
new:     } else {
new:        DBG(2, ErrorF("ThinkPad 360 PE assumed: no interactive model prodding\n"));
1092,1097c1336
old:     /* tilt works on ROM 1.4 and above */
old:     DBG(2, ErrorF("wacom flags=%d ROM version=%f buffer=%s\n",
old: 		  priv->flags, version, buffer+loop+2));
old:     if ((priv->flags & TILT_FLAG) && (version >= (float)1.4)) {
old: 	priv->wcmPktLength = 9;
old:     }
---
new:     if(priv->wcmType == TYPE_ARTPAD) {
1099,1103c1338,1343
old:     DBG(2, ErrorF("reading config\n"));
old:     if (!send_request(local->fd, WC_CONFIG, buffer))
old: 	return !Success;
old:     DBG(2, ErrorF("%s\n", buffer));
old:     sscanf(buffer+19, "%d,%d,%d,%d", &a, &b, &priv->wcmResolX, &priv->wcmResolY);
---
new:        DBG(2, ErrorF("reading config from device\n"));
new:        if (!send_request(local->fd, WC_CONFIG, buffer))
new: 	  return !Success;
new:        DBG(2, ErrorF("%s\n", buffer));
new:        sscanf(buffer+19, "%d,%d,%d,%d"
new:                        , &a, &b, &priv->wcmResolX, &priv->wcmResolY);
1105,1109c1345,1375
old:     DBG(2, ErrorF("reading max coordinates\n"));
old:     if (!send_request(local->fd, WC_COORD, buffer))
old: 	return !Success;
old:     DBG(2, ErrorF("%s\n", buffer));
old:     sscanf(buffer+2, "%d,%d", &priv->wcmMaxX, &priv->wcmMaxY);
---
new:        DBG(2, ErrorF("reading max coordinates\n"));
new:        if (!send_request(local->fd, WC_COORD, buffer))
new: 	  return !Success;
new:        DBG(2, ErrorF("%s\n", buffer));
new:        sscanf(buffer+2, "%d,%d", &priv->wcmMaxX, &priv->wcmMaxY);
new:     } else {
new:        DBG(2, ErrorF("not reading config from device, take from XF86Conf\n"));
new: /* 
new: HD648: 
new:     a = 1;
new:     b = 1;
new:     priv->wcmResolX = 1;
new:     priv->wcmResolY = 1;
new:     priv->wcmMaxX = 4000;
new:     priv->wcmMaxY = 2800;
new:     */
new:     
new:        {
new:  
new:           FILE *tab;
new: #define TABLET_DEFINITION_FILE "/usr/X11R6/lib/modules/Wacom.tab" 
new:           a = 1;
new:           b = 1;
new:           tab = fopen(TABLET_DEFINITION_FILE,"r");
new:           fscanf(tab,"%d", &priv->wcmResolX);
new:           fscanf(tab,"%d", &priv->wcmResolY);
new:           fscanf(tab,"%d", &priv->wcmMaxX);
new:           fscanf(tab,"%d", &priv->wcmMaxY);
new:           fclose(tab);
new:        }
new:     }
1121a1388,1389
new:     if(priv->wcmType == TYPE_ARTPAD) {
new: 
1124,1129c1392,1398
old:     if (HANDLE_TILT(priv)) {
old: 	SYSCALL(err = write(local->fd, WC_TILT_MODE, strlen(WC_TILT_MODE)));
old: 	if (err == -1) {
old: 	    ErrorF("Wacom write error : %s\n", strerror(errno));
old: 	    return !Success;
old: 	}
---
new:        if (HANDLE_TILT(priv)) {
new: 	  SYSCALL(err = write(local->fd, WC_TILT_MODE, strlen(WC_TILT_MODE)));
new: 	  if (err == -1) {
new: 	      ErrorF("Wacom write error : %s\n", strerror(errno));
new: 	      return !Success;
new: 	  }
new:        }
1130a1400,1401
new: 
new: /* Suppress coordinates if jump smaller than .... */
1552a1824,1826
new:     priv->wcmOffX = 0;		        /* max X value */
new:     priv->wcmOffY = 0;		        /* max Y value */
new:     priv->wcmOffZ = 0;		        /* max Z value */
1565c1839,1840
old: 
---
new:     priv->wcmRate = 0;                  /* 0=Max, 1=200Hz, 2=100Hz: 5ms steps */
new:     priv->wcmType = 0;                  /* default Artpad */
1687a1963
new: