--- drivers/input/mousedev.c-orig 2006-06-06 20:15:28.000000000 -0400 +++ drivers/input/mousedev.c 2006-06-07 21:07:32.000000000 -0400 @@ -27,6 +27,7 @@ #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX #include #endif +#include MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces"); @@ -51,11 +52,91 @@ module_param(tap_time, uint, 0644); MODULE_PARM_DESC(tap_time, "Tap time for touchpads in absolute mode (msecs)"); +#ifndef CONFIG_MOUSE_SCALE +#define CONFIG_MOUSE_SCALE 100 +#endif + +static int scale = CONFIG_MOUSE_SCALE; +module_param(scale, uint, 0644); +MODULE_PARM_DESC(scale, "Mouse speed scale factor"); + +#ifndef CONFIG_MOUSE_RESOLUTION +#define CONFIG_MOUSE_RESOLUTION 400 +#endif + +static int mres = CONFIG_MOUSE_RESOLUTION; +module_param(mres, uint, 0644); +MODULE_PARM_DESC(mres, "Mouse resolution (mickeys/in)"); + +/* + * sysctl-tuning infrastructure. + */ +static ctl_table mouse_table[] = { + { + .ctl_name = 1, + .procname = "scale", + .data = &scale, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, + { + .ctl_name = 1, + .procname = "mouse_resolution", + .data = &mres, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, + { + .ctl_name = 1, + .procname = "screen_resolution_horizontal", + .data = &xres, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, + { + .ctl_name = 1, + .procname = "screen_resolution_vertical", + .data = &yres, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + }, + { .ctl_name = 0 } +}; + +static ctl_table mouse_root[] = { + { + .ctl_name = 1, + .procname = "mouse", + .maxlen = 0, + .mode = 0555, + .child = mouse_table, + }, + { .ctl_name = 0 } +}; + +static ctl_table dev_root[] = { + { + .ctl_name = CTL_DEV, + .procname = "dev", + .maxlen = 0, + .mode = 0555, + .child = mouse_root, + }, + { .ctl_name = 0 } +}; + +static struct ctl_table_header *sysctl_header; + struct mousedev_hw_data { int dx, dy, dz; int x, y; int abs_event; unsigned long buttons; + int x_accum, y_accum; }; struct mousedev { @@ -176,8 +257,18 @@ static void mousedev_rel_event(struct mousedev *mousedev, unsigned int code, int value) { switch (code) { - case REL_X: mousedev->packet.dx += value; break; - case REL_Y: mousedev->packet.dy -= value; break; + case REL_X: + mousedev->packet.x_accum += value*scale*xres; + mousedev->packet.dx += (int)mousedev->packet.x_accum/(450*mres); + mousedev->packet.x_accum -= ((int)mousedev->packet.x_accum/ + (450*mres))*(450*mres); + break; + case REL_Y: + mousedev->packet.y_accum += value * scale*xres; + mousedev->packet.dy -= (int)mousedev->packet.y_accum/(450*mres); + mousedev->packet.y_accum -= ((int)mousedev->packet.y_accum/ + (450*mres)) * (450*mres); + break; case REL_WHEEL: mousedev->packet.dz -= value; break; } } @@ -747,11 +838,15 @@ printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n"); + sysctl_header = register_sysctl_table(dev_root, 0); + return 0; } static void __exit mousedev_exit(void) { + unregister_sysctl_table(sysctl_header); + #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX if (psaux_registered) misc_deregister(&psaux_mouse); --- drivers/input/Kconfig-orig 2006-06-05 20:27:00.000000000 -0400 +++ drivers/input/Kconfig 2006-06-08 21:40:55.000000000 -0400 @@ -58,20 +58,39 @@ depends on INPUT_MOUSEDEV default "1024" help - If you're using a digitizer, or a graphic tablet, and want to use - it as a mouse then the mousedev driver needs to know the X window - screen resolution you are using to correctly scale the data. If - you're not using a digitizer, this value is ignored. + The mousedev driver needs to know the X window screen + resolution you are using to correctly scale the data. This + value may be updated at run time, for example: + echo "1024" > /proc/sys/dev/mouse/screen_resolution_horizontal config INPUT_MOUSEDEV_SCREEN_Y int "Vertical screen resolution" depends on INPUT_MOUSEDEV default "768" help - If you're using a digitizer, or a graphic tablet, and want to use - it as a mouse then the mousedev driver needs to know the X window - screen resolution you are using to correctly scale the data. If - you're not using a digitizer, this value is ignored. + The mousedev driver needs to know the X window screen + resolution you are using to correctly scale the data. This + value may be updated at run time, for example: + echo "768" > /proc/sys/dev/mouse/screen_resolution_vertical + +config MOUSE_SCALE + int "Mouse scale factor" + depends on INPUT_MOUSEDEV + default "100" + help + Mouse scale factor. Set to 100 for normal mouse speed, or + higher or lower to speed up or slow down your mouse. This + value may be updated at run time, for example: + echo "100" > /proc/sys/dev/mouse/scale + +config MOUSE_RESOLUTION + int "Mouse resolution" + depends on INPUT_MOUSEDEV + default "400" + help + Mouse resolution, in mickeys/inch. This + value may be updated at run time, for example: + echo "400" > /proc/sys/dev/mouse/mouse_resolution config INPUT_JOYDEV tristate "Joystick interface"