Skip to content

Commit

Permalink
Correct variable names. Add Author and Description to module.
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoEPRodrigues committed Feb 27, 2021
1 parent c9644f4 commit 69abef8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
3 changes: 2 additions & 1 deletion etc/modprobe.d/hid-magicmouse.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ options hid-magicmouse \
scroll_acceleration=1 \
scroll_speed=25 \
middle_click_3finger=1 \
scroll_delay=50
scroll_delay_pos_x=200 \
scroll_delay_pos_y=200
31 changes: 19 additions & 12 deletions linux/drivers/hid/hid-magicmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,29 @@ static int param_set_scroll_speed(const char *val,
module_param_call(scroll_speed, param_set_scroll_speed, param_get_uint, &scroll_speed, 0644);
MODULE_PARM_DESC(scroll_speed, "Scroll speed, value from 0 (slow) to 63 (fast)");

static unsigned int scroll_delay_pox_x = 200;
static int param_set_scroll_delay_pox_x(const char *val,
static unsigned int scroll_delay_pos_x = 200;
static int param_set_scroll_delay_pos_x(const char *val,
const struct kernel_param *kp) {
unsigned long delay;
if (!val || kstrtoul(val, 0, &delay))
return -EINVAL;
scroll_delay_pox_x = delay;
scroll_delay_pos_x = delay;
return 0;
}
module_param_call(scroll_delay_pox_x, param_set_scroll_delay_pox_x, param_get_uint, &scroll_delay_pox_x, 0644);
MODULE_PARM_DESC(scroll_delay_pox_x, "Scroll X position delay before start scrolling");
module_param_call(scroll_delay_pos_x, param_set_scroll_delay_pos_x, param_get_uint, &scroll_delay_pos_x, 0644);
MODULE_PARM_DESC(scroll_delay_pos_x, "Scroll X position delay before start scrolling");

static unsigned int scroll_delay_pox_y = 200;
static int param_set_scroll_delay_pox_y(const char *val,
static unsigned int scroll_delay_pos_y = 200;
static int param_set_scroll_delay_pos_y(const char *val,
const struct kernel_param *kp) {
unsigned long delay;
if (!val || kstrtoul(val, 0, &delay))
return -EINVAL;
scroll_delay_pox_y = delay;
scroll_delay_pos_y = delay;
return 0;
}
module_param_call(scroll_delay_pox_y, param_set_scroll_delay_pox_y, param_get_uint, &scroll_delay_pox_y, 0644);
MODULE_PARM_DESC(scroll_delay_pox_y, "Scroll Y position delay before start scrolling");
module_param_call(scroll_delay_pos_y, param_set_scroll_delay_pos_y, param_get_uint, &scroll_delay_pos_y, 0644);
MODULE_PARM_DESC(scroll_delay_pos_y, "Scroll Y position delay before start scrolling");

static bool scroll_acceleration = false;
module_param(scroll_acceleration, bool, 0644);
Expand Down Expand Up @@ -362,13 +362,13 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id,
* drag events are not registered. This decreases the
* sensitivity of dragging on Magic Mouse devices.
*/
if (abs(step_x) < scroll_delay_pox_x) {
if (abs(step_x) < scroll_delay_pos_x) {
step_x = 0;
} else {
step_x /= (64 - (int)scroll_speed) * msc->scroll_accel;
}

if (abs(step_y) < scroll_delay_pox_y) {
if (abs(step_y) < scroll_delay_pos_y) {
step_y = 0;
} else {
step_y /= (64 - (int)scroll_speed) * msc->scroll_accel;
Expand Down Expand Up @@ -891,4 +891,11 @@ static struct hid_driver magicmouse_driver = {
};
module_hid_driver(magicmouse_driver);

MODULE_AUTHOR("Ricardo Rodrigues");
MODULE_AUTHOR("Rohit Pidaparthi");
MODULE_AUTHOR("Chase Douglas");
MODULE_AUTHOR("Michael Poole");

MODULE_DESCRIPTION("Magic Mouse 2 driver for Linux");

MODULE_LICENSE("GPL");

0 comments on commit 69abef8

Please sign in to comment.