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: christos%zoulas.com@localhost (Christos Zoulas)
To: gnats-bugs%NetBSD.org@localhost, kern-bug-people%netbsd.org@localhost, 
        gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, 
nicolas.jouanne%free.fr@localhost
Cc: 
Subject: Re: kern/40105
Date: Mon, 22 Dec 2008 10:20:00 -0500

 On Dec 22, 12:25pm, nicolas.jouanne%free.fr@localhost (Nicolas Jouanne) wrote:
 -- Subject: Re: kern/40105
 
 |  same patch with a linguistic correction in comments  : s/revert/reverse/
 
 How about?
 
 christos
 
 Index: uep.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/usb/uep.c,v
 retrieving revision 1.6
 diff -u -u -r1.6 uep.c
 --- uep.c      3 Sep 2006 07:13:46 -0000       1.6
 +++ uep.c      22 Dec 2008 15:18:58 -0000
 @@ -66,6 +66,14 @@
  #include <dev/wscons/tpcalibvar.h>
  
  #define UIDSTR        "eGalax USB SN000000"
 +/* calibration - integer values, perhaps sysctls?  */
 +#define X_RATIO   293 
 +#define X_OFFSET  -28
 +#define Y_RATIO   -348
 +#define Y_OFFSET  537
 +/* an X_RATIO of ``312''  means : reduce by a factor 3.12 x axis amplitude */
 +/* an Y_RATIO of ``-157'' means : reduce by a factor 1.57 y axis amplitude,
 + * and reverse y motion */
  
  struct uep_softc {
        USBBASEDEVICE sc_dev;
 @@ -354,6 +362,17 @@
        return EPASSTHROUGH;
  }
  
 +static int
 +uep_adjust(int v, int off, int rat)
 +{
 +      int num = 100 * v;
 +      int quot = num / rat;
 +      int rem = num % rat;
 +      if (num >= 0 && rem < 0)
 +              quot++;
 +      return quot + off;
 +}
 +
  void
  uep_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
  {
 @@ -409,8 +428,8 @@
                   *
                   */
  
 -              x = (p[3] << 7) | p[4];
 -              y = (p[1] << 7) | p[2];
 +              x = uep_adjust((p[3] << 7) | p[4], X_OFFSET, X_RATIO);
 +              y = uep_adjust((p[1] << 7) | p[2], Y_OFFSET, Y_RATIO);
  
                tpcalib_trans(&sc->sc_tpcalib, x, y, &x, &y);
  
 


Home | Main Index | Thread Index | Old Index