psmouse split
Subsystems (2)
PATCH 1/1 psmouse split
Hi,
When Zephaniah Hull sent in a patch for the OLPC touchpad [0], it was suggested that the psmouse driver be split out into separate components.
What's currently there is way too fat, and people are not happy about
adding even more code to the driver.
I've taken a stab at doing just that. The attached patch splits the various protocol extensions into their own modules, defines a protocol registration layer, and allows modules to define their own psmouse protocols. Psmouse-base now only registers a few extensions, and then scans the ps/2 ports. Other modules (ie, psmouse-alps) register their extension, and force a rescan of all serio ports that the psmouse driver happens to be using. The max_proto stuff has been removed, with the intention that people should be loading (or unloading) only the modules they need, rather than playing around w/ module arguments. Rather than playing games w/ extension detection ordering, I opted to just reset the port before every scan.
The patch is attached, and I have a git repository here:
git://dev.laptop.org/users/dilinger/psmouse-split
There's also a gitweb interface:
http://dev.laptop.org/git?p=users/dilinger/psmouse-split;a=summary
Comments and feedback are welcome. I intend to do a few further cleanups (at the very least, there are now stale header files that need to go away, and further testing is needed).
[0] http://thread.gmane.org/gmane.linux.kernel/441574/
drivers/input/mouse/Kconfig +60 -0
@@ -37,6 +37,66 @@ config MOUSE_PS2 To compile this driver as a module, choose M here: the module will be called psmouse. +config MOUSE_PS2_ALPS + tristate "ALPS PS/2 mouse protocol extension" + depends on MOUSE_PS2 + ---help--- + Say Y here if you have an ALPS PS/2 touchpad connected to + your system. + + If unsure, say Y. + + To compile this driver as a module, choose M here: the + module will be called psmouse-alps. + +config MOUSE_PS2_LOGIPS2PP + tristate "Logictech PS/2++ mouse protocol extension" + depends on MOUSE_PS2 + ---help--- + Say Y here if you have a Logictech PS/2++ mouse connected to + your system. + + If unsure, say Y. + + To compile this driver as a module, choose M here: the + module will be called psmouse-logips2pp. + +config MOUSE_PS2_SYNAPTICS + tristate "Synaptics PS/2 mouse protocol extension" + depends on MOUSE_PS2 + ---help--- + Say Y here if you have a Synaptics PS/2 TouchPad connected to + your system. + + If unsure, say Y. + + To compile this driver as a module, choose M here: the + module will be called psmouse-synaptics. + +config MOUSE_PS2_LIFEBOOK + tristate "Fujitsu Lifebook PS/2 mouse protocol extension" + depends on MOUSE_PS2 + ---help--- + Say Y here if you have a Fujitsu B-series Lifebook PS/2 + TouchScreen connected to your system. + + If unsure, say Y. + + To compile this driver as a module, choose M here: the + module will be called psmouse-lifebook. + +config MOUSE_PS2_TRACKPOINT + tristate "IBM Trackpoint PS/2 mouse protocol extension" + depends on MOUSE_PS2 + ---help--- + Say Y here if you have an IBM Trackpoint PS/2 mouse connected + to your system. + + If unsure, say Y. + + To compile this driver as a module, choose M here: the + module will be called psmouse-trackpoint. + config MOUSE_SERIAL tristate "Serial mouse" select SERIO
drivers/input/mouse/Makefile +11 -1
@@ -10,8 +10,18 @@ obj-$(CONFIG_MOUSE_INPORT) += inport.o obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o obj-$(CONFIG_MOUSE_PC110PAD) += pc110pad.o obj-$(CONFIG_MOUSE_PS2) += psmouse.o +obj-$(CONFIG_MOUSE_PS2_ALPS) += psmouse-alps.o +obj-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += psmouse-logips2pp.o +obj-$(CONFIG_MOUSE_PS2_SYNAPTICS) += psmouse-synaptics.o +obj-$(CONFIG_MOUSE_PS2_LIFEBOOK) += psmouse-lifebook.o +obj-$(CONFIG_MOUSE_PS2_TRACKPOINT) += psmouse-trackpoint.o obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o -psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o trackpoint.o +psmouse-alps-objs := alps.o +psmouse-logips2pp-objs := logips2pp.o +psmouse-synaptics-objs := synaptics.o +psmouse-lifebook-objs := lifebook.o +psmouse-trackpoint-objs := trackpoint.o +psmouse-objs := psmouse-base.o
drivers/input/mouse/alps.c +26 -2
@@ -21,6 +21,10 @@ #include <linux/libps2.h>#include "psmouse.h" #include "alps.h" +MODULE_AUTHOR ("Neil Brown <[email protected]>" ); +MODULE_DESCRIPTION ("ALPS touchpad PS/2 mouse driver" ); +MODULE_LICENSE ("GPL" ); +#undef DEBUG#ifdef DEBUG #define dbg(format, arg...) printk(KERN_INFO "alps.c: " format "\n", ## arg)
@@ -418,7 +422,7 @@ static void alps_disconnect(struct psmoukfree (priv); } -int alps_init (struct psmouse *psmouse) +static int alps_do_init (struct psmouse *psmouse) {struct alps_data *priv;struct input_dev *dev1 = psmouse->dev, *dev2;
@@ -499,7 +503,7 @@ init_fail:return -1 ; } -int alps_detect (struct psmouse *psmouse,int set_properties) +static int alps_detect (struct psmouse *psmouse,int set_properties) {int version;const struct alps_model_info *model;
@@ -516,3 +520,23 @@ int alps_detect(struct psmouse *psmouse,return 0 ; } +static struct psmouse_protocol alps_proto = { + .type =PSMOUSE_ALPS , + .name ="AlpsPS/2" , + .alias ="alps" , + .detect = alps_detect, + .init = alps_do_init, +}; + +static int __init alps_init (void ) +{ +return psmouse_protocol_register (&alps_proto,1 ); +} + +static void __exit alps_exit(void) +{ +psmouse_protocol_unregister (&alps_proto); +} + +module_init (alps_init); +module_exit (alps_exit);
drivers/input/mouse/alps.h +0 -3
@@ -12,9 +12,6 @@ #ifndef _ALPS_H #define _ALPS_H -int alps_detect(struct psmouse *psmouse, int set_properties); -int alps_init(struct psmouse *psmouse); - struct alps_model_info { unsigned char signature[3]; unsigned char byte0, mask0;
drivers/input/mouse/lifebook.c +26 -3
@@ -18,7 +18,10 @@ #include <linux/libps2.h>#include <linux/dmi.h> #include "psmouse.h" -#include "lifebook.h" + +MODULE_AUTHOR ("Vojtech Pavlik <[email protected]>" ); +MODULE_DESCRIPTION ("Fujitsu B-series Lifebook PS/2 TouchScreen driver" ); +MODULE_LICENSE ("GPL" );static struct dmi_system_id lifebook_dmi_table[] = { {
@@ -133,7 +136,7 @@ static void lifebook_disconnect(struct ppsmouse_reset (psmouse); } -int lifebook_detect (struct psmouse *psmouse,int set_properties) +static int lifebook_detect (struct psmouse *psmouse,int set_properties) {if (!dmi_check_system (lifebook_dmi_table))return -1 ;
@@ -146,7 +149,7 @@ int lifebook_detect(struct psmouse *psmoreturn 0 ; } -int lifebook_init (struct psmouse *psmouse) +static int lifebook_do_init (struct psmouse *psmouse) {struct input_dev *input_dev = psmouse->dev;
@@ -169,3 +172,23 @@ int lifebook_init(struct psmouse *psmousreturn 0 ; } +static struct psmouse_protocol lifebook_proto = { + .type =PSMOUSE_LIFEBOOK , + .name ="LBPS/2" , + .alias ="lifebook" , + .detect = lifebook_detect, + .init = lifebook_do_init, +}; + +static int __init lifebook_init (void ) +{ +return psmouse_protocol_register (&lifebook_proto,1 ); +} + +static void __exit lifebook_exit(void) +{ +psmouse_protocol_unregister (&lifebook_proto); +} + +module_init (lifebook_init); +module_exit (lifebook_exit);
drivers/input/mouse/logips2pp.c +28 -2
@@ -13,7 +13,10 @@ #include <linux/input.h>#include <linux/serio.h> #include <linux/libps2.h> #include "psmouse.h" -#include "logips2pp.h" + +MODULE_AUTHOR ("Vojtech Pavlik <[email protected]>" ); +MODULE_DESCRIPTION ("Logitech PS/2++ mouse driver" ); +MODULE_LICENSE ("GPL" );/* Logitech mouse types */ #define PS2PP_KIND_WHEEL 1
@@ -35,6 +38,10 @@ struct ps2pp_info {u16 features; }; +static unsigned int ps2pp_rescan =1 ; +module_param_named (rescan, ps2pp_rescan, uint,0644 ); +MODULE_PARM_DESC (rescan,"Rescan PS/2 ports after loading (default = 1)." ); +/* * Process a PS2++ or PS2T++ packet. */
@@ -321,7 +328,7 @@ static void ps2pp_set_model_properties(s* that support it. */ -int ps2pp_init (struct psmouse *psmouse,int set_properties) +static int ps2pp_do_init (struct psmouse *psmouse,int set_properties) {struct ps2dev *ps2dev = &psmouse->ps2dev;unsigned char param[4 ];
@@ -415,3 +422,22 @@ int ps2pp_init(struct psmouse *psmouse,return use_ps2pp ?0 :-1 ; } +static struct psmouse_protocol ps2pp_proto = { + .type =PSMOUSE_PS2PP , + .name ="PS2++" , + .alias ="logitech" , + .detect = ps2pp_do_init, +}; + +static int __init ps2pp_init (void ) +{ +return psmouse_protocol_register (&ps2pp_proto,1 ); +} + +static void __exit ps2pp_exit(void) +{ +psmouse_protocol_unregister (&ps2pp_proto); +} + +module_init (ps2pp_init); +module_exit (ps2pp_exit);
drivers/input/mouse/psmouse-base.c +116 -229
473 lines not on this page · raw message
drivers/input/mouse/psmouse.h +13 -0
@@ -1,6 +1,8 @@#ifndef _PSMOUSE_H#define _PSMOUSE_H +#include <linux/list.h> +#define PSMOUSE_CMD_SETSCALE11 0x00e6#define PSMOUSE_CMD_SETSCALE21 0x00e7#define PSMOUSE_CMD_SETRES 0x10e8
@@ -89,6 +91,17 @@ enum psmouse_type { PSMOUSE_AUTO /* This one should always be last */ }; +struct psmouse_protocol { +enum psmouse_type type; +const char *name; +const char *alias; +int (*detect)(struct psmouse *,int ); +int (*init)(struct psmouse *); +struct list_head node; +}; +int psmouse_protocol_register (struct psmouse_protocol *proto,int rescan); +void psmouse_protocol_unregister (struct psmouse_protocol *proto); +int psmouse_sliced_command (struct psmouse *psmouse,unsigned char command);int psmouse_reset (struct psmouse *psmouse);void psmouse_set_resolution (struct psmouse *psmouse,unsigned int resolution);
drivers/input/mouse/synaptics.c +48 -25
101 lines not on this page · raw message
drivers/input/mouse/synaptics.h +0 -2
@@ -9,8 +9,6 @@#ifndef _SYNAPTICS_H#define _SYNAPTICS_H -extern int synaptics_detect (struct psmouse *psmouse,int set_properties); -extern int synaptics_init (struct psmouse *psmouse);extern void synaptics_reset (struct psmouse *psmouse);/* synaptics queries */
drivers/input/mouse/trackpoint.c +24 -1
@@ -19,6 +19,10 @@ #include <asm/uaccess.h>#include "psmouse.h" #include "trackpoint.h" +MODULE_AUTHOR ("Stephen Evanchik <[email protected]>" ); +MODULE_DESCRIPTION ("IBM TrackPoint PS/2 mouse driver" ); +MODULE_LICENSE ("GPL" ); +/* * Device IO: read, write and toggle bit */
@@ -287,7 +291,7 @@ static int trackpoint_reconnect(struct preturn 0 ; } -int trackpoint_detect (struct psmouse *psmouse,int set_properties) +static int trackpoint_detect (struct psmouse *psmouse,int set_properties) {struct trackpoint_data *priv;struct ps2dev *ps2dev = &psmouse->ps2dev;
@@ -334,3 +338,22 @@ int trackpoint_detect(struct psmouse *psreturn 0 ; } +static struct psmouse_protocol trackpoint_proto = { + .type =PSMOUSE_TRACKPOINT , + .name ="TPPS/2" , + .alias ="trackpoint" , + .detect = trackpoint_detect, +}; + +static int __init trackpoint_init (void ) +{ +return psmouse_protocol_register (&trackpoint_proto,1 ); +} + +static void __exit trackpoint_exit(void) +{ +psmouse_protocol_unregister (&trackpoint_proto); +} + +module_init (trackpoint_init); +module_exit (trackpoint_exit);
drivers/input/mouse/trackpoint.h +0 -2
@@ -142,6 +142,4 @@ struct trackpoint_data unsigned char ext_dev; }; -extern int trackpoint_detect (struct psmouse *psmouse,int set_properties); -#endif /* _TRACKPOINT_H */
drivers/input/serio/serio.c +11 -0
@@ -51,6 +51,7 @@ EXPORT_SYMBOL(serio_open);EXPORT_SYMBOL (serio_close);EXPORT_SYMBOL (serio_rescan);EXPORT_SYMBOL (serio_reconnect); +EXPORT_SYMBOL (serio_for_each);/* * serio_mutex protects entire serio subsystem and is taken every time
@@ -686,6 +687,16 @@ void serio_reconnect(struct serio *serioserio_queue_event (serio,NULL ,SERIO_RECONNECT_PORT ); } +void serio_for_each (void *data,void (*fn)(struct serio *,void *)) +{ +struct serio *serio; + +mutex_lock (&serio_mutex); +list_for_each_entry (serio, &serio_list, node) +fn (serio, data); +mutex_unlock (&serio_mutex); +} +/* * Submits register request to kseriod for subsequent execution. * Note that port registration is always asynchronous.
include/linux/serio.h +1 -0
@@ -75,6 +75,7 @@ int serio_open(struct serio *serio, struvoid serio_close (struct serio *serio);void serio_rescan (struct serio *serio);void serio_reconnect (struct serio *serio); +void serio_for_each (void *data,void (*fn)(struct serio *,void *));irqreturn_t serio_interrupt (struct serio *serio,unsigned char data,unsigned int flags);void __serio_register_port (struct serio *serio,struct module *owner);
Hi Andres,
Quoted 7 lines · Andres Salomon
Hi,
When Zephaniah Hull sent in a patch for the OLPC touchpad [0], it was suggested that the psmouse driver be split out into separate components.
What's currently there is way too fat, and people are not happy about
adding even more code to the driver.
Quoted 12 lines
I've taken a stab at doing just that. The attached patch splits the various protocol extensions into their own modules, defines a protocol registration layer, and allows modules to define their own psmouse protocols. Psmouse-base now only registers a few extensions, and then scans the ps/2 ports. Other modules (ie, psmouse-alps) register their extension, and force a rescan of all serio ports that the psmouse driver happens to be using. The
max_protostuff has been removed, with the intention that people should be loading (or unloading) only the modules they need, rather than playing around w/ module arguments. Rather than playing games w/ extension detection ordering, I opted to just reset the port before every scan.
Unfortunately I do not think this is going to work well in in default case:
1. PS/2 probing order is important. You need to probe for intellimouse explorer last otherwise you might miss that mouse supports extended protocol.
2. Synaptics hardware has to be probed even if synaptics protocol is not used, otherwise intellimouse probe will case trackpoint on passthrough port not working.
3. Doing full reset after every protocol probe will cause long delays in mouse detection.
4. Maxproto is still needed - psmouse base still contains several protocols and sometimes users need to force "standard" protocols (Intellimouse/ Explorer), for example when using a KVM switch.
Also, splitting psmouse into several modules as opposed to having monolitic psmouse with an option to exclude some protocols via Kconfig does not really buy us anything - because protocol autoload is not possible (we do not know what protocols port uses until we actually do the probe) distributions will have to compile and load everything anyway. Custom kernel users will just have to compile protocols they need into psmouse.
And some comments for the patch itself:
Quoted 6 lines
+ if (
proto->detect(psmouse, set_properties)== 0) { + if (proto->type==PSMOUSE_SYNAPTICS)
+ synaptics_hardware = 1;
+ if (!set_properties) {
+ if (proto->init&&proto->init(psmouse)!= 0) + continue;
I think you wanted if (set_properties)...
drivers/input/mouse/psmouse-base.c static int ps2bare_detect(struct psmouse · line 571
Quoted 5 lines
drivers/input/mouse/psmouse-base.c +5
-0+static void psmouse_rescan (struct serio *serio,void *data) +{ + if (serio->drv->driver.name == "psmouse") + serio_rescan(serio); +}
This is going to crash if you encounter unconnected port (serio->drv == NULL).
drivers/input/mouse/synaptics.c #include <linux/libps2.h> · line 35
Quoted 3 lines
drivers/input/mouse/synaptics.c +3
-0+MODULE_AUTHOR ("C. Scott Ananian <[email protected]>" ); +MODULE_DESCRIPTION ("Synaptics TouchPad PS/2 mouse driver" ); +MODULE_LICENSE ("GPL" );
You need to be careful with code attribution - for example Synaptics driver was written by Peter Osterlund. He took some code from tpconfig utility, that's why there is C. Scott Ananian copyright notice but _module_ author is still Peter.
Quoted 2 lines
+ psmouse_protocol_register(&genius_proto, 0); + psmouse_protocol_register(&imps_proto), 0;
Hmm, does this compile?
Signature · 1 line
Dmitry
Quoted 1 line · Dmitry Torokhov
Hi Andres,
[...]
Quoted 7 lines
Unfortunately I do not think this is going to work well in in default case:
1. PS/2 probing order is important. You need to probe for intellimouse explorer last otherwise you might miss that mouse supports extended protocol.
Sorry, I'm not sure I understand; you're saying that the intellimouse probe will match other mice?
I originally had kept the probing order, but dropped it here:
I can readd it if necessary.
Quoted 4 lines
2. Synaptics hardware has to be probed even if synaptics protocol is not used, otherwise intellimouse probe will case trackpoint on passthrough port not working.
I'm aware of that, and the synaptics_hardware variable remains in the psmouse_extensions() function as a reminder. I just need to figure out a clean way to do the probing; I wanted feedback about whether people liked the broken out modules idea, first.
Quoted 2 lines
3. Doing full reset after every protocol probe will cause long delays in mouse detection.
I'm not convinced this will actually take that long, and it should only happen during init. With ordered detection and an additional field in the psmouse_protocol struct, each protocol could specify whether it should be reset or not. However, if it's not necessary, I'd rather get rid of it all (sounds like the detection ordering might be necessary, though).
Quoted 5 lines
4. Maxproto is still needed - psmouse base still contains several protocols and sometimes users need to force "standard" protocols (Intellimouse/ Explorer), for example when using a KVM switch.
Yes, I intended to split out the protocols into a separate module, as mentioned in
If a KVM requires a user to force a standard protocol, I would think that forcing it via psmouse_attr_set_protocol would be a much nicer way than dealing w/ max_proto. Combine that w/ being able to rmmod specific protocol modules (ie, rmmod psmouse-synaptics if it turns out that detection is incorrectly seeing something synaptics-like).
Quoted 3 lines
Also, splitting psmouse into several modules as opposed to having monolitic psmouse with an option to exclude some protocols via
Kconfigdoes not really buy us anything - because protocol autoload is not possible (we do not know
It does; compiling a custom kernel for users is a pain. However, using a distribution kernel and being able to control specifically which modules are loaded makes life a lot easier (users get security updates, etc).
Quoted 4 lines
what protocols port uses until we actually do the probe) distributions will have to compile and load everything anyway. Custom kernel users will just have to compile protocols they need into psmouse.
Yes, distributions will have to compile and load everything anyways. However, people who know what hardware they have can then force loading of a specific module, rather than having a monolithic module or having to recompile a custom kernel.
Quoted 11 lines
And some comments for the patch itself:
drivers/input/mouse/psmouse-base.c static int ps2bare_detect(struct psmouse · line 556
Quoted 6 lines
drivers/input/mouse/psmouse-base.c +6
-0+if (proto->detect (psmouse, set_properties) ==0 ) { +if (proto->type ==PSMOUSE_SYNAPTICS ) + synaptics_hardware =1 ; +if (!set_properties) { +if (proto->init && proto->init (psmouse) !=0 ) +continue ;I think you wanted if (
set_properties)...
Quoted 9 lines
drivers/input/mouse/psmouse-base.c static int ps2bare_detect(struct psmouse · line 571
Quoted 5 lines
drivers/input/mouse/psmouse-base.c +5
-0+static void psmouse_rescan (struct serio *serio,void *data) +{ +if (serio->drv->driver.name =="psmouse" ) +serio_rescan (serio); +}This is going to crash if you encounter unconnected port (
serio->drv== NULL).
Thanks!
Quoted 9 lines
drivers/input/mouse/synaptics.c #include <linux/libps2.h> · line 35
Quoted 3 lines
drivers/input/mouse/synaptics.c +3
-0+MODULE_AUTHOR ("C. Scott Ananian <[email protected]>" ); +MODULE_DESCRIPTION ("Synaptics TouchPad PS/2 mouse driver" ); +MODULE_LICENSE ("GPL" );You need to be careful with code attribution - for example Synaptics driver was written by Peter Osterlund. He took some code from tpconfig utility, that's why there is C. Scott Ananian copyright notice but _module_ author is still Peter.
Indeed, that was among the comments I was looking for. The copyright attribution in each protocol file wasn't clear. Before actually considering this done, we'd need to go through each module and make sure that attribution is correct.
Quoted 5 lines
drivers/input/mouse/psmouse-base.c static int __init psmouse_init(void) · line 1419
Quoted 2 lines
drivers/input/mouse/psmouse-base.c +2
-0+psmouse_protocol_register (&genius_proto,0 ); +psmouse_protocol_register (&imps_proto),0 ;Hmm, does this compile?
Oops, that was a mispaste between what I was testing and what I'd committed.
Thanks for the feedback!
Dmitry Torokhov
maintainerQuoted 6 lines · Andres Salomon
Quoted 1 line · Dmitry Torokhov
Hi Andres,
[...]
Quoted 3 lines
Unfortunately I do not think this is going to work well in in default case:
Quoted 8 lines
Quoted 4 lines
1. PS/2 probing order is important. You need to probe for intellimouse explorer last otherwise you might miss that mouse supports extended protocol.
Sorry, I'm not sure I understand; you're saying that the intellimouse probe will match other mice?
Yes, for example many Logitech mice supporting PS2++ will respond to intellimouse and explorer probes. Some versions of synaptics firmware support intellimouse protocol as well. I am pretty sure ALPS does too.
Quoted 13 lines
I originally had kept the probing order, but dropped it here:
I can readd it if necessary.
Quoted 4 lines
2. Synaptics hardware has to be probed even if synaptics protocol is not used, otherwise intellimouse probe will case trackpoint on passthrough port not working.
Quoted 5 lines
I'm aware of that, and the
synaptics_hardwarevariable remains in thepsmouse_extensions()function as a reminder. I just need to figure out a clean way to do the probing; I wanted feedback about whether people liked the broken out modules idea, first.
OK.
Quoted 5 lines
Quoted 3 lines
3. Doing full reset after every protocol probe will cause long delays in mouse detection.
Quoted 7 lines
I'm not convinced this will actually take that long, and it should only happen during init. With ordered detection and an additional field in the
psmouse_protocolstruct, each protocol could specify whether it should be reset or not. However, if it's not necessary, I'd rather get rid of it all (sounds like the detection ordering might be necessary, though).
Resets are needed. We used not to have it but that confused some mice.
Quoted 9 lines
Quoted 5 lines
4. Maxproto is still needed - psmouse base still contains several protocols and sometimes users need to force "standard" protocols (Intellimouse/ Explorer), for example when using a KVM switch.
Yes, I intended to split out the protocols into a separate module, as mentioned in
Quoted 8 lines
If a KVM requires a user to force a standard protocol, I would think that forcing it via
psmouse_attr_set_protocolwould be a much nicer way than dealing w/max_proto. Combine that w/ being able to rmmod specific protocol modules (ie, rmmod psmouse-synaptics if it turns out that detection is incorrectly seeing something synaptics-like).
That requires changing your init scripts and such. In many instances specifying psmouse.max_proto on kernel command line is the easiest way.
Quoted 16 lines
Quoted 4 lines
Also, splitting psmouse into several modules as opposed to having monolitic psmouse with an option to exclude some protocols via
Kconfigdoes not really buy us anything - because protocol autoload is not possible (we do not knowIt does; compiling a custom kernel for users is a pain. However, using a distribution kernel and being able to control specifically which modules are loaded makes life a lot easier (users get security updates, etc).
Quoted 4 lines
what protocols port uses until we actually do the probe) distributions will have to compile and load everything anyway. Custom kernel users will just have to compile protocols they need into psmouse.
Quoted 5 lines
Yes, distributions will have to compile and load everything anyways. However, people who know what hardware they have can then force loading of a specific module, rather than having a monolithic module or having to recompile a custom kernel.
I would consider this module juggling way over the head for average user. I want to have the ability to exclude some protocols from psmouse module via Kconfig option, but I want it to be hidden under CONFIG_EMBEDDED for everything except very raretic protocols (like OLPC).
Signature · 1 line
Dmitry
Quoted 2 lines · Dmitry Torokhov
Quoted 1 line · Andres Salomon
Dmitry Torokhov wrote:
[...]
Quoted 8 lines
Quoted 7 lines
If a KVM requires a user to force a standard protocol, I would think that forcing it via
psmouse_attr_set_protocolwould be a much nicer way than dealing w/max_proto. Combine that w/ being able to rmmod specific protocol modules (ie, rmmod psmouse-synaptics if it turns out that detection is incorrectly seeing something synaptics-like).
Quoted 4 lines
That requires changing your init scripts and such. In many instances specifying psmouse.max_proto on kernel command line is the easiest way.
Init script changing shouldn't be necessary; we have module blacklist stuff.
For example, on an ubuntu system, we have:
/etc/modprobe.d/blacklist
psmouse-foo causing problems? Just add it in there, and you're good.
I'm not aware of any way to specify values to be set in /sys (similar to /etc/sysctl.conf), but I'm sure we'll get something sooner or later.
Quoted 27 lines
Quoted 17 lines
Quoted 2 lines
Also, splitting psmouse into several modules as opposed to having
monolitic
Quoted 1 line
psmouse with an option to exclude some protocols via
Kconfigdoesnot really
Quoted 1 line
buy us anything - because protocol autoload is not possible (we do
not know
It does; compiling a custom kernel for users is a pain. However, using a distribution kernel and being able to control specifically which modules are loaded makes life a lot easier (users get security updates, etc).
Quoted 1 line
what protocols port uses until we actually do the probe)
distributions will
Quoted 1 line
have to compile and load everything anyway. Custom kernel users will
Quoted 9 lines
just
Quoted 2 lines
have to compile protocols they need into psmouse.
Yes, distributions will have to compile and load everything anyways. However, people who know what hardware they have can then force loading of a specific module, rather than having a monolithic module or having to recompile a custom kernel.
Quoted 6 lines
I would consider this module juggling way over the head for average user. I want to have the ability to exclude some protocols from psmouse module via
Kconfigoption, but I want it to be hidden underCONFIG_EMBEDDEDfor everything except very raretic protocols (like OLPC).
Alright, I guess we're down to a matter of taste then. I'll change the patch to still have a monolithic psmouse that allows protocols to be enabled/disabled via Kconfig.
Dmitry Torokhov
maintainerQuoted 5 lines · Andres Salomon
Alright, I guess we're down to a matter of taste then. I'll change the patch to still have a monolithic psmouse that allows protocols to be enabled/disabled via
Kconfig.
That'd be great. Thanks!
Signature · 1 line
Dmitry
Re: [PATCH] psmouse split [01/03]
Quoted 9 lines · Dmitry Torokhov
Quoted 5 lines · Andres Salomon
Alright, I guess we're down to a matter of taste then. I'll change the patch to still have a monolithic psmouse that allows protocols to be enabled/disabled via
Kconfig.That'd be great. Thanks!
Yikes, almost forgot to send this. Here you go; 3 patches total. Please let me know if there are any other change. The first is attached.
Quoted 1 line
From
3238fbc61c7879c38d750b710dd009560b815ab4Mon Sep 17 00:00:00 2001
From: Andres Salomon <[email protected]>
Date: Tue, 26 Dec 2006 16:24:57 -0500
Subject: [PATCH] Create PS/2 protocol options for Kconfig
Initial framework for disabling PS/2 protocol extensions. The current protocols can only be disabled if CONFIG_EMBEDDED is selected. No source files are changed w/ this patch, merely build stuff.
--- drivers/input/mouse/Kconfig | 50 ++++++++++++++++++++++++++++++++++++++++++ drivers/input/mouse/Makefile | 22 ++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletions(-)
drivers/input/mouse/Kconfig +50 -0
@@ -37,6 +37,56 @@ config MOUSE_PS2 To compile this driver as a module, choose M here: the module will be called psmouse. +config MOUSE_PS2_ALPS + bool "ALPS PS/2 mouse protocol extension" if EMBEDDED + default y + depends on MOUSE_PS2 + ---help--- + Say Y here if you have an ALPS PS/2 touchpad connected to + your system. + + If unsure, say Y. + +config MOUSE_PS2_LOGIPS2PP + bool "Logictech PS/2++ mouse protocol extension" if EMBEDDED + default y + depends on MOUSE_PS2 + ---help--- + Say Y here if you have a Logictech PS/2++ mouse connected to + your system. + + If unsure, say Y. + +config MOUSE_PS2_SYNAPTICS + bool "Synaptics PS/2 mouse protocol extension" if EMBEDDED + default y + depends on MOUSE_PS2 + ---help--- + Say Y here if you have a Synaptics PS/2 TouchPad connected to + your system. + + If unsure, say Y. + +config MOUSE_PS2_LIFEBOOK + bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED + default y + depends on MOUSE_PS2 + ---help--- + Say Y here if you have a Fujitsu B-series Lifebook PS/2 + TouchScreen connected to your system. + + If unsure, say Y. + +config MOUSE_PS2_TRACKPOINT + bool "IBM Trackpoint PS/2 mouse protocol extension" if EMBEDDED + default y + depends on MOUSE_PS2 + ---help--- + Say Y here if you have an IBM Trackpoint PS/2 mouse connected + to your system. + + If unsure, say Y. + config MOUSE_SERIAL tristate "Serial mouse" select SERIO
drivers/input/mouse/Makefile +21 -1
@@ -14,4 +14,24 @@ obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o -psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o trackpoint.o +psmouse-objs := psmouse-base.o + +ifeq ($(CONFIG_MOUSE_PS2_ALPS),y) +psmouse-objs += alps.o +endif + +ifeq ($(CONFIG_MOUSE_PS2_LOGIPS2PP),y) +psmouse-objs += logips2pp.o +endif + +ifeq ($(CONFIG_MOUSE_PS2_SYNAPTICS),y) +psmouse-objs += synaptics.o +endif + +ifeq ($(CONFIG_MOUSE_PS2_LIFEBOOK),y) +psmouse-objs += lifebook.o +endif + +ifeq ($(CONFIG_MOUSE_PS2_TRACKPOINT),y) +psmouse-objs += trackpoint.o +endif
Signature · 1 line
1.4.1
Re: [PATCH] psmouse split [02/03]
Quoted 6 lines · Andres Salomon
Quoted 5 lines · Dmitry Torokhov
Quoted 4 lines · Andres Salomon
Alright, I guess we're down to a matter of taste then. I'll change the patch to still have a monolithic psmouse that allows protocols to be enabled/disabled via
Kconfig.
Quoted 6 lines
Quoted 2 lines
That'd be great. Thanks!
Yikes, almost forgot to send this. Here you go; 3 patches total. Please let me know if there are any other change. The first is attached.
Here's the second; everything is split except for the synaptic stuff.
Quoted 1 line
From
712d339038bb348c354f5e7472f1f156e485bda3Mon Sep 17 00:00:00 2001
From: Andres Salomon <[email protected]>
Date: Tue, 26 Dec 2006 16:50:47 -0500
Subject: [PATCH] Wrap all protocols except for synaptics w/ ifdefs
This patch allows ALPS, LOGIPS2PP, LIFEBOOK, and TRACKPOINT protocol extensions to be disabled during compilation. The synaptics stuff is left alone for now, since it needs special handling for synaptic pass-through ports.
--- drivers/input/mouse/psmouse-base.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
drivers/input/mouse/psmouse-base.c +16 -0
@@ -555,6 +555,7 @@ static int psmouse_extensions(struct psm {int synaptics_hardware =0 ; +#ifdef CONFIG_MOUSE_PS2_LIFEBOOK /* * We always check for lifebook because it does not disturb mouse * (it only checks DMI information).
@@ -565,6 +566,7 @@ static int psmouse_extensions(struct psm return PSMOUSE_LIFEBOOK; } } +#endif /* * Try Kensington ThinkingMouse (we try first, because synaptics probe
@@ -596,6 +598,7 @@ static int psmouse_extensions(struct psmsynaptics_reset (psmouse); } +#ifdef CONFIG_MOUSE_PS2_ALPS /* * Try ALPS TouchPad */
@@ -610,15 +613,20 @@ static int psmouse_extensions(struct psm max_proto = PSMOUSE_IMEX; } } +#endif if (max_proto >PSMOUSE_IMEX &&genius_detect (psmouse, set_properties) ==0 )return PSMOUSE_GENPS ; +#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP if (max_proto >PSMOUSE_IMEX &&ps2pp_init (psmouse, set_properties) ==0 )return PSMOUSE_PS2PP ; +#endif +#ifdef CONFIG_MOUSE_PS2_TRACKPOINT if (max_proto >PSMOUSE_IMEX &&trackpoint_detect (psmouse, set_properties) ==0 )return PSMOUSE_TRACKPOINT ; +#endif /* * Reset to defaults in case the device got confused by extended
@@ -660,12 +668,14 @@ static const struct psmouse_protocol psm .maxproto = 1, .detect = ps2bare_detect, }, +#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP { .type = PSMOUSE_PS2PP, .name = "PS2++", .alias = "logitech", .detect = ps2pp_init, }, +#endif { .type = PSMOUSE_THINKPS, .name = "ThinkPS/2",
@@ -699,6 +709,7 @@ static const struct psmouse_protocol psm .detect = synaptics_detect, .init = synaptics_init, }, +#ifdef CONFIG_MOUSE_PS2_ALPS { .type = PSMOUSE_ALPS, .name = "AlpsPS/2",
@@ -706,18 +717,23 @@ static const struct psmouse_protocol psm .detect = alps_detect, .init = alps_init, }, +#endif +#ifdef CONFIG_MOUSE_PS2_LIFEBOOK { .type = PSMOUSE_LIFEBOOK, .name = "LBPS/2", .alias = "lifebook", .init = lifebook_init, }, +#endif +#ifdef CONFIG_MOUSE_PS2_TRACKPOINT { .type = PSMOUSE_TRACKPOINT, .name = "TPPS/2", .alias = "trackpoint", .detect = trackpoint_detect, }, +#endif { .type = PSMOUSE_AUTO, .name = "auto",
Signature · 1 line
1.4.1
Re: [PATCH] psmouse split [03/03]
Quoted 11 lines · Andres Salomon
Quoted 10 lines · Andres Salomon
Quoted 7 lines · Dmitry Torokhov
Quoted 4 lines · Andres Salomon
Alright, I guess we're down to a matter of taste then. I'll change the patch to still have a monolithic psmouse that allows protocols to be enabled/disabled via
Kconfig.That'd be great. Thanks!
Yikes, almost forgot to send this. Here you go; 3 patches total. Please let me know if there are any other change. The first is attached.
^
Er, let me know if you'd like any other changes.
Quoted 4 lines
Quoted 1 line
Here's the second; everything is split except for the synaptic stuff.
And finally, the third splits out the synaptic stuff.
My initial tests show that compiling the psmouse driver for a specific protocol extension can cut the driver's size by more than half.
Quoted 1 line
From
ba82c3e427cd9e319e5d8898c2f730589da698a6Mon Sep 17 00:00:00 2001
From: Andres Salomon <[email protected]>
Date: Tue, 26 Dec 2006 17:13:42 -0500
Subject: [PATCH] Allow disabling of synaptic protocol extension
This allows disabling of synaptic; basically, it leaves synaptic_detect() and synaptic_reset() (for synaptic hardware emulating other protocols), but gets rid of synaptic_init.
--- drivers/input/mouse/Makefile | 6 +----- drivers/input/mouse/psmouse-base.c | 5 +++++ drivers/input/mouse/synaptics.c | 34 ++++++++++++++++++++++------------ 3 files changed, 28 insertions(+), 17 deletions(-)
drivers/input/mouse/Makefile +1 -5
@@ -14,7 +14,7 @@ obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o -psmouse-objs := psmouse-base.o +psmouse-objs := psmouse-base.o synaptics.o ifeq ($(CONFIG_MOUSE_PS2_ALPS),y) psmouse-objs += alps.o
@@ -24,10 +24,6 @@ ifeq ($(CONFIG_MOUSE_PS2_LOGIPS2PP),y) psmouse-objs += logips2pp.o endif -ifeq ($(CONFIG_MOUSE_PS2_SYNAPTICS),y) -psmouse-objs += synaptics.o -endif - ifeq ($(CONFIG_MOUSE_PS2_LIFEBOOK),y) psmouse-objs += lifebook.o endif
drivers/input/mouse/psmouse-base.c +5 -0
@@ -583,8 +583,11 @@ #endif synaptics_hardware =1 ;if (max_proto >PSMOUSE_IMEX ) { +#ifdef CONFIG_MOUSE_PS2_SYNAPTICS if (!set_properties ||synaptics_init (psmouse) ==0 )return PSMOUSE_SYNAPTICS ; +#endif +/* * Some Synaptics touchpads can emulate extended protocols (like IMPS/2). * Unfortunately Logitech/Genius probes confuse some firmware versions so
@@ -702,6 +705,7 @@ #endif .maxproto = 1, .detect = im_explorer_detect, }, +#ifdef CONFIG_MOUSE_PS2_SYNAPTICS { .type = PSMOUSE_SYNAPTICS, .name = "SynPS/2",
@@ -709,6 +713,7 @@ #endif .detect = synaptics_detect, .init = synaptics_init, }, +#endif #ifdef CONFIG_MOUSE_PS2_ALPS { .type = PSMOUSE_ALPS,
drivers/input/mouse/synaptics.c +22 -12
@@ -45,28 +45,30 @@ #define YMAX_NOMINAL 4448****************************************************************************/ /* -* Send a command to the synpatics touchpad by special commands +* Set the synaptics touchpad mode byte by special commands */ -static int synaptics_send_cmd (struct psmouse *psmouse,unsigned char c,unsigned char *param) +static int synaptics_mode_cmd (struct psmouse *psmouse,unsigned char mode) { -if (psmouse_sliced_command (psmouse, c)) +unsigned char param[1 ]; + +if (psmouse_sliced_command (psmouse, mode))return -1 ; -if (ps2_command (&psmouse->ps2dev, param,PSMOUSE_CMD_GETINFO )) + param[0 ] =SYN_PS_SET_MODE2 ; +if (ps2_command (&psmouse->ps2dev, param,PSMOUSE_CMD_SETRATE ))return -1 ;return 0 ; } +#ifdef CONFIG_MOUSE_PS2_SYNAPTICS +/* -* Set the synaptics touchpad mode byte by special commands +* Send a command to the synpatics touchpad by special commands */ -static int synaptics_mode_cmd (struct psmouse *psmouse,unsigned char mode) +static int synaptics_send_cmd (struct psmouse *psmouse,unsigned char c,unsigned char *param) { -unsigned char param[1 ]; - -if (psmouse_sliced_command (psmouse, mode)) +if (psmouse_sliced_command (psmouse, c))return -1 ; - param[0 ] =SYN_PS_SET_MODE2 ; -if (ps2_command (&psmouse->ps2dev, param,PSMOUSE_CMD_SETRATE )) +if (ps2_command (&psmouse->ps2dev, param,PSMOUSE_CMD_GETINFO ))return -1 ;return 0 ; }
@@ -529,12 +531,16 @@ static void set_input_params(struct inpuclear_bit (REL_Y , dev->relbit); } +#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ +void synaptics_reset (struct psmouse *psmouse) {/* reset touchpad back to relative mode, gestures enabled */ synaptics_mode_cmd (psmouse,0 ); } +#ifdef CONFIG_MOUSE_PS2_SYNAPTICS +static void synaptics_disconnect (struct psmouse *psmouse) {synaptics_reset (psmouse);
@@ -569,6 +575,8 @@ static int synaptics_reconnect(struct ps return 0; } +#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ +int synaptics_detect (struct psmouse *psmouse,int set_properties) {struct ps2dev *ps2dev = &psmouse->ps2dev;
@@ -593,6 +601,8 @@ int synaptics_detect(struct psmouse *psmreturn 0 ; } +#ifdef CONFIG_MOUSE_PS2_SYNAPTICS +#if defined(__i386__)#include <linux/dmi.h> static struct dmi_system_id toshiba_dmi_table[] = {
@@ -679,4 +689,4 @@ #endif return -1; } - +#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
Signature · 1 line
1.4.1
Re: [PATCH] psmouse split [01/03]
In reply to Andres SalomonHi Andres.
Quoted 20 lines
drivers/input/mouse/Makefile +11
-1@@ -14,4 +14,24 @@ obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o -psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o trackpoint.o +psmouse-objs := psmouse-base.o + +ifeq ($(CONFIG_MOUSE_PS2_ALPS),y) +psmouse-objs += alps.o +endif + +ifeq ($(CONFIG_MOUSE_PS2_LOGIPS2PP),y) +psmouse-objs += logips2pp.o +endif + +ifeq ($(CONFIG_MOUSE_PS2_SYNAPTICS),y)
drivers/input/mouse/Makefile obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o · line 37
Quoted 10 lines
drivers/input/mouse/Makefile +10
-0+psmouse-objs += synaptics.o +endif + +ifeq ($(CONFIG_MOUSE_PS2_LIFEBOOK),y) +psmouse-objs += lifebook.o +endif + +ifeq ($(CONFIG_MOUSE_PS2_TRACKPOINT),y) +psmouse-objs += trackpoint.o +endif
The above code should be redone to use list based assignement. Something like this:
psmouse-y := psmouse-base.o
psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o psmouse-$(CONFIG_MOUSE_PS2_SYNAPTICS) += synaptics.o psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o
psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT) += trackpoint.o
Sam
Re: [PATCH] psmouse split [01/03]
Quoted 2 lines · Sam Ravnborg
Hi Andres.
[...]
Quoted 4 lines
The above code should be redone to use list based assignement. Something like this:
Quoted 8 lines
psmouse-y := psmouse-base.o
psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o psmouse-$(CONFIG_MOUSE_PS2_SYNAPTICS) += synaptics.o psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.opsmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT) += trackpoint.o
Sam
Thanks; committed to my git repo.
http://dev.laptop.org/git?p=users/dilinger/psmouse-split;a=shortlog;h=psmouse-static