[PATCH] HID: magicmouse: Add parameter to be able to adjust middle button position.

From: Supasak Sutha
Date: Wed Aug 17 2022 - 06:50:43 EST


Apparently the driver fixed the offset of middle button to [-350, +350].
Which separated the area to 3 equally space for 3 buttons.
Lead to a lot of mis-clicking as the magicmouse has no real button.
Users should be able to adjust the buttons to suite their fingers.

This patch add parameters to adjust theses offsets,
while keeping the default values to [-350, +350].

Signed-off-by: Supasak Sutha <blur.3rd@xxxxxxxxx>
---
drivers/hid/hid-magicmouse.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 664a624a363d..9709085647fb 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -25,7 +25,12 @@ module_param(emulate_3button, bool, 0644);
MODULE_PARM_DESC(emulate_3button, "Emulate a middle button");

static int middle_button_start = -350;
+module_param(middle_button_start, int, 0644);
+MODULE_PARM_DESC(middle_button_start, "Middle button beginning offset");
+
static int middle_button_stop = +350;
+module_param(middle_button_stop, int, 0644);
+MODULE_PARM_DESC(middle_button_stop, "Middle button end offset");

static bool emulate_scroll_wheel = true;
module_param(emulate_scroll_wheel, bool, 0644);
--
2.37.1