From owner-freebsd-usb@FreeBSD.ORG Fri Jul 4 15:29:46 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47689106567B for ; Fri, 4 Jul 2008 15:29:46 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe01.swip.net [212.247.154.1]) by mx1.freebsd.org (Postfix) with ESMTP id 721378FC12 for ; Fri, 4 Jul 2008 15:29:44 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=jgzytnynxjAA:10 a=iAQA5xzl0wIA:10 a=NMGBx6iLSXY/3qZKdJo9Bw==:17 a=7VEiMnw2EooKoXH9-uYA:9 a=YVoSK2W65OgycsKjl50A:7 a=qKm9-hc8uNlGqgF2HT9PQ03rHQ0A:4 a=LY0hPdMaydYA:10 Received: from [62.113.135.207] (account mc467741@c2i.net [62.113.135.207] verified) by mailfe01.swip.net (CommuniGate Pro SMTP 5.2.4b) with ESMTPA id 975019377; Fri, 04 Jul 2008 17:29:34 +0200 From: Hans Petter Selasky To: freebsd-usb@freebsd.org, vvd@quakeworld.ru Date: Fri, 4 Jul 2008 17:31:10 +0200 User-Agent: KMail/1.9.7 References: <200807041353.m64DrFdM030252@gw.unislabs.com> In-Reply-To: <200807041353.m64DrFdM030252@gw.unislabs.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807041731.12088.hselasky@c2i.net> Cc: FreeBSD-gnats-submit@freebsd.org 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 List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2008 15:29:46 -0000 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