aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-02-21 23:54:31 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-02-22 01:09:55 -0500
commit315543fd112ae3b573bc44e7dbfef99c11714610 (patch)
tree4c5aac060a1a58e5f0ba818bc5647812ab609ebe /drivers
parentd38fcb9690532e6e2e064d711262b14d638113b9 (diff)
Input: gamecon - simplify coordinate calculation for PSX
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/joystick/gamecon.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index ec01bea8dc81..d57edd4a5992 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -630,8 +630,10 @@ static void gc_psx_report_one(struct gc *gc, struct input_dev *dev,
630 input_report_abs(dev, gc_psx_abs[i + 2], 630 input_report_abs(dev, gc_psx_abs[i + 2],
631 data[i + 2]); 631 data[i + 2]);
632 632
633 input_report_abs(dev, ABS_X, 128 + !(data[0] & 0x20) * 127 - !(data[0] & 0x80) * 128); 633 input_report_abs(dev, ABS_X,
634 input_report_abs(dev, ABS_Y, 128 + !(data[0] & 0x40) * 127 - !(data[0] & 0x10) * 128); 634 !!(data[0] & 0x80) * 128 + !(data[0] & 0x20) * 127);
635 input_report_abs(dev, ABS_Y,
636 !!(data[0] & 0x10) * 128 + !(data[0] & 0x40) * 127);
635 } 637 }
636 638
637 for (i = 0; i < 8; i++) 639 for (i = 0; i < 8; i++)
@@ -650,8 +652,10 @@ static void gc_psx_report_one(struct gc *gc, struct input_dev *dev,
650 input_report_key(dev, gc_psx_ddr_btn[i], 652 input_report_key(dev, gc_psx_ddr_btn[i],
651 ~data[0] & (0x10 << i)); 653 ~data[0] & (0x10 << i));
652 } else { 654 } else {
653 input_report_abs(dev, ABS_X, 128 + !(data[0] & 0x20) * 127 - !(data[0] & 0x80) * 128); 655 input_report_abs(dev, ABS_X,
654 input_report_abs(dev, ABS_Y, 128 + !(data[0] & 0x40) * 127 - !(data[0] & 0x10) * 128); 656 !!(data[0] & 0x80) * 128 + !(data[0] & 0x20) * 127);
657 input_report_abs(dev, ABS_Y,
658 !!(data[0] & 0x10) * 128 + !(data[0] & 0x40) * 127);
655 659
656 /* 660 /*
657 * For some reason if the extra axes are left unset 661 * For some reason if the extra axes are left unset