Commit aea6a461 authored by Aristeu Rozanski's avatar Aristeu Rozanski Committed by Dmitry Torokhov

Input: psmouse - add support for Cortron PS/2 Trackballs

Cortron PS/2 Trackballs (700-0001A) report the 4th button using the 4th
bit of the first packet (yes, it breaks the standard PS/2 protocol).
This patch adds an extra protocol to generate BTN_SIDE based on the 4th
bit. There's no way to detect those trackballs using any kind of special
sequence, thus the protocol must be activated explicitely by writing
into 'protocol' sysfs attribute:

	echo -n "cortps" > /sys/devices/platform/i8042/serio1/protocol
Signed-off-by: default avatarAristeu Rozanski <arozansk@redhat.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent e01a06e8
......@@ -177,6 +177,15 @@ static psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse)
packet[1] |= (packet[0] & 0x40) << 1;
}
/*
* Cortron PS2 Trackball reports SIDE button on the 4th bit of the first
* byte.
*/
if (psmouse->type == PSMOUSE_CORTRON) {
input_report_key(dev, BTN_SIDE, (packet[0] >> 3) & 1);
packet[0] |= 0x08;
}
/*
* Generic PS/2 Mouse
*/
......@@ -539,6 +548,20 @@ static int ps2bare_detect(struct psmouse *psmouse, int set_properties)
return 0;
}
/*
* Cortron PS/2 protocol detection. There's no special way to detect it, so it
* must be forced by sysfs protocol writing.
*/
static int cortron_detect(struct psmouse *psmouse, int set_properties)
{
if (set_properties) {
psmouse->vendor = "Cortron";
psmouse->name = "PS/2 Trackball";
set_bit(BTN_SIDE, psmouse->dev->keybit);
}
return 0;
}
/*
* psmouse_extensions() probes for any extensions to the basic PS/2 protocol
......@@ -739,6 +762,12 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.detect = touchkit_ps2_detect,
},
#endif
{
.type = PSMOUSE_CORTRON,
.name = "CortronPS/2",
.alias = "cortps",
.detect = cortron_detect,
},
{
.type = PSMOUSE_AUTO,
.name = "auto",
......
......@@ -88,6 +88,7 @@ enum psmouse_type {
PSMOUSE_LIFEBOOK,
PSMOUSE_TRACKPOINT,
PSMOUSE_TOUCHKIT_PS2,
PSMOUSE_CORTRON,
PSMOUSE_AUTO /* This one should always be last */
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment