From owner-freebsd-usb@FreeBSD.ORG Fri Jul 4 16:30:04 2008 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96B891065684 for ; Fri, 4 Jul 2008 16:30:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 83CFB8FC16 for ; Fri, 4 Jul 2008 16:30:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m64GU4vr087647 for ; Fri, 4 Jul 2008 16:30:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m64GU3pf087643; Fri, 4 Jul 2008 16:30:03 GMT (envelope-from gnats) Date: Fri, 4 Jul 2008 16:30:03 GMT Message-Id: <200807041630.m64GU3pf087643@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Hans Petter Selasky Cc: Subject: Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games) X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Hans Petter Selasky List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2008 16:30:04 -0000 The following reply was made to PR usb/125264; it has been noted by GNATS. From: Hans Petter Selasky To: freebsd-usb@freebsd.org, vvd@quakeworld.ru Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games) Date: Fri, 4 Jul 2008 17:31:10 +0200 On Friday 04 July 2008, vvd@quakeworld.ru wrote: > >Number: 125264 > >Category: usb > >Synopsis: [patch] sysctl for set usb mouse rate (very useful for > > gamers - FPS games) Confidential: no > >Severity: non-critical > >Priority: low > >Responsible: freebsd-usb > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: change-request > >Submitter-Id: current-users > >Arrival-Date: Fri Jul 04 15:00:09 UTC 2008 > >Closed-Date: > >Last-Modified: > >Originator: VVD > >Release: FreeBSD 7.0-STABLE i386 > >Organization: > > no > > >Environment: > > System: FreeBSD vvd.home 7.0-STABLE FreeBSD 7.0-STABLE #0: Tue Jul 1 > 04:39:52 MSD 2008 root@vvd.home:/usr/obj/usr/src/sys/VVD2 i386 Platform > independent patch. > Tested on: i386, motherboard ASUS P4P8X, mice Logitech MX300 and Logitech > G5, game ezQuake 1.9. > > >Description: > > Add "options UMS_HZ=" in kernel config. > USB mouse rate: value from 1 to 1000, other values set default rate - mouse > specific. Most mice suport till 250Hz and 500Hz. Greater value - smoother > movements. Some of "professional gaming" mice support 1000Hz and have > default rate 500Hz. User can to change this value using sysctl > hw.usb.ums.hz. > For applying it user must take out mouse and insert it back. > > >How-To-Repeat: > > Use usb mouse. :-D > > >Fix: > > --- ums_hz.diff begins here --- > --- sys/conf/options.orig 2008-07-01 04:22:39.000000000 +0400 > +++ sys/conf/options 2008-07-01 04:22:45.000000000 +0400 > @@ -621,6 +621,7 @@ > UPLCOM_INTR_INTERVAL opt_uplcom.h > UVSCOM_DEFAULT_OPKTSIZE opt_uvscom.h > UVSCOM_INTR_INTERVAL opt_uvscom.h > +UMS_HZ opt_ums.h > > # Embedded system options > INIT_PATH > --- sys/dev/usb/ums.c.orig 2008-06-16 19:51:35.000000000 +0400 > +++ sys/dev/usb/ums.c 2008-07-01 04:23:41.000000000 +0400 > @@ -69,6 +69,13 @@ > > #include > > +#include "opt_ums.h" > +#ifdef UMS_HZ > +static int ums_hz = UMS_HZ; > +SYSCTL_NODE(_hw_usb, OID_AUTO, ums, CTLFLAG_RW, 0, "USB ums"); > +SYSCTL_INT(_hw_usb_ums, OID_AUTO, hz, CTLFLAG_RW, &ums_hz, 0, ""); > +#endif > + > #ifdef USB_DEBUG > #define DPRINTF(x) if (umsdebug) printf x > #define DPRINTFN(n,x) if (umsdebug>(n)) printf x > @@ -700,7 +707,12 @@ > 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); > +#ifdef UMS_HZ > + (ums_hz > 0 && ums_hz <= 1000) ? 1000 / ums_hz : USBD_DEFAULT_INTERVAL > +#else > + USBD_DEFAULT_INTERVAL > +#endif > + ); > if (err) { > DPRINTF(("ums_enable: usbd_open_pipe_intr failed, error=%d\n", > err)); > --- sys/conf/NOTES.orig 2008-07-02 01:00:01.000000000 +0400 > +++ sys/conf/NOTES 2008-07-02 01:06:12.000000000 +0400 > @@ -2431,6 +2431,12 @@ > device umodem > # USB mouse > device ums > +# USB mouse rate (1 to 1000, other values set default rate - mouse > specific). +# Most mice suport till 250Hz and 500Hz. Greater value - > smoother movements. +# Some of "professional gaming" mice support 1000Hz > and have default rate 500Hz. +# You can to change this value using sysctl > hw.usb.ums.hz. > +# For applying it you must take out mouse and insert it back. > +options UMS_HZ=-1 > # Diamond Rio 500 MP3 player > device urio > # USB scanners > Hi, If the mouse is LOW speed you should not poll that often. Maybe you need to add a USB speed check (See usbd_get_speed() or something similar.) --HPS