Skip to contentSkip to conversation

input: map BTN_FORWARD to button 2 in mousedev

PATCH In review Németh Márton 2 participants 3 messages Nov 5, 2006 – Nov 7, 2006 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 input: map BTN_FORWARD to button 2 in mousedev

From: Márton Németh <[email protected]>

In mousedev the BTN_LEFT and BTN_FORWARD were mapped to mouse button 0, causing that the user space program cannot distinguish between them through /dev/input/mice. The BTN_FORWARD is currently used in the synaptics.c, logips2pp.c and in alps.c. All mice have BTN_LEFT, but not all have BTN_MIDDLE (e.g. Clevo D410J laptop). Mapping BTN_FORWARD to mouse button 2 makes the BTN_FORWARD button useful on the mentioned laptop.

---

The Clevo D410J laptop has "AlpsPS/2 ALPS GlidePoint" touchpad having the following physical layout:

    +-------------------+ +-------------+ +-------------------+
    |                   | | BTN_FORWARD | |                   |
    |     BTN_LEFT      | +-------------+ |     BTN_RIGHT     |
    |                   | +-------------+ |                   |
    |                   | |  BTN_BACK   | |                   |
    +-------------------+ +-------------+ +-------------------+

This model does not have any BTN_MIDDLE, but the BTN_FORWARD could be used instead. The following table summarizes the map changes:

Button name | Mapping in 2.6.19-rc3 | The changed mapping
-------------+-----------------------+---------------------
BTN_LEFT | 0 | 0
BTN_RIGHT | 1 | 1
BTN_FORWARD | 0 | 2
BTN_BACK | 3 | 3

drivers/input/mousedev.c renamed from drivers/input/mousedev.c.orig +1 -1
@@ -196,12 +196,12 @@ static void mousedev_key_event(struct mo
 	switch (code) {
 		case BTN_TOUCH:
 		case BTN_0:
-		case BTN_FORWARD:
 		case BTN_LEFT:		index = 0; break;
 		case BTN_STYLUS:
 		case BTN_1:
 		case BTN_RIGHT:		index = 1; break;
 		case BTN_2:
+		case BTN_FORWARD:
 		case BTN_STYLUS2:
 		case BTN_MIDDLE:	index = 2; break;
 		case BTN_3:
#1 lore raw
Quoted 9 lines · Németh Márton

From: Márton Németh <[email protected]>

In mousedev the BTN_LEFT and BTN_FORWARD were mapped to mouse button 0, causing that the user space program cannot distinguish between them through /dev/input/mice. The BTN_FORWARD is currently used in the synaptics.c, logips2pp.c and in alps.c. All mice have BTN_LEFT, but not all have BTN_MIDDLE (e.g. Clevo D410J laptop). Mapping BTN_FORWARD to mouse button 2 makes the BTN_FORWARD button useful on the mentioned laptop.

I'd rather not touch mappings in legacy mousedev driver. I believe both synaptics and evdev X drivers will correctly recognize BTN_FORWARD, is there any reason you are not using them?

Signature · 1 line
Dmitry
#2 lore raw
Quoted 4 lines · Dmitry Torokhov
Quoted 3 lines · Németh Márton

From: Márton Németh <[email protected]>

In mousedev the BTN_LEFT and BTN_FORWARD were mapped to

mouse button 0, causing

Quoted 1 line
Quoted 1 line

that the user space program cannot distinguish between

them through /dev/input/mice.

Quoted 1 line
Quoted 1 line

The BTN_FORWARD is currently used in the synaptics.c,

logips2pp.c and in alps.c. All

Quoted 1 line
Quoted 1 line

mice have BTN_LEFT, but not all have BTN_MIDDLE (e.g.

Clevo D410J laptop). Mapping

Quoted 1 line
Quoted 1 line

BTN_FORWARD to mouse button 2 makes the BTN_FORWARD

button useful on the mentioned

Quoted 4 lines
Quoted 2 lines

laptop.

I'd rather not touch mappings in legacy mousedev driver. I

believe

Quoted 2 lines

both synaptics and evdev X drivers will correctly recognize BTN_FORWARD, is there any reason you are not using them?

If I have understand the input subsystem correctly, for the evdev X driver the mousedev.c is not needed, so using an evdev X driver is a completely other story. This map change could result that the BTN_FORWARD can be used as BTN_MIDDLE out of the box, without any additional drivers, so it is simpler (at least in case of Clevo D410J).

My patch is based on the assumption that every mouse has BTN_LEFT, so it is not worth having two mouse buttons for the same function. (For Clevo D410J it is actually an information loss at this point.)

Next thing is that the BTN_FORWARD and BTN_BACK usually comes together. The BTN_LEFT and BTN_RIGHT usually comes together also. For the mapping I see some possible mapping listed in the following table:

Button name | (a) | (b) | (c) |
---------------+-------------+-------------+-------------+
BTN_LEFT | 0 | 0 | 0 |
BTN_RIGHT | 1 | 1 | 1 |
BTN_FORWARD | 0 | 2 | 0 |
BTN_BACK | 1 | 3 | 3 |

Mapping (a) would map BTN_FORWARD and BTN_BACK to BTN_LEFT and BTN_RIGHT. Mapping (b) would map all 4 buttons to different buttons. Mapping (c) is the current mapping where the BTN_FORWARD is handled differently than BTN_BACK.

NMarci

___________________________________________________________________________
Karácsonyi sorban állás helyett vásároljon kényelmesen! Garantáltan 1 nap alatt szállítjuk a megrendelt könyveket!
http://www.bookline.hu/control/news?newsid=528&affiliate=frenapkar3171