usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2009-07-14 Thread Hans Petter Selasky
The following reply was made to PR usb/125264; it has been noted by GNATS.

From: Hans Petter Selasky 
To: bug-follo...@freebsd.org,
 v...@quakeworld.ru
Cc:  
Subject: usb/125264: [patch] sysctl for set usb mouse rate (very useful for 
gamers - FPS games)
Date: Tue, 14 Jul 2009 12:30:57 +0200

 Hi,
 
 The patch is in.
 
 http://perforce.freebsd.org/chv.cgi?CH=166075
 
 Thanks for being patient. Please test.
 
 --HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2008-07-04 Thread vvd

>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 <[EMAIL PROTECTED]>
>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 [EMAIL PROTECTED]:/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.0 +0400
+++ sys/conf/options2008-07-01 04:22:45.0 +0400
@@ -621,6 +621,7 @@
 UPLCOM_INTR_INTERVAL   opt_uplcom.h
 UVSCOM_DEFAULT_OPKTSIZEopt_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.0 +0400
+++ sys/dev/usb/ums.c   2008-07-01 04:23:41.0 +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.0 +0400
+++ sys/conf/NOTES  2008-07-02 01:06:12.0 +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.
+optionsUMS_HZ=-1
 # Diamond Rio 500 MP3 player
 device urio
 # USB scanners
>Release-Note:
>Audit-Trail:
>Unformatted:
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2009-08-24 Thread gavin
Synopsis: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS 
games)

State-Changed-From-To: open->patched
State-Changed-By: gavin
State-Changed-When: Mon Aug 24 13:12:23 UTC 2009
State-Changed-Why: 
Fixed in HEAD.

http://www.freebsd.org/cgi/query-pr.cgi?pr=125264
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2009-11-07 Thread Alexander Best
The following reply was made to PR usb/125264; it has been noted by GNATS.

From: Alexander Best 
To: 
Cc:  
Subject: Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful
 for gamers - FPS games)
Date: Sat, 07 Nov 2009 21:08:18 +0100 (CET)

 since 8 has now become a stable branch the pr can be closed.
 
 this feature is dependant upon the usb2 stack an will not be backported to
 branches 7 and 6 which use the old usb1 stack.
 
 alex
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2009-11-10 Thread linimon
Synopsis: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS 
games)

State-Changed-From-To: patched->closed
State-Changed-By: linimon
State-Changed-When: Tue Nov 10 08:19:13 UTC 2009
State-Changed-Why: 
A fix has been committed to -8, but the usb stack changed so much from
7 to 8 that it is not possible to back-port the fix to 6 or 7.

http://www.freebsd.org/cgi/query-pr.cgi?pr=125264
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2008-07-04 Thread Hans Petter Selasky
On Friday 04 July 2008, [EMAIL PROTECTED] 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 <[EMAIL PROTECTED]>
> >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 [EMAIL PROTECTED]:/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.0 +0400
> +++ sys/conf/options  2008-07-01 04:22:45.0 +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.orig2008-06-16 19:51:35.0 +0400
> +++ sys/dev/usb/ums.c 2008-07-01 04:23:41.0 +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.0 +0400
> +++ sys/conf/NOTES2008-07-02 01:06:12.0 +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
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2008-07-04 Thread Hans Petter Selasky
The following reply was made to PR usb/125264; it has been noted by GNATS.

From: Hans Petter Selasky <[EMAIL PROTECTED]>
To: freebsd-usb@freebsd.org,
 [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
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, [EMAIL PROTECTED] 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 <[EMAIL PROTECTED]>
 > >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 [EMAIL PROTECTED]:/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.orig2008-07-01 04:22:39.0 +0400
 > +++ sys/conf/options 2008-07-01 04:22:45.0 +0400
 > @@ -621,6 +621,7 @@
 >  UPLCOM_INTR_INTERVALopt_uplcom.h
 >  UVSCOM_DEFAULT_OPKTSIZE opt_uvscom.h
 >  UVSCOM_INTR_INTERVALopt_uvscom.h
 > +UMS_HZ  opt_ums.h
 >
 >  # Embedded system options
 >  INIT_PATH
 > --- sys/dev/usb/ums.c.orig   2008-06-16 19:51:35.0 +0400
 > +++ sys/dev/usb/ums.c2008-07-01 04:23:41.0 +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.0 +0400
 > +++ sys/conf/NOTES   2008-07-02 01:06:12.0 +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
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2008-07-04 Thread VVD
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. :-]
 
 With best regards.
 
 
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2008-07-05 Thread Paul B. Mahol
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.
>  
>  
> ___
> freebsd-usb@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-usb
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
>
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


RE: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2008-07-07 Thread VVD

Can't use sc->mode.rate instead sysctl hw.usb.ums.
ums always get 0 value in sc->mode.rate.
Better way is -F, of course, instead sysctl hw.usb.ums, but I don't know why
ums always get sc->mode.rate with value 0... :-(


-Original Message-
From: Paul B. Mahol [mailto:[EMAIL PROTECTED] 
Sent: Saturday, July 05, 2008 9:19 PM
To: VVD
Cc: freebsd-usb@freebsd.org
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.


___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


RE: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2008-07-12 Thread VVD

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.0 +0400
+++ ums.c   2008-07-13 07:48:58.0 +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.orig2008-07-12 20:43:42.0 +0400
+++ usbdi.c 2008-07-12 20:43:47.0 +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: freebsd-usb@freebsd.org
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 

RE: usb/125264: [patch] sysctl for set usb mouse rate (very useful for gamers - FPS games)

2008-07-12 Thread VVD
The following reply was made to PR usb/125264; it has been noted by GNATS.

From: "VVD" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: ,
"'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.0 +0400
 +++ ums.c  2008-07-13 07:48:58.0 +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.0 +0400
 +++ usbdi.c2008-07-12 20:43:47.0 +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: freebsd-usb@freebsd.org
 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]>,
 >  <