usb/125264: [patch] sysctl for set usb mouse rate (very useful
for gamers - FPS games)
Hans Petter Selasky
hselasky at c2i.net
Fri Jul 4 16:30:04 UTC 2008
The following reply was made to PR usb/125264; it has been noted by GNATS.
From: Hans Petter Selasky <hselasky at c2i.net>
To: freebsd-usb at freebsd.org,
vvd at quakeworld.ru
Cc: FreeBSD-gnats-submit at 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 at 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 <vvd at quakeworld.ru>
> >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 at 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=<INT_VALUE>" 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 <sys/mouse.h>
>
> +#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
More information about the freebsd-usb
mailing list