Discussion:
Adding mouse sensitivity adjustment to wsmouse
(too old to reply)
Sverre Froyen
2010-05-18 21:09:18 UTC
Permalink
Hi,

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.

Regards,
Sverre
Sverre Froyen
2010-05-18 21:19:18 UTC
Permalink
Sorry, wrong list.

Sverre

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...