Input: Add "Share" button to Microsoft Xbox One controller.
Subsystems (2)
PATCH 1/1 Input: Add "Share" button to Microsoft Xbox One controller.
Add "Share" button input capability and input event mapping for Microsoft Xbox One controller.
Fixed Microsoft Xbox One controller share button not working under USB connection.
Signed-off-by Chris Ye <[email protected]>
--- drivers/input/joystick/xpad.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/input/joystick/xpad.c +14 -2
@@ -368,6 +368,14 @@ static const signed short xpad360_btn[] = { /* buttons for x360 controller */-1 }; +static const signed short xpad_xboxone_btn[] = { +/* buttons for xbox one controller */ +BTN_TL ,BTN_TR ,/* Button LB/RB */ +BTN_MODE ,/* The big X button */ +KEY_RECORD ,/* The share button */ +-1 +}; +static const signed short xpad_abs[] = {ABS_X ,ABS_Y ,/* left stick */ ABS_RX ,ABS_RY ,/* right stick */
@@ -862,6 +870,7 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char/* menu/view buttons */ input_report_key (dev,BTN_START , data[4 ] &0x04 );input_report_key (dev,BTN_SELECT , data[4 ] &0x08 ); +input_report_key (dev,KEY_RECORD , data[22 ] &0x01 );/* buttons A,B,X,Y */ input_report_key (dev,BTN_A , data[4 ] &0x10 );
@@ -1668,10 +1677,13 @@ static int xpad_init_input(struct usb_xpad *xpad)input_set_capability (input_dev,EV_KEY , xpad_common_btn[i]);/* set up model-specific ones */ -if (xpad->xtype ==XTYPE_XBOX360 || xpad->xtype ==XTYPE_XBOX360W || - xpad->xtype ==XTYPE_XBOXONE ) { +if (xpad->xtype ==XTYPE_XBOX360 || xpad->xtype ==XTYPE_XBOX360W ) {for (i =0 ; xpad360_btn[i] >=0 ; i++)input_set_capability (input_dev,EV_KEY , xpad360_btn[i]); + }else if (xpad->xtype ==XTYPE_XBOXONE ) { +for (i =0 ; xpad_xboxone_btn[i] >=0 ; i++) +input_set_capability (input_dev,EV_KEY , + xpad_xboxone_btn[i]); }else {for (i =0 ; xpad_btn[i] >=0 ; i++)input_set_capability (input_dev,EV_KEY , xpad_btn[i]);
Signature · 1 line
2.30.0.617.g56c4b15f3c-goog