Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ae91d10aab2762f81733e9194cb56eff99c8d808
Commit:     ae91d10aab2762f81733e9194cb56eff99c8d808
Parent:     6426b333a7365035ede9744faa24bdc5682fad8a
Author:     Dmitry Torokhov <[EMAIL PROTECTED]>
AuthorDate: Thu Jun 14 23:49:55 2007 -0400
Committer:  Dmitry Torokhov <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 00:35:18 2007 -0400

    Input: xpad - fix report for dpad and inverted Y and RY axes on xbox 360
    
    Make the driver report Y/RY up as positive value and down as negative. Also
    make DPAD mapping the same as classic xpad.
    
    Reported-by: Brian Magnuson <[EMAIL PROTECTED]>
    Tested-by: Jan Kratochvil <[EMAIL PROTECTED]>
    Signed-off-by: Dmitry Torokhov <[EMAIL PROTECTED]>
---
 drivers/input/joystick/xpad.c |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index de4fa8c..244089c 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -236,8 +236,8 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 
cmd, unsigned char *d
        } else /* xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS */ {
                input_report_key(dev, BTN_LEFT,  data[2] & 0x04);
                input_report_key(dev, BTN_RIGHT, data[2] & 0x08);
-               input_report_key(dev, BTN_0,     data[2] & 0x01); // up
-               input_report_key(dev, BTN_1,     data[2] & 0x02); // down
+               input_report_key(dev, BTN_0,     data[2] & 0x01); /* up */
+               input_report_key(dev, BTN_1,     data[2] & 0x02); /* down */
        }
 
        /* start/back buttons and stick press left/right */
@@ -275,40 +275,40 @@ static void xpad360_process_packet(struct usb_xpad *xpad, 
u16 cmd, unsigned char
 
        /* digital pad */
        if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) {
-               input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x01) - 
!!((data[2] & 0x08) >> 3));
-               input_report_abs(dev, ABS_HAT0Y, !!((data[2] & 0x02) >> 1) - 
!!((data[2] & 0x04) >> 2));
-       } else if ( xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS ) {
+               input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - 
!!(data[2] & 0x04));
+               input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - 
!!(data[2] & 0x01));
+       } else if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) {
                /* dpad as buttons (right, left, down, up) */
-               input_report_key(dev, BTN_RIGHT, (data[2] & 0x01));
-               input_report_key(dev, BTN_LEFT, (data[2] & 0x08) >> 3);
-               input_report_key(dev, BTN_0, (data[2] & 0x02) >> 1);
-               input_report_key(dev, BTN_1, (data[2] & 0x04) >> 2);
+               input_report_key(dev, BTN_LEFT, data[2] & 0x04);
+               input_report_key(dev, BTN_RIGHT, data[2] & 0x08);
+               input_report_key(dev, BTN_0, data[2] & 0x01);   /* up */
+               input_report_key(dev, BTN_1, data[2] & 0x02);   /* down */
        }
 
        /* start/back buttons */
-       input_report_key(dev, BTN_START,  (data[2] & 0x10) >> 4);
-       input_report_key(dev, BTN_BACK,   (data[2] & 0x20) >> 5);
+       input_report_key(dev, BTN_START,  data[2] & 0x10);
+       input_report_key(dev, BTN_BACK,   data[2] & 0x20);
 
        /* stick press left/right */
        input_report_key(dev, BTN_THUMBL, data[2] & 0x40);
        input_report_key(dev, BTN_THUMBR, data[2] & 0x80);
 
        /* buttons A,B,X,Y,TL,TR and MODE */
-       input_report_key(dev, BTN_A, (data[3] & 0x10) >> 4);
-       input_report_key(dev, BTN_B, (data[3] & 0x20) >> 5);
-       input_report_key(dev, BTN_X, (data[3] & 0x40) >> 6);
-       input_report_key(dev, BTN_Y, (data[3] & 0x80) >> 7);
-       input_report_key(dev, BTN_TL, data[3] & 0x01 );
-       input_report_key(dev, BTN_TR, (data[3] & 0x02) >> 1);
-       input_report_key(dev, BTN_MODE, (data[3] & 0x04) >> 2);
+       input_report_key(dev, BTN_A,    data[3] & 0x10);
+       input_report_key(dev, BTN_B,    data[3] & 0x20);
+       input_report_key(dev, BTN_X,    data[3] & 0x40);
+       input_report_key(dev, BTN_Y,    data[3] & 0x80);
+       input_report_key(dev, BTN_TL,   data[3] & 0x01);
+       input_report_key(dev, BTN_TR,   data[3] & 0x02);
+       input_report_key(dev, BTN_MODE, data[3] & 0x04);
 
        /* left stick */
        input_report_abs(dev, ABS_X, (__s16) (((__s16)data[7] << 8) | 
(__s16)data[6]));
-       input_report_abs(dev, ABS_Y, ~(__s16) (((__s16)data[9] << 8) | 
(__s16)data[8]));
+       input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[9] << 8) | 
(__s16)data[8]));
 
        /* right stick */
-       input_report_abs(dev, ABS_RY, ~(__s16) (((__s16)data[13] << 8) | 
(__s16)data[12]));
        input_report_abs(dev, ABS_RX, (__s16) (((__s16)data[11] << 8) | 
(__s16)data[10]));
+       input_report_abs(dev, ABS_RY, (__s16) (((__s16)data[13] << 8) | 
(__s16)data[12]));
 
        /* triggers left/right */
        input_report_abs(dev, ABS_Z, data[4]);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to