tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Adding mouse sensitivity adjustment to wsmouse



Am 18.05.10 23:17, schrieb Sverre Froyen:

> I would like to adjust the sensitivity of my external mouse but leave the 
> sensitivity of my laptop touchpad as is. As far as I can tell, NetBSD has no 
> facility to do this. I found a couple of mouse ioctl definitions (but no 
> implementations) that seem relevant and also kern/12132 that partially 
> implements what I need. I propose changing wsmouse.c as indicated in the 
> attached diff. It adds scaling factors for x, y, z, and w into the 
> wsmouse_softc structure and uses a higher resolution internally in order to 
> handle fractions without adding floats.
> 
> WSCONS_MOUSE_RES is (the inverse of) the internal resolution and
> sc_mx, sc_my, etc are the scaling factors (multiplied with WSCONS_MOUSE_RES).
> 
> It appears to work for my case with a regular bluetooth mouse but it has not 
> been tested for a device producing absolute positions.
> 
> If this looks OK, we need to decide how to set the scaling factors. There are 
> two ioctls that appear relevant (from wsconsio.h):
> 
> /* Set resolution.  Not applicable to all mouse types. */
> #define WSMOUSEIO_SRES          _IOW('W', 33, u_int)
> #define WSMOUSE_RES_MIN         0
> #define WSMOUSE_RES_DEFAULT     75
> #define WSMOUSE_RES_MAX         100
> 
> /* Set scale factor (num / den).  Not applicable to all mouse types. */
> #define WSMOUSEIO_SSCALE        _IOW('W', 34, u_int[2])
> 
> WSMOUSEIO_SRES has been implemented for one driver 
> (sys/arch/hpcmips/vr/vrpiu.c) but I'm not sure what is does. WSMOUSEIO_SSCALE 
> has not been implemented for any driver (but see kern/12132). My current test 
> implementaion ignores WSMOUSEIO_SRES and changes WSMOUSEIO_SSCALE to take a 
> single integer which is used to set the x and y scaling factors. Because 
> WSMOUSE_RES_MAX is 100, the WSMOUSEIO_SSCALE value can be described as a 
> percent scaling. This is sufficient for my needs but we might want to scale x 
> and y differently and also set scaling factors for z and w.
> 
> If there is interest and we can reach a consensus on the ioctl question I can 
> clean this up and submit it. Please let me know.

In the diff you attched you set the resolution value to a constant which
you then use.  That is certainly not what you intend, i.e. it should at
least be a variable.

I am not sure if applying the resolution to absolute posititioning
devices is a good idea either, but I doubt it.  Have you tested your
patch on a device that does absolute positioning?

That said, I think your patch needs some more work.



Home | Main Index | Thread Index | Old Index