NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/40105



The following reply was made to PR kern/40105; it has been noted by GNATS.

From: Nicolas Jouanne <nicolas.jouanne%free.fr@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/40105
Date: Mon, 22 Dec 2008 13:28:41 +0100

 same patch with a linguistic correction in comments  : s/revert/reverse/
 
 --- /usr/src/sys/dev/usb/uep.c.orig    2008-11-09 12:09:41.000000000 +0000
 +++ /usr/src/sys/dev/usb/uep.c 2008-12-04 20:20:47.000000000 +0000
 @@ -59,6 +59,16 @@
  #include <dev/wscons/tpcalibvar.h>
  
  #define UIDSTR        "eGalax USB SN000000"
 +/* calibration - integer values */
 +#define X_RATIO   293 
 +#define X_OFFSET  -28
 +#define Y_RATIO   -348
 +#define Y_OFFSET  537
 +/* a X_RATIO of ``312''  means : reduce by a factor 3.12 x axis amplitude */
 +/* a Y_RATIO of ``-157'' means : reduce by a factor 1.57 y axis amplitude,
 +   and reverse y motion */
 +#undef  UEP_DEBUG
 +/* #define UEP_DEBUG 0 */
  
  struct uep_softc {
        USBBASEDEVICE sc_dev;
 @@ -368,6 +378,9 @@
  
        usbd_get_xfer_status(xfer, NULL, NULL, &len, NULL);
  
 +      /* calibration */
 +      int num,denom,quot,rem ;
 +
        if (status == USBD_CANCELLED)
                return;
  
 @@ -416,6 +429,36 @@
  
                x = (p[3] << 7) | p[4];
                y = (p[1] << 7) | p[2];
 +                
 +              /* calibration */
 +              
 +              /* x axis */
 +              num   = 100 * x ;
 +              denom = X_RATIO ;
 +              
 +              quot  = num / denom ;
 +              rem   = num % denom ;
 +              
 +              if (num >= 0 && rem < 0)
 +                      quot++;
 +              
 +              x = (int) (quot) + X_OFFSET ;
 +              
 +              /* y axis */
 +              num   = 100 * y ;
 +              denom = Y_RATIO ;
 +              
 +              quot  = num / denom ;
 +              rem   = num % denom ;
 +              
 +              if (num >= 0 && rem < 0)
 +                      quot++;
 +              
 +              y = (int) (quot) + Y_OFFSET ;
 +
 +#ifdef UEP_DEBUG
 +              printf("uep.c : (x,y) : [%d,%d].\n",x,y);
 +#endif
  
                tpcalib_trans(&sc->sc_tpcalib, x, y, &x, &y);
  
 


Home | Main Index | Thread Index | Old Index