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

From: "VVD" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[email protected]>,
        "'Paul B. Mahol'" <[EMAIL PROTECTED]>
Subject: RE: usb/125264: [patch] sysctl for set usb mouse rate (very useful for 
gamers - FPS games)
Date: Sun, 13 Jul 2008 08:12:59 +0400

 I find speed - always LOW (tested on 6 Logitech mice: G5, MX300, RX250 and 3
 different 5$-cost mice).
 But I wrote another patch:
 --- ums.c.orig 2008-06-16 19:51:35.000000000 +0400
 +++ ums.c      2008-07-13 07:48:58.000000000 +0400
 @@ -673,6 +673,7 @@
        void *v;
  {
        struct ums_softc *sc = v;
 +      int usb_interval;
  
        usbd_status err;
  
 @@ -696,11 +697,21 @@
         */
        usbd_set_protocol(sc->sc_iface, 1);
  
 +      /* 
 +       * Calculate USB interval in ms from rate in Hz (moused command line
 option -F).
 +       * Possible values are from 1 to 1000, else use
 USBD_DEFAULT_INTERVAL.
 +       * Modern gaming mice have 500Hz by default, other 100Hz or 125Hz.
 +       */
 +      usb_interval = (sc->mode.rate > 0 && sc->mode.rate <= 1000) ?
 +                      1000 / sc->mode.rate : USBD_DEFAULT_INTERVAL;
 +      DPRINTF(("ums_enable: mouse rate is %d, usb interval is %d\n",
 +              sc->mode.rate, usb_interval));
 +
        /* Set up interrupt pipe. */
        err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ep_addr,
                                USBD_SHORT_XFER_OK, &sc->sc_intrpipe, sc,
                                sc->sc_ibuf, sc->sc_isize, ums_intr,
 -                              USBD_DEFAULT_INTERVAL);
 +                              usb_interval);
        if (err) {
                DPRINTF(("ums_enable: usbd_open_pipe_intr failed,
 error=%d\n",
                         err));
 @@ -900,6 +911,29 @@
                        sc->mode.syncmask[1] = MOUSE_SYS_SYNC;
                }
  
 +              /*
 +               * Most modern gaming mice support customized resolution,
 but I don't know
 +               * how to set it. For support this feature in
 ums_ioctl(MOUSE_SETMODE)
 +               * need to uncomment next line:
 +               * sc->mode.resolution = mode.resolution > 0 ?
 +               *                       mode.resolution :
 MOUSE_RES_UNKNOWN;
 +               * and may be call ums_disable() and ums_enable() if
 resolution was changed.
 +               */
 +
 +              /*
 +               * Call ums_disable() and ums_enable() because of what rate
 was set in
 +               * ums_enable() and can't to change it on the fly (if can -
 how?).
 +               * For example: during moused startup (with options "-F rate
 -r resolution")
 +               * 1st call ums_enable() and then ums_ioctl(MOUSE_SETMODE)
 and, as result,
 +               * mouse initialized with default values of the rate and
 resolution,
 +               * but not with custom from command line.
 +               */
 +              if (sc->mode.rate != mode.rate) {
 +                      sc->mode.rate = mode.rate;
 +                      ums_disable(sc);
 +                      ums_enable(sc);
 +              }
 +
                bzero(sc->qbuf, sizeof(sc->qbuf));
                sc->qhead = sc->qtail = sc->qcount = 0;
                splx(s);
 
 
 I want to ask about to make another PR with patch:
 --- usbdi.c.orig       2008-07-12 20:43:42.000000000 +0400
 +++ usbdi.c    2008-07-12 20:43:47.000000000 +0400
 @@ -231,23 +231,19 @@
        xfer = usbd_alloc_xfer(iface->device);
        if (xfer == NULL) {
                err = USBD_NOMEM;
 -              goto bad1;
 -      }
 +      } else {
        usbd_setup_xfer(xfer, ipipe, priv, buffer, len, flags,
            USBD_NO_TIMEOUT, cb);
        ipipe->intrxfer = xfer;
        ipipe->repeat = 1;
        err = usbd_transfer(xfer);
        *pipe = ipipe;
 -      if (err != USBD_IN_PROGRESS && err)
 -              goto bad2;
 +              if (err == USBD_IN_PROGRESS || !err)
        return (USBD_NORMAL_COMPLETION);
 -
 - bad2:
        ipipe->intrxfer = NULL;
        ipipe->repeat = 0;
        usbd_free_xfer(xfer);
 - bad1:
 +      }
        usbd_close_pipe(ipipe);
        return (err);
  }
 
 IMHO/AFAIK, using of "goto" is not a good practice. But who know... :-)
 
 
 P.S. Sorry for my English.
 
 
 -----Original Message-----
 From: Paul B. Mahol [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, July 05, 2008 9:19 PM
 To: VVD
 Cc: [email protected]
 Subject: Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful
 for gamers - FPS games)
 
 
 On 7/5/08, VVD <[EMAIL PROTECTED]> wrote:
 > The following reply was made to PR usb/125264; it has been noted by GNATS.
 >
 > From: "VVD" <[EMAIL PROTECTED]>
 > To: <[EMAIL PROTECTED]>,
 >      <[EMAIL PROTECTED]>
 > Cc:  
 > Subject: Re: usb/125264: [patch] sysctl for set usb mouse rate (very 
 > useful for gamers - FPS games)
 > Date: Sat, 5 Jul 2008 06:10:01 +0400
 >
 >  Hi,
 >  
 >  AFAIK, all mice are LOW speed usb devices. Didn't understand how to 
 > use
 >  usbd_get_speed() for ums - have no field like speed. High rate need 
 > only for  more smooth mouse moving.
 >  Linux have custom mouse rate patch from ~2.6.1x. Logitech have 
 > Setpoint  drivers for Win with possibility to set mouse rate from 125 
 > to 1000. Time  for FreeBSD to have this feature. :-]
 >  
 
 But what about moused -F option? Is it supported at all by ums driver?
 
 
 >  With best regards.
 >  
 >  
 > _______________________________________________
 > [email protected] mailing list
 > http://lists.freebsd.org/mailman/listinfo/freebsd-usb
 > To unsubscribe, send any mail to "[EMAIL PROTECTED]"
 >
 
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to