From 2fd5f29adefcfe8a1b380c1e6601eef579c5a92d Mon Sep 17 00:00:00 2001 From: Nirenjan Krishnan Date: Thu, 25 Oct 2012 00:01:05 -0700 Subject: [PATCH] Correct handling of URB for stick axes - closes #1 The le32_to_cpu function doesn't quite work for some reason. Manually writing the 32-bit conversion seems to fix the axes reporting for ABS_X, ABS_Y and ABS_RZ. --- kernel_module/x52joy_input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel_module/x52joy_input.c b/kernel_module/x52joy_input.c index 9d83657..069410c 100644 --- a/kernel_module/x52joy_input.c +++ b/kernel_module/x52joy_input.c @@ -29,7 +29,10 @@ static void x52pro_decode_urb(struct x52_joy *joy, unsigned char *data) { struct input_dev *idev = joy->idev; - u32 stick_axis = le32_to_cpu(&data[0]); + u32 stick_axis = data[3]; + stick_axis = (stick_axis << 8) | data[2]; + stick_axis = (stick_axis << 8) | data[1]; + stick_axis = (stick_axis << 8) | data[0]; input_report_key(idev, BTN_TRIGGER_HAPPY1, data[8] & 0x01); input_report_key(idev, BTN_TRIGGER_HAPPY2, data[8] & 0x02);