Skip to content

Instantly share code, notes, and snippets.

@Tasssadar
Created August 13, 2012 21:26
Show Gist options
  • Save Tasssadar/3344210 to your computer and use it in GitHub Desktop.
Save Tasssadar/3344210 to your computer and use it in GitHub Desktop.
Fix for kernel joystick bug
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 26043cc..11f24b4 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -318,9 +318,14 @@ static int joydev_generate_startup_event(struct joydev_client *client,
event->value = !!test_bit(joydev->keypam[event->number],
input->key);
} else {
+ int evnum = client->startup - joydev->nkey;
+ int val = input_abs_get_val(input, joydev->abspam[evnum]);
+
+ joydev->abs[evnum] = joydev_correct(val, &joydev->corr[evnum]);
+
event->type = JS_EVENT_AXIS | JS_EVENT_INIT;
- event->number = client->startup - joydev->nkey;
- event->value = joydev->abs[event->number];
+ event->number = evnum;
+ event->value = joydev->abs[evnum];
}
client->startup++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment